23
23
24
24
**Software and Dependencies:**
25
25
26
- * Adafruit CircuitPython firmware (2.2.0+) for the ESP8622 and M0-based boards:
27
- https://github.com/adafruit/circuitpython/releases
26
+ * Adafruit CircuitPython firmware for the supported boards:
27
+ https://circuitpython.org/downloads
28
28
29
29
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
30
30
"""
@@ -87,7 +87,38 @@ def _twos_comp(val, bits):
87
87
88
88
89
89
class FXOS8700 :
90
- """Driver for the NXP FXOS8700 accelerometer and magnetometer."""
90
+ """Driver for the NXP FXOS8700 accelerometer and magnetometer.
91
+
92
+ :param ~busio.I2C i2c: The I2C bus the device is connected to
93
+ :param int address: The I2C device address. Defaults to :const:`0x1F`
94
+ :param int accel_range: Device range. Defaults to :const:`0x00`.
95
+
96
+
97
+ **Quickstart: Importing and using the device**
98
+
99
+ Here is an example of using the :class:`FXOS8700` class.
100
+ First you will need to import the libraries to use the sensor
101
+
102
+ .. code-block:: python
103
+
104
+ import board
105
+ import adafruit_fxos8700
106
+
107
+ Once this is done you can define your `board.I2C` object and define your sensor object
108
+
109
+ .. code-block:: python
110
+
111
+ i2c = board.I2C() # uses board.SCL and board.SDA
112
+ sensor = adafruit_fxos8700.FXOS8700(i2c)
113
+
114
+ Now you have access to the :attr:`accelerometer` and :attr:`magnetometer` attributes
115
+
116
+ .. code-block:: python
117
+
118
+ accel_x, accel_y, accel_z = sensor.accelerometer
119
+ mag_x, mag_y, mag_z = sensor.magnetometer
120
+
121
+ """
91
122
92
123
# Class-level buffer for reading and writing data with the sensor.
93
124
# This reduces memory allocations but means the code is not re-entrant or
@@ -171,7 +202,7 @@ def read_raw_accel_mag(self):
171
202
@property
172
203
def accelerometer (self ):
173
204
"""Read the acceleration from the accelerometer and return its X, Y, Z axis values as a
174
- 3-tuple in m/s^2.
205
+ 3-tuple in :math:` m/s^2` .
175
206
"""
176
207
accel_raw , _ = self .read_raw_accel_mag ()
177
208
# Convert accel values to m/s^2
@@ -187,7 +218,7 @@ def accelerometer(self):
187
218
@property
188
219
def magnetometer (self ):
189
220
"""
190
- Read the magnetometer values and return its X, Y, Z axis values as a 3-tuple in uTeslas .
221
+ Read the magnetometer values and return its X, Y, Z axis values as a 3-tuple in μTeslas .
191
222
"""
192
223
_ , mag_raw = self .read_raw_accel_mag ()
193
224
# Convert mag values to uTesla
0 commit comments