16
16
17
17
**Hardware:**
18
18
19
- * `Adafruit LIS331HH Breakout <https://www.adafruit.com/products/45XX >`_
20
- * `Adafruit H3LIS331 Breakout <https://www.adafruit.com/products/45XX >`_
19
+ * `Adafruit LIS331HH Breakout <https://www.adafruit.com/products/4626 >`_
20
+ * `Adafruit H3LIS331 Breakout <https://www.adafruit.com/products/4627 >`_
21
21
22
22
**Software and Dependencies:**
23
23
24
24
* Adafruit CircuitPython firmware for the supported boards:
25
- https://github.com/adafruit/circuitpython/releases
26
-
27
- * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28
- * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
25
+ https://circuitpython.org/downloads
26
+ * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
27
+ * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
29
28
"""
30
29
31
30
__version__ = "0.0.0-auto.0"
@@ -61,12 +60,16 @@ class ROByteArray:
61
60
Values are FixNums that map to the values in the defined struct. See struct
62
61
module documentation for struct format string and its possible value types.
63
62
64
- .. note:: This assumes the device addresses correspond to 8-bit bytes. This is not suitable for
65
- devices with registers of other widths such as 16-bit.
63
+ .. note::
64
+ This assumes the device addresses correspond to 8-bit bytes.
65
+ This is not suitable for devices with registers of other
66
+ widths such as 16-bit.
66
67
67
68
:param int register_address: The register address to begin reading the array from
68
- :param str struct_format : The struct format string for this register.
69
+ :param str format_str : The struct format string for this register.
69
70
:param int count: Number of elements in the array
71
+
72
+
70
73
"""
71
74
72
75
def __init__ ( # pylint: disable=too-many-arguments
@@ -203,7 +206,7 @@ class LIS331:
203
206
**Cannot be instantiated directly**
204
207
205
208
:param ~busio.I2C i2c_bus: The I2C bus the LIS331 is connected to.
206
- :param address: The I2C slave address of the sensor
209
+ :param address: The I2C device address. Defaults to :const:`0x18`
207
210
208
211
"""
209
212
@@ -261,6 +264,7 @@ def hpf_reference(self):
261
264
is a signed 8-bit number from -128 to 127. The value of each increment of 1 depends on the
262
265
currently set measurement range and is approximate:
263
266
#pylint: disable=line-too-long
267
+
264
268
+-------------------------------------------------------------+-------------------------------+
265
269
| Range | Incremental value (LSB value) |
266
270
+-------------------------------------------------------------+-------------------------------+
@@ -270,6 +274,7 @@ def hpf_reference(self):
270
274
+-------------------------------------------------------------+-------------------------------+
271
275
| ``LIS331HHRange.RANGE_24G`` or ``H3LIS331Range.RANGE_400G`` | ~63mg |
272
276
+-------------------------------------------------------------+-------------------------------+
277
+
273
278
#pylint: enable=line-too-long
274
279
"""
275
280
@@ -282,9 +287,10 @@ def hpf_reference(self, reference_value):
282
287
self ._reference_value = reference_value
283
288
284
289
def zero_hpf (self ):
285
- """When the high-pass filter is enabled with ``use_reference=False``, calling ``zero_hpf``
286
- will set all measurements to zero immediately, avoiding the normal settling time seen when
287
- using the high-pass filter without a ``hpf_reference``
290
+ """When the high-pass filter is enabled with ``use_reference=False``,
291
+ calling :meth:`zero_hpf` will set all measurements to zero immediately,
292
+ avoiding the normal settling time seen when using the high-pass filter
293
+ without a :meth:`hpf_reference`
288
294
"""
289
295
self ._zero_hpf # pylint: disable=pointless-statement
290
296
@@ -294,12 +300,14 @@ def enable_hpf(
294
300
"""Enable or disable the high-pass filter.
295
301
296
302
:param enabled: Enable or disable the filter. Default is `True` to enable
297
- :param ~RateDivisor cutoff: A `RateDivisor` to set the high-pass cutoff frequency. Default\
298
- is ``RateDivisor.ODR_DIV_50``. See ``RateDivisor`` for more information
303
+ :param ``RateDivisor`` cutoff: A ``RateDivisor`` to set the high-pass
304
+ cutoff frequency. Default is ``RateDivisor.ODR_DIV_50``. See ``RateDivisor``
305
+ for more information
299
306
:param use_reference: Determines if the filtered measurements are offset by a reference\
300
- value. Default is false.
307
+ value. Default is false.
301
308
302
- See section **4** of the LIS331DLH application note for more information `LIS331DLH application\
309
+ See section **4** of the LIS331DLH application note for more information
310
+ `LIS331DLH application
303
311
note for more information <https://www.st.com/content/ccc/resource/technical/document/\
304
312
application_note/b5/8e/58/69/cb/87/45/55/CD00215823.pdf/files/CD00215823.pdf/jcr:content/\
305
313
translations/en.CD00215823.pdf>`_
@@ -311,7 +319,7 @@ def enable_hpf(
311
319
312
320
@property
313
321
def data_rate (self ):
314
- """Select the rate at which the accelerometer takes measurements. Must be a `Rate`"""
322
+ """Select the rate at which the accelerometer takes measurements. Must be a `` Rate` `"""
315
323
return self ._cached_data_rate
316
324
317
325
@data_rate .setter
@@ -330,8 +338,8 @@ def data_rate(self, new_rate_bits):
330
338
331
339
@property
332
340
def mode (self ):
333
- """The `Mode` power mode that the sensor is set to, as determined by the current
334
- `data_rate`. To set the mode, use `data_rate` and the approprite ` Rate`"""
341
+ """The :attr: `Mode` power mode that the sensor is set to, as determined by the current
342
+ `data_rate`. To set the mode, use `data_rate` and the appropriate `` Rate` `"""
335
343
mode_bits = self ._mode_and_rate ()[0 ]
336
344
return mode_bits
337
345
@@ -348,7 +356,7 @@ def _mode_and_rate(self, data_rate=None):
348
356
@property
349
357
def range (self ):
350
358
"""Adjusts the range of values that the sensor can measure, Note that larger ranges will be
351
- less accurate. Must be a `H3LIS331Range` or `LIS331HHRange`"""
359
+ less accurate. Must be a `` H3LIS331Range`` or `` LIS331HHRange` `"""
352
360
return self ._range_bits
353
361
354
362
@range .setter
@@ -363,7 +371,7 @@ def range(self, new_range):
363
371
364
372
@property
365
373
def acceleration (self ):
366
- """The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2."""
374
+ """The x, y, z acceleration values returned in a 3-tuple and are in :math:` m / s ^ 2` ."""
367
375
368
376
raw_acceleration_bytes = self ._raw_acceleration
369
377
@@ -385,7 +393,30 @@ class LIS331HH(LIS331):
385
393
"""Driver for the LIS331HH 3-axis high-g accelerometer.
386
394
387
395
:param ~busio.I2C i2c_bus: The I2C bus the LIS331 is connected to.
388
- :param address: The I2C slave address of the sensor
396
+ :param address: The I2C device address. Defaults to :const:`0x18`
397
+
398
+ **Quickstart: Importing and using the device**
399
+
400
+ Here is an example of using the :class:`LIS331` class.
401
+ First you will need to import the libraries to use the sensor
402
+
403
+ .. code-block:: python
404
+
405
+ import board
406
+ import adafruit_lis331
407
+
408
+ Once this is done you can define your `board.I2C` object and define your sensor object
409
+
410
+ .. code-block:: python
411
+
412
+ i2c = board.I2C() # uses board.SCL and board.SDA
413
+ lis = adafruit_lis331.LIS331HH(i2c)
414
+
415
+ Now you have access to the :attr:`acceleration` attribute
416
+
417
+ .. code-block:: python
418
+
419
+ acceleration = lis.acceleration
389
420
390
421
"""
391
422
@@ -401,7 +432,32 @@ class H3LIS331(LIS331):
401
432
"""Driver for the H3LIS331 3-axis high-g accelerometer.
402
433
403
434
:param ~busio.I2C i2c_bus: The I2C bus the LIS331 is connected to.
404
- :param address: The I2C slave address of the sensor
435
+ :param address: The I2C slave address of the sensor. Defaults to :const:`0x18`
436
+
437
+ **Quickstart: Importing and using the device**
438
+
439
+ Here is an example of using the :class:`LIS331` class.
440
+ First you will need to import the libraries to use the sensor
441
+
442
+ .. code-block:: python
443
+
444
+ import board
445
+ import adafruit_lis331
446
+
447
+ Once this is done you can define your `board.I2C` object and define your sensor object
448
+
449
+ .. code-block:: python
450
+
451
+ i2c = board.I2C() # uses board.SCL and board.SDA
452
+ lis = adafruit_lis331.H3LIS331(i2c)
453
+
454
+ Now you have access to the :attr:`acceleration` attribute
455
+
456
+ .. code-block:: python
457
+
458
+ acceleration = lis.acceleration
459
+
460
+
405
461
406
462
"""
407
463
0 commit comments