From 4e68606396be1b575c791a79f39c0405addfce68 Mon Sep 17 00:00:00 2001
From: koalo <koalo@koalo.de>
Date: Fri, 23 Aug 2019 16:31:24 +0000
Subject: [PATCH] doc(bhi160): Add BHI160 documentation

---
 Documentation/index.rst            |   3 +-
 Documentation/pycardium/bhi160.rst | 102 +++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/pycardium/bhi160.rst

diff --git a/Documentation/index.rst b/Documentation/index.rst
index 77f03db28..561fb9bdd 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 000000000..6905f779c
--- /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
+
-- 
GitLab