@@ -112,25 +112,25 @@ def is_valid(cls, value):
112
112
113
113
114
114
class AccelRange (CV ):
115
- """Options for `` accelerometer_range` `"""
115
+ """Options for :attr:`ICM20X. accelerometer_range`"""
116
116
117
117
pass # pylint: disable=unnecessary-pass
118
118
119
119
120
120
class GyroRange (CV ):
121
- """Options for `` gyro_data_range` `"""
121
+ """Options for :attr:`ICM20X. gyro_data_range`"""
122
122
123
123
pass # pylint: disable=unnecessary-pass
124
124
125
125
126
126
class GyroDLPFFreq (CV ):
127
- """Options for `` gyro_dlpf_cutoff` `"""
127
+ """Options for :attr:`ICM20X. gyro_dlpf_cutoff`"""
128
128
129
129
pass # pylint: disable=unnecessary-pass
130
130
131
131
132
132
class AccelDLPFFreq (CV ):
133
- """Options for `` accel_dlpf_cutoff` `"""
133
+ """Options for :attr:`ICM20X. accel_dlpf_cutoff`"""
134
134
135
135
pass # pylint: disable=unnecessary-pass
136
136
@@ -140,7 +140,7 @@ class ICM20X: # pylint:disable=too-many-instance-attributes
140
140
141
141
142
142
:param ~busio.I2C i2c_bus: The I2C bus the ICM20X is connected to.
143
- :param address: The I2C slave address of the sensor
143
+ :param int address: The I2C address of the device.
144
144
145
145
"""
146
146
@@ -227,7 +227,7 @@ def __init__(self, i2c_bus, address):
227
227
self .initialize ()
228
228
229
229
def initialize (self ):
230
- """Configure the sensors with the default settings. For use after calling `reset() `"""
230
+ """Configure the sensors with the default settings. For use after calling :meth: `reset`"""
231
231
232
232
self ._sleep = False
233
233
self .accelerometer_range = AccelRange .RANGE_8G # pylint: disable=no-member
@@ -262,7 +262,7 @@ def _sleep(self, sleep_enabled):
262
262
263
263
@property
264
264
def acceleration (self ):
265
- """The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2."""
265
+ """The x, y, z acceleration values returned in a 3-tuple and are in :math:` m / s ^ 2.` """
266
266
self ._bank = 0
267
267
raw_accel_data = self ._raw_accel_data
268
268
sleep (0.005 )
@@ -275,7 +275,8 @@ def acceleration(self):
275
275
276
276
@property
277
277
def gyro (self ):
278
- """The x, y, z angular velocity values returned in a 3-tuple and are in degrees / second"""
278
+ """The x, y, z angular velocity values returned in a 3-tuple and
279
+ are in :math:`degrees / second`"""
279
280
self ._bank = 0
280
281
raw_gyro_data = self ._raw_gyro_data
281
282
x = self ._scale_gyro_data (raw_gyro_data [0 ])
@@ -331,12 +332,19 @@ def gyro_range(self, value):
331
332
332
333
@property
333
334
def accelerometer_data_rate_divisor (self ):
334
- """The divisor for the rate at which accelerometer measurements are taken in Hz
335
+ """
336
+ The divisor for the rate at which accelerometer measurements are taken in Hz
337
+
338
+ .. note::
339
+ The data rates are set indirectly by setting a rate divisor according to the
340
+ following formula:
341
+
342
+ .. math::
335
343
336
- Note: The data rates are set indirectly by setting a rate divisor according to the
337
- following formula: ``accelerometer_data_rate = 1125/(1+divisor)``
344
+ \\ text{accelerometer_data_rate} = \\ frac{1125}{1 + divisor}
338
345
339
346
This function sets the raw rate divisor.
347
+
340
348
"""
341
349
self ._bank = 2
342
350
raw_rate_divisor = self ._accel_rate_divisor
@@ -355,10 +363,16 @@ def accelerometer_data_rate_divisor(self, value):
355
363
356
364
@property
357
365
def gyro_data_rate_divisor (self ):
358
- """The divisor for the rate at which gyro measurements are taken in Hz
366
+ """
367
+ The divisor for the rate at which gyro measurements are taken in Hz
359
368
360
- Note: The data rates are set indirectly by setting a rate divisor according to the
361
- following formula: ``gyro_data_rate = 1100/(1+divisor)``
369
+ .. note::
370
+ The data rates are set indirectly by setting a rate divisor according to the
371
+ following formula:
372
+
373
+ .. math::
374
+
375
+ \\ text{gyro_data_rate} = \\ frac{1100}{1 + divisor}
362
376
363
377
This function sets the raw rate divisor.
364
378
"""
@@ -388,8 +402,14 @@ def _gyro_rate_calc(self, divisor): # pylint:disable=no-self-use
388
402
def accelerometer_data_rate (self ):
389
403
"""The rate at which accelerometer measurements are taken in Hz
390
404
391
- Note: The data rates are set indirectly by setting a rate divisor according to the
392
- following formula: ``accelerometer_data_rate = 1125/(1+divisor)``
405
+ .. note::
406
+
407
+ The data rates are set indirectly by setting a rate divisor according to the
408
+ following formula:
409
+
410
+ .. math::
411
+
412
+ \\ text{accelerometer_data_rate} = \\ frac{1125}{1 + divisor}
393
413
394
414
This function does the math to find the divisor from a given rate but it will not be
395
415
exactly as specified.
@@ -408,8 +428,14 @@ def accelerometer_data_rate(self, value):
408
428
def gyro_data_rate (self ):
409
429
"""The rate at which gyro measurements are taken in Hz
410
430
411
- Note: The data rates are set indirectly by setting a rate divisor according to the
412
- following formula: ``gyro_data_rate = 1100/(1+divisor)``
431
+ .. note::
432
+ The data rates are set indirectly by setting a rate divisor according to the
433
+ following formula:
434
+
435
+ .. math::
436
+
437
+ \\ text{gyro_data_rate } = \\ frac{1100}{1 + divisor}
438
+
413
439
This function does the math to find the divisor from a given rate but it will not
414
440
be exactly as specified.
415
441
"""
@@ -429,8 +455,11 @@ def accel_dlpf_cutoff(self):
429
455
above the given frequency will be filtered out. Must be an ``AccelDLPFCutoff``.
430
456
Use AccelDLPFCutoff.DISABLED to disable the filter
431
457
432
- **Note** readings immediately following setting a cutoff frequency will be
433
- inaccurate due to the filter "warming up" """
458
+ .. note::
459
+ Readings immediately following setting a cutoff frequency will be
460
+ inaccurate due to the filter "warming up"
461
+
462
+ """
434
463
self ._bank = 2
435
464
return self ._accel_dlpf_config
436
465
@@ -452,8 +481,11 @@ def gyro_dlpf_cutoff(self):
452
481
given frequency will be filtered out. Must be a ``GyroDLPFFreq``. Use
453
482
GyroDLPFCutoff.DISABLED to disable the filter
454
483
455
- **Note** readings immediately following setting a cutoff frequency will be
456
- inaccurate due to the filter "warming up" """
484
+ .. note::
485
+ Readings immediately following setting a cutoff frequency will be
486
+ inaccurate due to the filter "warming up"
487
+
488
+ """
457
489
self ._bank = 2
458
490
return self ._gyro_dlpf_config
459
491
@@ -484,7 +516,32 @@ class ICM20649(ICM20X):
484
516
"""Library for the ST ICM-20649 Wide-Range 6-DoF Accelerometer and Gyro.
485
517
486
518
:param ~busio.I2C i2c_bus: The I2C bus the ICM20649 is connected to.
487
- :param address: The I2C slave address of the sensor
519
+ :param int address: The I2C address of the device. Defaults to :const:`0x68`
520
+
521
+ **Quickstart: Importing and using the ICM20649 temperature sensor**
522
+
523
+ Here is an example of using the :class:`ICM2020649` class.
524
+ First you will need to import the libraries to use the sensor
525
+
526
+ .. code-block:: python
527
+
528
+ import board
529
+ import adafruit_icm20x
530
+
531
+ Once this is done you can define your `board.I2C` object and define your sensor object
532
+
533
+ .. code-block:: python
534
+
535
+ i2c = board.I2C() # uses board.SCL and board.SDA
536
+ icm = adafruit_icm20x.ICM20649(i2c)
537
+
538
+ Now you have access to the acceleration using :attr:`acceleration` attribute and
539
+ the gyro information using the :attr:`gyro` attribute.
540
+
541
+ .. code-block:: python
542
+
543
+ acceleration = icm.acceleration
544
+ gyro = icm.gyro
488
545
489
546
"""
490
547
@@ -526,7 +583,7 @@ def __init__(self, i2c_bus, address=_ICM20649_DEFAULT_ADDRESS):
526
583
527
584
528
585
class MagDataRate (CV ):
529
- """Options for `` magnetometer_data_rate` `"""
586
+ """Options for :attr:`ICM20948. magnetometer_data_rate`"""
530
587
531
588
pass # pylint: disable=unnecessary-pass
532
589
@@ -535,7 +592,36 @@ class ICM20948(ICM20X): # pylint:disable=too-many-instance-attributes
535
592
"""Library for the ST ICM-20948 Wide-Range 6-DoF Accelerometer and Gyro.
536
593
537
594
:param ~busio.I2C i2c_bus: The I2C bus the ICM20948 is connected to.
538
- :param address: The I2C slave address of the sensor
595
+ :param int address: The I2C address of the device. Defaults to :const:`0x69`
596
+
597
+ **Quickstart: Importing and using the ICM20948 temperature sensor**
598
+
599
+ Here is an example of using the :class:`ICM20948` class.
600
+ First you will need to import the libraries to use the sensor
601
+
602
+ .. code-block:: python
603
+
604
+ import board
605
+ import adafruit_icm20x
606
+
607
+ Once this is done you can define your `board.I2C` object and define your sensor object
608
+
609
+ .. code-block:: python
610
+
611
+ i2c = board.I2C() # uses board.SCL and board.SDA
612
+ icm = adafruit_icm20x.ICM20948(i2c)
613
+
614
+ Now you have access to the acceleration using :attr:`acceleration` attribute,
615
+ the gyro information using the :attr:`gyro` attribute and the magnetic information
616
+ using the :attr:`magnetic` attribute
617
+
618
+ .. code-block:: python
619
+
620
+ acceleration = icm.acceleration
621
+ gyro = icm.gyro
622
+ magnetic = icm.magnetic
623
+
624
+
539
625
"""
540
626
541
627
_slave_finished = ROBit (_ICM20X_I2C_MST_STATUS , 6 )
@@ -670,7 +756,7 @@ def magnetic(self):
670
756
671
757
@property
672
758
def magnetometer_data_rate (self ):
673
- """The rate at which the magenetometer takes measurements to update its output registers"""
759
+ """The rate at which the magnetometer takes measurements to update its output registers"""
674
760
# read mag DR register
675
761
self ._read_mag_register (_AK09916_CNTL2 )
676
762
@@ -707,7 +793,7 @@ def _read_mag_register(self, register_addr, slave_addr=0x0C):
707
793
finished = False
708
794
for _i in range (100 ):
709
795
finished = self ._slave_finished
710
- if finished : # bueno!
796
+ if finished : # bueno! :)
711
797
break
712
798
sleep (0.010 )
713
799
@@ -737,7 +823,7 @@ def _write_mag_register(self, register_addr, value, slave_addr=0x0C):
737
823
finished = False
738
824
for _i in range (100 ):
739
825
finished = self ._slave_finished
740
- if finished : # bueno!
826
+ if finished : # bueno! :)
741
827
break
742
828
sleep (0.010 )
743
829
0 commit comments