diff --git a/Documentation/index.rst b/Documentation/index.rst index 77f03db287cfdc576d6af03ad153cdf03e8cae8c..561fb9bddf931dc6492f05bbbc94654fc4c8c8d0 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -22,6 +22,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the pycardium/overview pycardium/stdlib + pycardium/bhi160 pycardium/bme680 pycardium/buttons pycardium/color @@ -32,10 +33,10 @@ Last but not least, if you want to start hacking the lower-level firmware, the pycardium/os pycardium/personal_state pycardium/power + pycardium/pride pycardium/simple_menu pycardium/utime pycardium/vibra - pycardium/pride .. toctree:: :maxdepth: 1 diff --git a/Documentation/pycardium/bhi160.rst b/Documentation/pycardium/bhi160.rst new file mode 100644 index 0000000000000000000000000000000000000000..6905f779c29d0d92b5a73a0c0020bdeace2c1df1 --- /dev/null +++ b/Documentation/pycardium/bhi160.rst @@ -0,0 +1,102 @@ +.. py:module:: bhi160 + +``bhi160`` - Sensor Fusion +========================== +.. versionadded:: 1.4 + +Supports the BHI160 sensor on the card10 for accelerometer, gyroscope... + +**Example**: + +.. code-block:: python + + import bhi160 + import utime + + bhi = bhi160.BHI160Orientation() + + while True: + samples = bhi.read() + print(samples) + utime.sleep(0.5) + + +.. class:: bhi160.BHI160Orientation(sample_rate,dynamic_range,callback,sample_buffer_len) + + Orientation of the BHI160 + + Parameters: + sample_rate: int, optional + Sample rate (default is 4) + dynamic_range: int, optional + Dynamic range (default is 2) + callback: callable, optional + Call this callback when enough data is collected (default is None) + + .. todo:: The callback functionality is untested, so do not be confused if it does not work. + sample_buffer_len: int, optional + Length of sample buffer (default is 200) + + .. py:method:: read(): + + Read sensor values + + :returns: Collected sensor values as list + + .. py:method:: close(): + + Close the connection to the sensor + + +.. class:: bhi160.BHI160Accelerometer + + Accelerometer of the BHI160 + + Parameters: + sample_rate: int, optional + Sample rate (default is 4) + dynamic_range: int, optional + Dynamic range (default is 2) + callback: callable, optional + Call this callback when enough data is collected (default is None) + + .. todo:: The callback functionality is untested, so do not be confused if it does not work. + sample_buffer_len: int, optional + Length of sample buffer (default is 200) + + .. py:method:: read(): + + Read sensor values + + :returns: Collected sensor values as list + + .. py:method:: close(): + + Close the connection to the sensor + +.. class:: bhi160.BHI160Gyroscope + + Gyroscope of the BHI160 + + Parameters: + sample_rate: int, optional + Sample rate (default is 4) + dynamic_range: int, optional + Dynamic range (default is 2) + callback: callable, optional + Call this callback when enough data is collected (default is None) + + .. todo:: The callback functionality is untested, so do not be confused if it does not work. + sample_buffer_len: int, optional + Length of sample buffer (default is 200) + + .. py:method:: read(): + + Read sensor values + + :returns: Collected sensor values as list + + .. py:method:: close(): + + Close the connection to the sensor +