Commit dec0073e authored by Rahix's avatar Rahix
Browse files

docs(max86150): Document pycardium API


Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent 76c13383
...@@ -114,8 +114,10 @@ autodoc_mock_imports = [ ...@@ -114,8 +114,10 @@ autodoc_mock_imports = [
"sys_display", "sys_display",
"sys_leds", "sys_leds",
"sys_max30001", "sys_max30001",
"sys_max86150",
"sys_config", "sys_config",
"ucollections", "ucollections",
"uerrno",
"urandom", "urandom",
"utime", "utime",
] ]
......
...@@ -25,6 +25,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the ...@@ -25,6 +25,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the
pycardium/bhi160 pycardium/bhi160
pycardium/bme680 pycardium/bme680
pycardium/max30001 pycardium/max30001
pycardium/max86150
pycardium/buttons pycardium/buttons
pycardium/color pycardium/color
pycardium/config pycardium/config
......
``max86150`` - MAX86150
=======================
.. automodule:: max86150
:members:
...@@ -8,13 +8,19 @@ Max86150Data = ucollections.namedtuple("Max86150Data", ["red", "infrared", "ecg" ...@@ -8,13 +8,19 @@ Max86150Data = ucollections.namedtuple("Max86150Data", ["red", "infrared", "ecg"
class MAX86150: 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 .. code-block:: python
import MAX86150 import max86150
m = max86150.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() m.close()
""" """
...@@ -22,8 +28,8 @@ class MAX86150: ...@@ -22,8 +28,8 @@ class MAX86150:
""" """
Initializes the MAX86150 (if it is not already running). 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.active = False
self.stream_id = -uerrno.ENODEV self.stream_id = -uerrno.ENODEV
...@@ -35,7 +41,9 @@ class MAX86150: ...@@ -35,7 +41,9 @@ class MAX86150:
def enable_sensor(self): 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.disable_callback(self.interrupt_id)
interrupt.set_callback(self.interrupt_id, self._interrupt) interrupt.set_callback(self.interrupt_id, self._interrupt)
...@@ -68,7 +76,7 @@ class MAX86150: ...@@ -68,7 +76,7 @@ class MAX86150:
def read(self): 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" assert self.active, "Sensor is inactive"
result = [] result = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment