1616
1717**Hardware:**
1818
19- * Adafruit MSA301 Breakout https://www.adafruit.com/product/4344
19+ * Adafruit `MSA301 Triple Axis Accelerometer
20+ <https://www.adafruit.com/product/4344>`_
2021
2122**Software and Dependencies:**
2223
2324* Adafruit CircuitPython firmware for the supported boards:
24- https://github.com/adafruit/circuitpython/releases
25-
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
25+ https://circuitpython.org/downloads
26+ * Adafruit's Bus Device library:
27+ https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28+ * Adafruit's Register library:
29+ https://github.com/adafruit/Adafruit_CircuitPython_Register
2830"""
2931
3032__version__ = "0.0.0-auto.0"
6365
6466class Mode : # pylint: disable=too-few-public-methods
6567 """An enum-like class representing the different modes that the MSA301 can
66- use. The values can be referenced like `` Mode.NORMAL`` or `` Mode.SUSPEND` `
68+ use. The values can be referenced like :attr:` Mode.NORMAL` or :attr:` Mode.SUSPEND`
6769 Possible values are
6870
69- - ``Mode.NORMAL``
70- - ``Mode.LOW_POWER``
71- - ``Mode.SUSPEND``
71+ - :attr:`Mode.NORMAL`
72+ - :attr:`Mode.LOW_POWER`
73+ - :attr:`Mode.SUSPEND`
74+
7275 """
7376
7477 # pylint: disable=invalid-name
@@ -78,21 +81,24 @@ class Mode: # pylint: disable=too-few-public-methods
7881
7982
8083class DataRate : # pylint: disable=too-few-public-methods
81- """An enum-like class representing the different data rates that the MSA301 can
82- use. The values can be referenced like ``DataRate.RATE_1_HZ`` or ``DataRate.RATE_1000_HZ``
84+ """An enum-like class representing the different
85+ data rates that the MSA301 can
86+ use. The values can be referenced like
87+ :attr:`DataRate.RATE_1_HZ` or :attr:`DataRate.RATE_1000_HZ`
8388 Possible values are
8489
85- - ``DataRate.RATE_1_HZ``
86- - ``DataRate.RATE_1_95_HZ``
87- - ``DataRate.RATE_3_9_HZ``
88- - ``DataRate.RATE_7_81_HZ``
89- - ``DataRate.RATE_15_63_HZ``
90- - ``DataRate.RATE_31_25_HZ``
91- - ``DataRate.RATE_62_5_HZ``
92- - ``DataRate.RATE_125_HZ``
93- - ``DataRate.RATE_250_HZ``
94- - ``DataRate.RATE_500_HZ``
95- - ``DataRate.RATE_1000_HZ``
90+ - :attr:`DataRate.RATE_1_HZ`
91+ - :attr:`DataRate.RATE_1_95_HZ`
92+ - :attr:`DataRate.RATE_3_9_HZ`
93+ - :attr:`DataRate.RATE_7_81_HZ`
94+ - :attr:`DataRate.RATE_15_63_HZ`
95+ - :attr:`DataRate.RATE_31_25_HZ`
96+ - :attr:`DataRate.RATE_62_5_HZ`
97+ - :attr:`DataRate.RATE_125_HZ`
98+ - :attr:`DataRate.RATE_250_HZ`
99+ - :attr:`DataRate.RATE_500_HZ`
100+ - :attr:`DataRate.RATE_1000_HZ`
101+
96102 """
97103
98104 RATE_1_HZ = 0b0000 # 1 Hz
@@ -109,21 +115,24 @@ class DataRate: # pylint: disable=too-few-public-methods
109115
110116
111117class BandWidth : # pylint: disable=too-few-public-methods
112- """An enum-like class representing the different bandwidths that the MSA301 can
113- use. The values can be referenced like ``BandWidth.WIDTH_1_HZ`` or ``BandWidth.RATE_500_HZ``
118+ """An enum-like class representing the different
119+ bandwidths that the MSA301 can
120+ use. The values can be referenced
121+ like :attr:`BandWidth.WIDTH_1_HZ` or :attr:`BandWidth.RATE_500_HZ`
114122 Possible values are
115123
116- - ``BandWidth.RATE_1_HZ``
117- - ``BandWidth.RATE_1_95_HZ``
118- - ``BandWidth.RATE_3_9_HZ``
119- - ``BandWidth.RATE_7_81_HZ``
120- - ``BandWidth.RATE_15_63_HZ``
121- - ``BandWidth.RATE_31_25_HZ``
122- - ``BandWidth.RATE_62_5_HZ``
123- - ``BandWidth.RATE_125_HZ``
124- - ``BandWidth.RATE_250_HZ``
125- - ``BandWidth.RATE_500_HZ``
126- - ``BandWidth.RATE_1000_HZ``
124+ - :attr:`BandWidth.RATE_1_HZ`
125+ - :attr:`BandWidth.RATE_1_95_HZ`
126+ - :attr:`BandWidth.RATE_3_9_HZ`
127+ - :attr:`BandWidth.RATE_7_81_HZ`
128+ - :attr:`BandWidth.RATE_15_63_HZ`
129+ - :attr:`BandWidth.RATE_31_25_HZ`
130+ - :attr:`BandWidth.RATE_62_5_HZ`
131+ - :attr:`BandWidth.RATE_125_HZ`
132+ - :attr:`BandWidth.RATE_250_HZ`
133+ - :attr:`BandWidth.RATE_500_HZ`
134+ - :attr:`BandWidth.RATE_1000_HZ`
135+
127136 """
128137
129138 WIDTH_1_95_HZ = 0b0000 # 1.95 Hz
@@ -138,14 +147,17 @@ class BandWidth: # pylint: disable=too-few-public-methods
138147
139148
140149class Range : # pylint: disable=too-few-public-methods
141- """An enum-like class representing the different acceleration measurement ranges that the
142- MSA301 can use. The values can be referenced like ``Range.RANGE_2_G`` or ``Range.RANGE_16_G``
150+ """An enum-like class representing the different
151+ acceleration measurement ranges that the
152+ MSA301 can use. The values can be referenced like
153+ :attr:`Range.RANGE_2_G` or :attr:`Range.RANGE_16_G`
143154 Possible values are
144155
145- - ``Range.RANGE_2_G``
146- - ``Range.RANGE_4_G``
147- - ``Range.RANGE_8_G``
148- - ``Range.RANGE_16_G``
156+ - :attr:`Range.RANGE_2_G`
157+ - :attr:`Range.RANGE_4_G`
158+ - :attr:`Range.RANGE_8_G`
159+ - :attr:`Range.RANGE_16_G`
160+
149161 """
150162
151163 RANGE_2_G = 0b00 # +/- 2g (default value)
@@ -155,14 +167,17 @@ class Range: # pylint: disable=too-few-public-methods
155167
156168
157169class Resolution : # pylint: disable=too-few-public-methods
158- """An enum-like class representing the different measurement ranges that the MSA301 can
159- use. The values can be referenced like ``Range.RANGE_2_G`` or ``Range.RANGE_16_G``
170+ """An enum-like class representing the different
171+ measurement ranges that the MSA301 can
172+ use. The values can be referenced like
173+ :attr:`Range.RANGE_2_G` or :attr:`Range.RANGE_16_G`
160174 Possible values are
161175
162- - ``Resolution.RESOLUTION_14_BIT``
163- - ``Resolution.RESOLUTION_12_BIT``
164- - ``Resolution.RESOLUTION_10_BIT``
165- - ``Resolution.RESOLUTION_8_BIT``
176+ - :attr:`Resolution.RESOLUTION_14_BIT`
177+ - :attr:`Resolution.RESOLUTION_12_BIT`
178+ - :attr:`Resolution.RESOLUTION_10_BIT`
179+ - :attr:`Resolution.RESOLUTION_8_BIT`
180+
166181 """
167182
168183 RESOLUTION_14_BIT = 0b00
@@ -189,6 +204,31 @@ class MSA301: # pylint: disable=too-many-instance-attributes
189204 """Driver for the MSA301 Accelerometer.
190205
191206 :param ~busio.I2C i2c_bus: The I2C bus the MSA is connected to.
207+
208+
209+ **Quickstart: Importing and using the device**
210+
211+ Here is an example of using the :class:`MSA301` class.
212+ First you will need to import the libraries to use the sensor
213+
214+ .. code-block:: python
215+
216+ import board
217+ import adafruit_msa301
218+
219+ Once this is done you can define your `board.I2C` object and define your sensor object
220+
221+ .. code-block:: python
222+
223+ i2c = board.I2C() # uses board.SCL and board.SDA
224+ msa = adafruit_msa301.MSA301(i2c)
225+
226+ Now you have access to the :attr:`acceleration` attribute
227+
228+ .. code-block:: python
229+
230+ acc_x, acc_y, acc_z = msa.acceleration
231+
192232 """
193233
194234 _part_id = ROUnaryStruct (_MSA301_REG_PARTID , "<B" )
@@ -235,7 +275,8 @@ def __init__(self, i2c_bus):
235275
236276 @property
237277 def acceleration (self ):
238- """The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2."""
278+ """The x, y, z acceleration values returned in a
279+ 3-tuple and are in :math:`m / s ^ 2`"""
239280 # read the 6 bytes of acceleration data
240281
241282 current_range = self .range
@@ -278,13 +319,13 @@ def enable_tap_detection(
278319 `True` (default) sets the value to 70ms, False to 50ms. Default is `True`
279320
280321 :param int long_quiet_window: The length of the "quiet" period after an acceleration\
281- spike where no more spikes can occour for a tap to be registered.\
322+ spike where no more spikes can occur for a tap to be registered.\
282323 `True` (default) sets the value to 30ms, False to 20ms. Default is `True`.
283324
284325 :param int double_tap_window: The length of time after an initial tap is registered\
285326 in which a second tap must be detected to count as a double tap. Setting a lower\
286327 value will require a faster double tap. The value must be a\
287- ``TapDuration``. Default is `` TapDuration.DURATION_250_MS` `.
328+ ``TapDuration``. Default is :attr:` TapDuration.DURATION_250_MS`.
288329
289330 If you wish to set them yourself rather than using the defaults,
290331 you must use keyword arguments::
0 commit comments