summaryrefslogtreecommitdiff
path: root/src/app/datalogger
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-12-26 16:05:02 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-12-26 16:05:02 +0100
commit0b0bcc80bf689592dcb3236eed3e166d82cd7802 (patch)
tree7e811ee941000219048f3649087e9fa9fb98f08b /src/app/datalogger
parentbb9ea6b5445d256e294e6644623e63fd8ba0594e (diff)
add basic MAX44006 driver
Diffstat (limited to 'src/app/datalogger')
-rw-r--r--src/app/datalogger/main.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/app/datalogger/main.cc b/src/app/datalogger/main.cc
index c6252b2..6cdba9e 100644
--- a/src/app/datalogger/main.cc
+++ b/src/app/datalogger/main.cc
@@ -36,6 +36,9 @@
#ifdef CONFIG_driver_ds2482
#include "driver/ds2482.h"
#endif
+#ifdef CONFIG_driver_max44006
+#include "driver/max44006.h"
+#endif
#ifdef CONFIG_driver_max44009
#include "driver/max44009.h"
#endif
@@ -149,8 +152,31 @@ void loop(void)
#endif
#ifdef CONFIG_driver_max44009
+ kout << "MAX44006 Temperature: " << max44006.getTemperature() << " counts" << endl;
+ float r, g, b, c, ir;
+ if (max44006.getLight(&r, &g, &b, &c, &ir)) {
+ kout << "MAX44006 Red: ";
+ kout.printf_float(r);
+ kout << " µW/cm²" << endl;
+ kout << "MAX44006 Green: ";
+ kout.printf_float(g);
+ kout << " µW/cm²" << endl;
+ kout << "MAX44006 Blue: ";
+ kout.printf_float(b);
+ kout << " µW/cm²" << endl;
+ kout << "MAX44006 Clear: ";
+ kout.printf_float(c);
+ kout << " µW/cm²" << endl;
+ kout << "MAX44006 IR: ";
+ kout.printf_float(ir);
+ kout << " µW/cm²" << endl;
+ }
+#endif
+
+#ifdef CONFIG_driver_max44009
+ kout << "MAX44009 Brightness: ";
kout.printf_float(max44009.getLux());
- kout << endl;
+ kout << " lx" << endl;
#endif
#ifdef CONFIG_driver_tsl2591
@@ -253,6 +279,13 @@ int main(void)
}
#endif
+#ifdef CONFIG_driver_max44006
+ unsigned char ret;
+ if ((ret = max44006.init()) != 0) {
+ kout << "MAX44006 Initialization failed: " << ret << endl;
+ }
+#endif
+
#ifdef CONFIG_driver_mpu9250
mpu9250.init();
mpu9250.nineAxis();