summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-12-26 12:08:13 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-12-26 12:08:13 +0100
commitbb9ea6b5445d256e294e6644623e63fd8ba0594e (patch)
tree370cd47a9a2e59cb5ab96957c514f7673f1c660b
parent7654a57f097567a65211f7b3fffdb0c00d721205 (diff)
max44009: documentation
-rw-r--r--include/driver/max44009.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/include/driver/max44009.h b/include/driver/max44009.h
index da64712..2d9e30c 100644
--- a/include/driver/max44009.h
+++ b/include/driver/max44009.h
@@ -2,13 +2,14 @@
* Copyright 2020 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
- *
- * Driver for MAX44009 Ambient Light Sensor.
- * Does not support interrupts.
*/
#ifndef MAX44009_H
#define MAX44009_H
+/**
+ * Driver for MAX44009 Ambient Light Sensor.
+ * Does not support interrupts.
+ */
class MAX44009 {
private:
MAX44009(const MAX44009 &copy);
@@ -17,8 +18,21 @@ class MAX44009 {
unsigned char rxbuf[2];
public:
- MAX44009(unsigned char const addr) : address(addr) {}
+ /**
+ * Create a new MAX44009 object for the specified I2C address.
+ * This is a no-op; the sensor is not initialized. In its default
+ * configuration, it takes a light reading every 800ms and uses
+ * auto-ranging to select a suitable measurement range.
+ *
+ * @param addr I2C address of light sensor, default 0x4a
+ */
+ MAX44009(unsigned char const addr = 0x4a) : address(addr) {}
+ /**
+ * Retrieve latest ambient light reading from the sensor.
+ * @return ambient light [lx]; -1 if a communication error or overrange
+ * condition occured.
+ */
float getLux();
};