diff options
Diffstat (limited to 'tests/ports/stm32/i2c_accel.py')
-rw-r--r-- | tests/ports/stm32/i2c_accel.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/ports/stm32/i2c_accel.py b/tests/ports/stm32/i2c_accel.py index 8b87d406d0..11ff1392ba 100644 --- a/tests/ports/stm32/i2c_accel.py +++ b/tests/ports/stm32/i2c_accel.py @@ -1,15 +1,14 @@ # use accelerometer to test i2c bus -import pyb -from pyb import I2C - -if not hasattr(pyb, "Accel"): +try: + from pyb import Accel, I2C +except ImportError: print("SKIP") raise SystemExit accel_addr = 76 -pyb.Accel() # this will init the MMA for us +Accel() # this will init the MMA for us i2c = I2C(1, I2C.CONTROLLER, baudrate=400000) |