From 215ecfdf59e326beed7e2f06415a759a48a62830 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Tue, 23 Jul 2019 01:34:14 +0200
Subject: [PATCH] docs: Document light_sensor module

Signed-off-by: Rahix <rahix@rahix.de>
---
 Documentation/index.rst                  |  1 +
 Documentation/pycardium/light-sensor.rst | 25 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/pycardium/light-sensor.rst

diff --git a/Documentation/index.rst b/Documentation/index.rst
index f850b08e..57c5b3d7 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -24,6 +24,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the
    pycardium/color
    pycardium/display
    pycardium/leds
+   pycardium/light-sensor
    pycardium/vibra
 
 .. toctree::
diff --git a/Documentation/pycardium/light-sensor.rst b/Documentation/pycardium/light-sensor.rst
new file mode 100644
index 00000000..f07df5ca
--- /dev/null
+++ b/Documentation/pycardium/light-sensor.rst
@@ -0,0 +1,25 @@
+``light_sensor`` - Ambient Brightness
+=====================================
+On the harmonic board, there is an IR-LED which can be used in reverse as a
+crude brightness sensor.  Values returned are in no particular unit but seem to
+be fairly stable.
+
+.. py:function:: light_sensor.start()
+
+   Turn on the ADC and start reading brightness values.  This function must be
+   called before any measurements can be taken.
+
+.. py:function:: light_sensor.get_reading()
+
+   Get an ambient brightness reading.  The returned value is in no particular
+   unit, though it seems to be fairly stable.  Common values:
+
+   - ~8: Very dark are
+   - ~17: Typical hackerspace brightness
+   - >200: Direct sunlight
+
+   :returns: A brightness reading in no particular unit
+
+.. py:function:: light_sensor.stop()
+
+   Stop the ADC.
-- 
GitLab