diff --git a/Documentation/conf.py b/Documentation/conf.py index b80d8dadd0485fdaee5a14577412eb6972d6b213..2186b6da923529f7401dc55f2f0d56ac2f871422 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -114,8 +114,10 @@ autodoc_mock_imports = [ "sys_display", "sys_leds", "sys_max30001", + "sys_max86150", "sys_config", "ucollections", + "uerrno", "urandom", "utime", ] diff --git a/Documentation/index.rst b/Documentation/index.rst index f6ce6fcd564b08a7f01229a1a235334bb8d1c7c2..f83d9ee79b55cae3248cb1529be9cc1f02cda897 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -25,6 +25,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the pycardium/bhi160 pycardium/bme680 pycardium/max30001 + pycardium/max86150 pycardium/buttons pycardium/color pycardium/config diff --git a/Documentation/pycardium/max86150.rst b/Documentation/pycardium/max86150.rst new file mode 100644 index 0000000000000000000000000000000000000000..3e8a869038acac10fd4f6c73212265b4900ecb22 --- /dev/null +++ b/Documentation/pycardium/max86150.rst @@ -0,0 +1,5 @@ +``max86150`` - MAX86150 +======================= + +.. automodule:: max86150 + :members: diff --git a/pycardium/modules/py/max86150.py b/pycardium/modules/py/max86150.py index 7a799c1ca6096752cba2d3f5e33218ffc1dfd9c3..c52665c90b53564f28c6645ee923fd84b621c54c 100644 --- a/pycardium/modules/py/max86150.py +++ b/pycardium/modules/py/max86150.py @@ -8,13 +8,19 @@ Max86150Data = ucollections.namedtuple("Max86150Data", ["red", "infrared", "ecg" class MAX86150: """ - The MAX86150 class provides a stram interface to the MAX86150 PPG and ECG. + The MAX86150 class provides a stream interface to the MAX86150 PPG and ECG. + + **Example**: .. code-block:: python - import MAX86150 + import max86150 m = max86150.MAX86150() - m.read() + + data = m.read() + for sample in data: + print("Red: {} Infrared: {} ECG: {}", sample.red, sample.infrared, sample.ecg) + m.close() """ @@ -22,8 +28,8 @@ class MAX86150: """ Initializes the MAX86150 (if it is not already running). - :param callback: If not None: A callback which is called with the data when ever new data is available - + :param callback: If not None: A callback which is called with the data + when ever new data is available """ self.active = False self.stream_id = -uerrno.ENODEV @@ -35,7 +41,9 @@ class MAX86150: def enable_sensor(self): """ - Enables the sensor. Automatically called by __init__. + Enables the sensor. + + Automatically called when instanciating the sensor object. """ interrupt.disable_callback(self.interrupt_id) interrupt.set_callback(self.interrupt_id, self._interrupt) @@ -68,7 +76,7 @@ class MAX86150: def read(self): """ - Read as many samples (signed integer) as currently available. + Read as many samples as currently available. """ assert self.active, "Sensor is inactive" result = []