summaryrefslogtreecommitdiffstatshomepage
path: root/tests/pyb/i2c.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-28 11:06:12 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-28 11:06:12 +0100
commit6d1ff7e9665c253b26fec0f7696107ff8446185c (patch)
tree88f7508387f62f48ae2e5fa0f1582dc4676fdef9 /tests/pyb/i2c.py
parent17d9b5006dc8dc585de6c52abfb1a65487e0d16d (diff)
downloadmicropython-6d1ff7e9665c253b26fec0f7696107ff8446185c.tar.gz
micropython-6d1ff7e9665c253b26fec0f7696107ff8446185c.zip
tests: Add tests to create valid and invalid UART, I2C, SPI, CAN busses.
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 1f88c8e975..a220f8e858 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())