summaryrefslogtreecommitdiff
path: root/src/driver/max44006.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver/max44006.cc')
-rw-r--r--src/driver/max44006.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/driver/max44006.cc b/src/driver/max44006.cc
index 50eaf0f..b0df238 100644
--- a/src/driver/max44006.cc
+++ b/src/driver/max44006.cc
@@ -59,6 +59,7 @@ uint16_t MAX44006::getTemperature()
return 0;
}
+ // independent of AMBPGA setting, depends on AMBTIM
return (((uint16_t)rxbuf[0] << 8) + rxbuf[1]);
}
@@ -80,6 +81,19 @@ bool MAX44006::getLight(float *red, float *green, float *blue, float *clear, flo
multiplier = 0.512;
}
+ if ((ambientConfig & AMBTIM_MASK) == AMBTIM_001) {
+ multiplier *= 4;
+ }
+ else if ((ambientConfig & AMBTIM_MASK) == AMBTIM_010) {
+ multiplier *= 16;
+ }
+ else if ((ambientConfig & AMBTIM_MASK) == AMBTIM_011) {
+ multiplier *= 64;
+ }
+ else if ((ambientConfig & AMBTIM_MASK) == AMBTIM_100) {
+ multiplier *= 0.25;
+ }
+
*clear = (float)(((uint16_t)rxbuf[0] << 8) + rxbuf[1]) * multiplier;
*red = (float)(((uint16_t)rxbuf[2] << 8) + rxbuf[3]) * multiplier;
*green = (float)(((uint16_t)rxbuf[4] << 8) + rxbuf[5]) * multiplier;