|
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 | """
|
|
72 | 72 |
|
73 | 73 |
|
74 | 74 | class FXAS21002C:
|
75 |
| - """Driver for the NXP FXAS21002C gyroscope.""" |
| 75 | + """Driver for the NXP FXAS21002C gyroscope. |
| 76 | +
|
| 77 | + :param ~busio.I2C i2c: The I2C bus the device is connected to |
| 78 | + :param int address: The I2C device address. Defaults to :const:`0x21` |
| 79 | + :param int gyro_range: Device range. Defaults to :const:`250`. |
| 80 | +
|
| 81 | +
|
| 82 | + **Quickstart: Importing and using the device** |
| 83 | +
|
| 84 | + Here is an example of using the :class:`FXAS21002C` class. |
| 85 | + First you will need to import the libraries to use the sensor |
| 86 | +
|
| 87 | + .. code-block:: python |
| 88 | +
|
| 89 | + import board |
| 90 | + import adafruit_fxas21002c |
| 91 | +
|
| 92 | + Once this is done you can define your `board.I2C` object and define your sensor object |
| 93 | +
|
| 94 | + .. code-block:: python |
| 95 | +
|
| 96 | + i2c = board.I2C() # uses board.SCL and board.SDA |
| 97 | + sensor = adafruit_fxas21002c.FXAS21002C(i2c) |
| 98 | +
|
| 99 | + Now you have access to the :attr:`gyroscope` attribute |
| 100 | +
|
| 101 | + .. code-block:: python |
| 102 | +
|
| 103 | + gyro_x, gyro_y, gyro_z = sensor.gyroscope |
| 104 | +
|
| 105 | + """ |
76 | 106 |
|
77 | 107 | # Class-level buffer for reading and writing data with the sensor.
|
78 | 108 | # This reduces memory allocations but means the code is not re-entrant or
|
@@ -101,7 +131,7 @@ def __init__(self, i2c, address=_FXAS21002C_ADDRESS, gyro_range=GYRO_RANGE_250DP
|
101 | 131 | elif gyro_range == GYRO_RANGE_2000DPS:
|
102 | 132 | ctrl_reg0 = 0x00
|
103 | 133 | # Reset then switch to active mode with 100Hz output
|
104 |
| - # Putting into standy doesn't work as the chip becomes instantly |
| 134 | + # Putting into standby doesn't work as the chip becomes instantly |
105 | 135 | # unresponsive. Perhaps CircuitPython is too slow to go into standby
|
106 | 136 | # and send reset? Keep these two commented for now:
|
107 | 137 | # self._write_u8(_GYRO_REGISTER_CTRL_REG1, 0x00) # Standby)
|
|
0 commit comments