diff --git a/README.rst b/README.rst index f4a898f..1608149 100644 --- a/README.rst +++ b/README.rst @@ -60,7 +60,7 @@ Usage Example import board import adafruit_fxos8700 - i2c = board.I2C() + i2c = board.I2C() # uses board.SCL and board.SDA sensor = adafruit_fxos8700.FXOS8700(i2c) while True: diff --git a/adafruit_fxos8700.py b/adafruit_fxos8700.py index 9f4a269..f37af63 100644 --- a/adafruit_fxos8700.py +++ b/adafruit_fxos8700.py @@ -18,7 +18,7 @@ **Hardware:** -* Adafruit `Precision NXP 9-DOF Breakout Board - FXOS8700 + FXAS21002 +* `Adafruit Precision NXP 9-DOF Breakout Board - FXOS8700 + FXAS21002 `_ (Product ID: 3463) **Software and Dependencies:** @@ -26,7 +26,8 @@ * Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads -* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice +* Adafruit's Bus Device library: + https://github.com/adafruit/Adafruit_CircuitPython_BusDevice """ try: import ustruct as struct @@ -126,7 +127,8 @@ class FXOS8700: _BUFFER = bytearray(13) def __init__(self, i2c, address=_FXOS8700_ADDRESS, accel_range=ACCEL_RANGE_2G): - assert accel_range in (ACCEL_RANGE_2G, ACCEL_RANGE_4G, ACCEL_RANGE_8G) + if accel_range not in (ACCEL_RANGE_2G, ACCEL_RANGE_4G, ACCEL_RANGE_8G): + raise Exception("accel_range selected is not a valid option") self._accel_range = accel_range self._device = i2c_dev.I2CDevice(i2c, address) # Check for chip ID value. diff --git a/examples/fxos8700_simpletest.py b/examples/fxos8700_simpletest.py index 25ee1f9..3b4c087 100644 --- a/examples/fxos8700_simpletest.py +++ b/examples/fxos8700_simpletest.py @@ -9,7 +9,7 @@ # Create sensor object, communicating over the board's default I2C bus -i2c = board.I2C() +i2c = board.I2C() # uses board.SCL and board.SDA sensor = adafruit_fxos8700.FXOS8700(i2c) # Optionally create the sensor with a different accelerometer range (the # default is 2G, but you can use 4G or 8G values):