Skip to content

Commit d059066

Browse files
committed
correcting_assertions
1 parent 1e7f645 commit d059066

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Usage Example
6060
import board
6161
import adafruit_fxos8700
6262
63-
i2c = board.I2C()
63+
i2c = board.I2C() # uses board.SCL and board.SDA
6464
sensor = adafruit_fxos8700.FXOS8700(i2c)
6565
6666
while True:

adafruit_fxos8700.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
1919
**Hardware:**
2020
21-
* Adafruit `Precision NXP 9-DOF Breakout Board - FXOS8700 + FXAS21002
21+
* `Adafruit Precision NXP 9-DOF Breakout Board - FXOS8700 + FXAS21002
2222
<https://www.adafruit.com/product/3463>`_ (Product ID: 3463)
2323
2424
**Software and Dependencies:**
2525
2626
* Adafruit CircuitPython firmware for the supported boards:
2727
https://circuitpython.org/downloads
2828
29-
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
29+
* Adafruit's Bus Device library:
30+
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
3031
"""
3132
try:
3233
import ustruct as struct
@@ -126,7 +127,8 @@ class FXOS8700:
126127
_BUFFER = bytearray(13)
127128

128129
def __init__(self, i2c, address=_FXOS8700_ADDRESS, accel_range=ACCEL_RANGE_2G):
129-
assert accel_range in (ACCEL_RANGE_2G, ACCEL_RANGE_4G, ACCEL_RANGE_8G)
130+
if accel_range not in (ACCEL_RANGE_2G, ACCEL_RANGE_4G, ACCEL_RANGE_8G):
131+
raise Exception("accel_range selected is not a valid option")
130132
self._accel_range = accel_range
131133
self._device = i2c_dev.I2CDevice(i2c, address)
132134
# Check for chip ID value.

examples/fxos8700_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
# Create sensor object, communicating over the board's default I2C bus
12-
i2c = board.I2C()
12+
i2c = board.I2C() # uses board.SCL and board.SDA
1313
sensor = adafruit_fxos8700.FXOS8700(i2c)
1414
# Optionally create the sensor with a different accelerometer range (the
1515
# default is 2G, but you can use 4G or 8G values):

0 commit comments

Comments
 (0)