2323
2424**Software and Dependencies:**
2525
26- * Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
26+ * Adafruit CircuitPython firmware for the supported boards:
2727 https://circuitpython.org/downloads
2828* Adafruit's Bus Device library:
2929 https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
@@ -124,7 +124,36 @@ class Range:
124124
125125
126126class LSM303_Accel : # pylint:disable=too-many-instance-attributes
127- """Driver for the LSM303's accelerometer."""
127+ """Driver for the LSM303's accelerometer.
128+
129+ :param ~busio.I2C i2c: The I2C bus the device is connected to.
130+
131+
132+ **Quickstart: Importing and using the device**
133+
134+ Here is an example of using the :class:`LSM303_Accel` class.
135+ First you will need to import the libraries to use the sensor
136+
137+ .. code-block:: python
138+
139+ import board
140+ import adafruit_lsm303_accel
141+
142+ Once this is done you can define your `board.I2C` object and define your sensor object
143+
144+ .. code-block:: python
145+
146+ i2c = board.I2C() # uses board.SCL and board.SDA
147+ sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)
148+
149+ Now you have access to the :attr:`acceleration` attribute
150+
151+ .. code-block:: python
152+
153+ acc_x, acc_y, acc_z = sensor.acceleration
154+
155+
156+ """
128157
129158 # Class-level buffer for reading and writing data with the sensor.
130159 # This reduces memory allocations but means the code is not re-entrant or
@@ -141,22 +170,7 @@ class LSM303_Accel: # pylint:disable=too-many-instance-attributes
141170
142171 _act_threshold = UnaryStruct (_REG_ACCEL_ACT_THS_A , "B" )
143172 _act_duration = UnaryStruct (_REG_ACCEL_ACT_DUR_A , "B" )
144- """
145- .. code-block:: python
146-
147- import board
148- i2c = board.I2C()
149-
150- import adafruit_lsm303_accel
151- accel = adafruit_lsm303_accel.LSM303_Accel(i2c)
152173
153- accel._act_threshold = 20
154- accel._act_duration = 1
155- accel._int2_activity_enable = True
156-
157- # toggle pins, defaults to False
158- accel._int_pin_active_low = True
159- """
160174 _data_rate = RWBits (4 , _REG_ACCEL_CTRL_REG1_A , 4 )
161175 _enable_xyz = RWBits (3 , _REG_ACCEL_CTRL_REG1_A , 0 )
162176 _raw_accel_data = StructArray (_REG_ACCEL_OUT_X_L_A , "<h" , 3 )
@@ -211,10 +225,10 @@ def set_tap(
211225 :param int threshold: A threshold for the tap detection. The higher the value the less\
212226 sensitive the detection. This changes based on the accelerometer range. Good values\
213227 are 5-10 for 16G, 10-20 for 8G, 20-40 for 4G, and 40-80 for 2G.
214- :param int time_limit: TIME_LIMIT register value (default 10).
215- :param int time_latency: TIME_LATENCY register value (default 20).
216- :param int time_window: TIME_WINDOW register value (default 255).
217- :param int click_cfg : CLICK_CFG register value.
228+ :param int time_limit: TIME_LIMIT register value. Defaults to :const:`10`
229+ :param int time_latency: TIME_LATENCY register value. Defaults to :const:`20`
230+ :param int time_window: TIME_WINDOW register value. Defaults to :const:` 255`
231+ :param int tap_cfg : CLICK_CFG register value. Defaults to `None`
218232
219233 """
220234
@@ -250,7 +264,7 @@ def set_tap(
250264 def tapped (self ):
251265 """
252266 True if a tap was detected recently. Whether its a single tap or double tap is
253- determined by the tap param on `` set_tap``. `` tapped` ` may be True over
267+ determined by the tap param on :meth:` set_tap`. :attr:` tapped` may be True over
254268 multiple reads even if only a single tap or single double tap occurred.
255269 """
256270 tap_src = self ._tap_src
0 commit comments