summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/max44009.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/driver/max44009.cc b/src/driver/max44009.cc
index bab4da5..8a8ff3e 100644
--- a/src/driver/max44009.cc
+++ b/src/driver/max44009.cc
@@ -2,6 +2,9 @@
* Copyright 2020 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Driver for MAX44009 Ambient Light Sensor.
+ * Does not support interrupts.
*/
#include "driver/max44009.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(CONFIG_driver_softi2c)
@@ -37,6 +40,11 @@ float MAX44009::getLux()
*/
exponent = (luxHigh & 0xF0) >> 4;
+ if (exponent == 0x0f) {
+ // overrange condition
+ return -1;
+ }
+
/*
* Cast base and mantissa to float to avoid calculation errors
* because of 16bit integer overflows.