diff --git a/adafruit_lis3dh.py b/adafruit_lis3dh.py index 888c89f..179b8ea 100755 --- a/adafruit_lis3dh.py +++ b/adafruit_lis3dh.py @@ -33,6 +33,7 @@ import time import math import digitalio +from ucollections import namedtuple try: import struct except ImportError: @@ -82,6 +83,9 @@ STANDARD_GRAVITY = 9.806 # pylint: enable=bad-whitespace +# the named tuple returned by the class +AccelerationTuple = namedtuple("acceleration", ("x", "y", "z")) + class LIS3DH: """Driver base for the LIS3DH accelerometer.""" @@ -162,7 +166,7 @@ def acceleration(self): y = (y / divider) * STANDARD_GRAVITY z = (z / divider) * STANDARD_GRAVITY - return x, y, z + return AccelerationTuple(x, y, z) def shake(self, shake_threshold=30, avg_count=10, total_delay=0.1): """ diff --git a/docs/conf.py b/docs/conf.py index eb05e71..82431c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -autodoc_mock_imports = ["digitalio", "micropython"] +autodoc_mock_imports = ["digitalio", "micropython", "ucollections"] intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}