|
18 | 18 |
|
19 | 19 | **Hardware:**
|
20 | 20 |
|
21 |
| -* `L3GD20H Triple-Axis Gyro Breakout Board <https://www.adafruit.com/product/1032>`_ |
| 21 | +* Adafruit `L3GD20H Triple-Axis Gyro Breakout Board <https://www.adafruit.com/product/1032>`_ |
22 | 22 |
|
23 | 23 | **Software and Dependencies:**
|
24 | 24 |
|
25 | 25 | * Adafruit CircuitPython firmware for the supported boards:
|
26 |
| - https://github.com/adafruit/circuitpython/releases |
| 26 | + https://circuitpython.org/downloads |
27 | 27 |
|
28 | 28 |
|
29 | 29 | * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
|
@@ -77,11 +77,22 @@ class L3GD20:
|
77 | 77 | """
|
78 | 78 | Driver for the L3GD20 3-axis Gyroscope sensor.
|
79 | 79 |
|
80 |
| - :param int rng: a range value one of L3DS20_RANGE_250DPS (default), L3DS20_RANGE_500DPS, or |
81 |
| - L3DS20_RANGE_2000DPS |
| 80 | + :param int rng: a range value one of: |
82 | 81 |
|
83 |
| - :param int rate: a rate value one of L3DS20_RATE_100HZ (default), L3DS20_RATE_200HZ, |
84 |
| - L3DS20_RATE_400HZ, or L3DS20_RATE_800HZ |
| 82 | + * :const:`L3DS20_RANGE_250DPS` |
| 83 | + * :const:`L3DS20_RANGE_500DPS` |
| 84 | + * :const:`L3DS20_RANGE_2000DPS` |
| 85 | +
|
| 86 | + Defaults to :const:`L3DS20_RANGE_250DPS` |
| 87 | +
|
| 88 | + :param int rate: a rate value one of |
| 89 | +
|
| 90 | + * :const:`L3DS20_RATE_100HZ` |
| 91 | + * :const:`L3DS20_RATE_200HZ` |
| 92 | + * :const:`L3DS20_RATE_400HZ` |
| 93 | + * :const:`L3DS20_RATE_800HZ` |
| 94 | +
|
| 95 | + Defaults to :const:`L3DS20_RATE_100HZ` |
85 | 96 | """
|
86 | 97 |
|
87 | 98 | def __init__(self, rng=L3DS20_RANGE_250DPS, rate=L3DS20_RATE_100HZ):
|
@@ -194,10 +205,35 @@ class L3GD20_I2C(L3GD20):
|
194 | 205 | """
|
195 | 206 | Driver for L3GD20 Gyroscope using I2C communications
|
196 | 207 |
|
197 |
| - :param ~busio.I2C i2c: initialized busio I2C class |
198 |
| - :param int rng: the optional range value: L3DS20_RANGE_250DPS(default), L3DS20_RANGE_500DPS, or |
199 |
| - L3DS20_RANGE_2000DPS |
200 |
| - :param address: the optional device address, 0x68 is the default address |
| 208 | + :param ~busio.I2C i2c: The I2C bus the device is connected to |
| 209 | + :param int rng: range value. Defaults to :const:`0x68` |
| 210 | + :param int rate: rate value. Defaults to :const:`L3DS20_RATE_100HZ` |
| 211 | +
|
| 212 | +
|
| 213 | + **Quickstart: Importing and using the device** |
| 214 | +
|
| 215 | + Here is an example of using the :class:`L3GD20_I2C` class. |
| 216 | + First you will need to import the libraries to use the sensor |
| 217 | +
|
| 218 | + .. code-block:: python |
| 219 | +
|
| 220 | + import board |
| 221 | + import adafruit_l3gd20 |
| 222 | +
|
| 223 | + Once this is done you can define your `board.I2C` object and define your sensor object |
| 224 | +
|
| 225 | + .. code-block:: python |
| 226 | +
|
| 227 | + i2c = board.I2C() # uses board.SCL and board.SDA |
| 228 | + sensor = adafruit_l3gd20.L3GD20_I2C(i2c) |
| 229 | +
|
| 230 | + Now you have access to the :attr:`gyro` attribute |
| 231 | +
|
| 232 | + .. code-block:: python |
| 233 | +
|
| 234 | + gyro_data = sensor.gyro |
| 235 | +
|
| 236 | +
|
201 | 237 | """
|
202 | 238 |
|
203 | 239 | gyro_raw = Struct(_L3GD20_REGISTER_OUT_X_L_X80, "<hhh")
|
@@ -240,11 +276,36 @@ class L3GD20_SPI(L3GD20):
|
240 | 276 | """
|
241 | 277 | Driver for L3GD20 Gyroscope using SPI communications
|
242 | 278 |
|
243 |
| - :param ~busio.SPI spi_busio: initialized busio SPI class |
| 279 | + :param ~busio.SPI spi_busio: The SPI bus the device is connected to |
244 | 280 | :param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal
|
245 |
| - :param int rng: the optional range value: L3DS20_RANGE_250DPS(default), L3DS20_RANGE_500DPS, or |
246 |
| - L3DS20_RANGE_2000DPS |
247 |
| - :param baudrate: spi baud rate default is 100000 |
| 281 | + :param int rng: range value. Defaults to :const:`L3DS20_RANGE_250DPS`. |
| 282 | + :param baudrate: SPI baud rate. Defaults to :const:`100000` |
| 283 | + :param int rate: rate value. Defaults to :const:`L3DS20_RATE_100HZ` |
| 284 | +
|
| 285 | + **Quickstart: Importing and using the device** |
| 286 | +
|
| 287 | + Here is an example of using the :class:`L3GD20_SPI` class. |
| 288 | + First you will need to import the libraries to use the sensor |
| 289 | +
|
| 290 | + .. code-block:: python |
| 291 | +
|
| 292 | + import board |
| 293 | + import adafruit_l3gd20 |
| 294 | +
|
| 295 | + Once this is done you can define your `board.SPI` object and define your sensor object |
| 296 | +
|
| 297 | + .. code-block:: python |
| 298 | +
|
| 299 | + spi = board.SPI() |
| 300 | + sensor = adafruit_l3gd20.L3GD20_SPI(spi) |
| 301 | +
|
| 302 | + Now you have access to the :attr:`gyro` attribute |
| 303 | +
|
| 304 | + .. code-block:: python |
| 305 | +
|
| 306 | + gyro_data = sensor.gyro |
| 307 | +
|
| 308 | +
|
248 | 309 | """
|
249 | 310 |
|
250 | 311 | def __init__(
|
|
0 commit comments