Skip to content

Commit 38506f1

Browse files
committed
Added disable_data_ready_interrupt and improved docs
Added matching interrupt disable function for data_ready and added sphinx references for documentation.
1 parent c010d78 commit 38506f1

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

adafruit_adxl37x.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,14 @@ def events(self) -> Dict[str, bool]:
189189
| Key | Description |
190190
+============+============================================================================+
191191
| ``tap`` | True if a tap was detected recently. Whether it's looking for a single |
192-
| | or double tap is determined by the tap param of `enable_tap_detection` |
192+
| | or double tap is determined by the tap param of |
193+
| | :meth:`adafruit_adxl34x.enable_tap_detection` |
193194
+------------+----------------------------------------------------------------------------+
194195
| ``motion`` | True if the sensor has seen acceleration above the threshold |
195-
| | set with `enable_motion_detection`. |
196+
| | set with :meth:`adafruit_adxl34x.enable_motion_detection` |
196197
+------------+----------------------------------------------------------------------------+
197198
| ``data_ready`` | True if the sensor has data to be read. Can be used for more precise |
198-
| | timing if reading many samples |
199+
| | timing if reading many samples. Set with `enable_data_ready_interrupt` |
199200
+------------+----------------------------------------------------------------------------+
200201
201202
@@ -238,3 +239,10 @@ def enable_data_ready_interrupt(self):
238239
active_interrupts |= _INT_DATA_READY
239240
self._write_register_byte(_REG_INT_ENABLE, active_interrupts)
240241
self._enabled_interrupts["data_ready"] = True
242+
243+
def disable_data_ready_interrupt(self) -> None:
244+
"""Disable Data Ready interrupt"""
245+
active_interrupts = self._read_register_unpacked(_REG_INT_ENABLE)
246+
active_interrupts &= ~_INT_DATA_READY
247+
self._write_register_byte(_REG_INT_ENABLE, active_interrupts)
248+
self._enabled_interrupts.pop("data_ready")

docs/conf.py

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"python": ("https://docs.python.org/3", None),
3535
"BusDevice": ("https://docs.circuitpython.org/projects/busdevice/en/latest/", None),
3636
"CircuitPython": ("https://docs.circuitpython.org/en/latest/", None),
37+
"adafruit_adxl34x": (
38+
"https://docs.circuitpython.org/projects/adxl34x/en/latest/",
39+
None,
40+
),
3741
}
3842

3943
# Show the docstring from both the class and its __init__() method.

docs/examples.rst

+9
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ Ensure your device works with this simple test.
66
.. literalinclude:: ../examples/adxl37x_simpletest.py
77
:caption: examples/adxl37x_simpletest.py
88
:linenos:
9+
10+
Data Ready Interrupt
11+
---------------------
12+
13+
Use the Data Ready interrupt for precise data timing.
14+
15+
.. literalinclude:: ../examples/adxl37x_data_ready.py
16+
:caption: examples/adxl37x_data_ready.py
17+
:linenos:

docs/index.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ Table of Contents
2525
:caption: Tutorials
2626

2727
Adafruit ADXL375 <https://learn.adafruit.com/adafruit-adxl375>
28+
Adafruit ADXL345 - Triple-Axis Accelerometer (+-2g/4g/8g/16g) w/ I2C/SPI Learning Guide <https://learn.adafruit.com/adxl345-digital-accelerometer>
2829

2930
.. toctree::
3031
:caption: Related Products
3132

32-
ADXL375 - High G Accelerometer with I2C - STEMMA QT <https://www.adafruit.com/product/5374>
33+
ADXL345 - Triple-Axis Accelerometer (+-2g/4g/8g/16g) w/ I2C/SPI <https://www.adafruit.com/product/1231>
34+
ADXL375 - High G Accelerometer with I2C - STEMMA QT <https://www.adafruit.com/product/5374>
35+
3336

3437
.. toctree::
3538
:caption: Other Links

0 commit comments

Comments
 (0)