27 #include <mraa/i2c.hpp>
29 #include "upm/iLightSensor.hpp"
32 #define MAX44009_ADDRESS ( 0x4A )
33 #define MAX44009_NOT_FOUND ( 0x00 )
36 #define MAX44009_I2C_BUS ( 1 )
39 #define MAX44009_INT_STATUS_ADDR ( 0x00 ) // R
40 #define MAX44009_INT_ENABLE_ADDR ( 0x01 ) // R/W
41 #define MAX44009_CONFIG_ADDR ( 0x02 ) // R/W
42 #define MAX44009_LUX_START_ADDR ( 0x03 )
43 #define MAX44009_LUX_LENGTH ( 2 )
44 #define MAX44009_LUX_HIGH ( 0 )
45 #define MAX44009_LUX_LOW ( 1 )
46 #define MAX44009_THR_HIGH_ADDR ( 0x05 ) // R/W
47 #define MAX44009_THR_LOW_ADDR ( 0x06 ) // R/W
48 #define MAX44009_THR_TIMER_ADDR ( 0x07 ) // R/W
51 #define MAX44009_INT_STATUS_OFF ( 0x00 )
52 #define MAX44009_INT_STATUS_ON ( 0x01 )
53 #define MAX44009_INT_DISABLED ( 0x00 )
54 #define MAX44009_INT_ENABLED ( 0x01 )
57 #define MAX44009_CONFIG_DEFAULT ( 0 << 7 )
58 #define MAX44009_CONFIG_CONTINUOUS ( 1 << 7 )
59 #define MAX44009_CONFIG_AUTO ( 0 << 6 )
60 #define MAX44009_CONFIG_MANUAL ( 1 << 6 )
61 #define MAX44009_CONFIG_CDR_NORMAL ( 0 << 3 )
62 #define MAX44009_CONFIG_CDR_DIVIDED ( 1 << 3 )
63 #define MAX44009_CONFIG_INTEGRATION_800ms ( 0 << 0 )
64 #define MAX44009_CONFIG_INTEGRATION_400ms ( 1 << 0 )
65 #define MAX44009_CONFIG_INTEGRATION_200ms ( 2 << 0 )
66 #define MAX44009_CONFIG_INTEGRATION_100ms ( 3 << 0 )
67 #define MAX44009_CONFIG_INTEGRATION_50ms ( 4 << 0 )
68 #define MAX44009_CONFIG_INTEGRATION_25ms ( 5 << 0 )
69 #define MAX44009_CONFIG_INTEGRATION_12ms ( 6 << 0 )
70 #define MAX44009_CONFIG_INTEGRATION_6ms ( 7 << 0 )
73 #define MAX44009_DEFAULT_CONFIGURATION ( MAX44009_CONFIG_DEFAULT | \
74 MAX44009_CONFIG_AUTO | \
75 MAX44009_CONFIG_CDR_NORMAL | \
76 MAX44009_CONFIG_INTEGRATION_100ms )
79 #define MAX44009_OVERRANGE_CONDITION ( 0x0F )
116 MAX44009 (
int bus = MAX44009_I2C_BUS,
int devAddr = MAX44009_ADDRESS);
136 mraa::Result reset();
138 int m_maxControlAddr;
uint16_t getVisibleRaw()
Definition: max44009.cxx:66
~MAX44009()
Definition: max44009.cxx:47
const char * getModuleName()
Definition: max44009.hpp:133
C++ API for MAX44009 chip (Ambient Light Sensor)
Definition: max44009.hpp:108
ILightSensor Interface for Light Sensors.
Definition: iLightSensor.hpp:46
MAX44009(int bus=MAX44009_I2C_BUS, int devAddr=MAX44009_ADDRESS)
Definition: max44009.cxx:34
double getVisibleLux()
Definition: max44009.cxx:81