micropython/tests/ports/stm32/i2c.py
Damien George 7bbcee3cf0 tests: Move port-specific test directories into tests/ports/ directory.
To keep them all together, mirroring the top-level directory structure.

Signed-off-by: Damien George <damien@micropython.org>
2024-01-22 11:48:27 +11:00

17 lines
288 B
Python

import pyb
from pyb import I2C
# test we can correctly create by id
for bus in (-1, 0, 1):
try:
I2C(bus)
print("I2C", bus)
except ValueError:
print("ValueError", bus)
i2c = I2C(1)
i2c.init(I2C.CONTROLLER, baudrate=400000)
print(i2c.scan())
i2c.deinit()