From 0b0bcc80bf689592dcb3236eed3e166d82cd7802 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 26 Dec 2021 16:05:02 +0100 Subject: add basic MAX44006 driver --- src/app/datalogger/main.cc | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/app/datalogger') 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(); -- cgit v1.2.3