summaryrefslogtreecommitdiff
path: root/tests/pyb/i2c.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pyb/i2c.py')
-rw-r--r--tests/pyb/i2c.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/pyb/i2c.py b/tests/pyb/i2c.py
index 1f88c8e97..a220f8e85 100644
--- a/tests/pyb/i2c.py
+++ b/tests/pyb/i2c.py
@@ -1,8 +1,15 @@
import pyb
from pyb import I2C
+# test we can correctly create by id or name
+for bus in (-1, 0, 1, 2, 3, "X", "Y", "Z"):
+ try:
+ I2C(bus)
+ print("I2C", bus)
+ except ValueError:
+ print("ValueError", bus)
+
i2c = I2C(1)
-i2c2 = I2C(2)
i2c.init(I2C.MASTER, baudrate=400000)
print(i2c.scan())