32 #include <mraa/i2c.hpp>
37 #define TSL2561_Address (0x29) //Device address
40 #define INTEGRATION_TIME0_13MS (0x00) // 13.7ms
41 #define INTEGRATION_TIME1_101MS (0x01) // 101ms
42 #define INTEGRATION_TIME2_402MS (0x02) // 402ms
45 #define GAIN_0X (0x00) // No gain - Low
46 #define GAIN_16X (0x10) // 16x gain - High
49 #define CONTROL_POWERON (0x03) // ON
50 #define CONTROL_POWEROFF (0x00) // OFF
53 #define REGISTER_Control (0x80)
54 #define REGISTER_Timing (0x81)
55 #define REGISTER_Interrupt (0x86)
56 #define REGISTER_Channal0L (0x8C)
57 #define REGISTER_Channal0H (0x8D)
58 #define REGISTER_Channal1L (0x8E)
59 #define REGISTER_Channal1H (0x8F)
62 #define LUX_SCALE (14) // Scale by 2^14
63 #define LUX_RATIOSCALE (9) // Scale ratio by 2^9
64 #define LUX_CHSCALE (10) // Scale channel values by 2^10
65 #define LUX_CHSCALE_TINT0 (0x7517) // 322/11 * 2^TSL2561_LUX_CHSCALE
66 #define LUX_CHSCALE_TINT1 (0x0FE7) // 322/81 * 2^TSL2561_LUX_CHSCALE
69 #define LUX_K1C (0x0043) // 0.130 * 2^RATIO_SCALE
70 #define LUX_B1C (0x0204) // 0.0315 * 2^LUX_SCALE
71 #define LUX_M1C (0x01ad) // 0.0262 * 2^LUX_SCALE
72 #define LUX_K2C (0x0085) // 0.260 * 2^RATIO_SCALE
73 #define LUX_B2C (0x0228) // 0.0337 * 2^LUX_SCALE
74 #define LUX_M2C (0x02c1) // 0.0430 * 2^LUX_SCALE
75 #define LUX_K3C (0x00c8) // 0.390 * 2^RATIO_SCALE
76 #define LUX_B3C (0x0253) // 0.0363 * 2^LUX_SCALE
77 #define LUX_M3C (0x0363) // 0.0529 * 2^LUX_SCALE
78 #define LUX_K4C (0x010a) // 0.520 * 2^RATIO_SCALE
79 #define LUX_B4C (0x0282) // 0.0392 * 2^LUX_SCALE
80 #define LUX_M4C (0x03df) // 0.0605 * 2^LUX_SCALE
81 #define LUX_K5C (0x014d) // 0.65 * 2^RATIO_SCALE
82 #define LUX_B5C (0x0177) // 0.0229 * 2^LUX_SCALE
83 #define LUX_M5C (0x01dd) // 0.0291 * 2^LUX_SCALE
84 #define LUX_K6C (0x019a) // 0.80 * 2^RATIO_SCALE
85 #define LUX_B6C (0x0101) // 0.0157 * 2^LUX_SCALE
86 #define LUX_M6C (0x0127) // 0.0180 * 2^LUX_SCALE
87 #define LUX_K7C (0x029a) // 1.3 * 2^RATIO_SCALE
88 #define LUX_B7C (0x0037) // 0.00338 * 2^LUX_SCALE
89 #define LUX_M7C (0x002b) // 0.00260 * 2^LUX_SCALE
90 #define LUX_K8C (0x029a) // 1.3 * 2^RATIO_SCALE
91 #define LUX_B8C (0x0000) // 0.000 * 2^LUX_SCALE
92 #define LUX_M8C (0x0000) // 0.000 * 2^LUX_SCALE
128 TSL2561(
int bus=0, uint8_t devAddr=TSL2561_Address, uint8_t gain=GAIN_0X, uint8_t integrationTime=INTEGRATION_TIME1_101MS);
150 mraa::Result i2cWriteReg(uint8_t reg, uint8_t value);
159 mraa::Result i2cReadReg(uint8_t reg, uint8_t &data);
164 mraa::I2c m_i2ControlCtx;
167 uint8_t m_integrationTime;
int getLux()
Definition: tsl2561.cxx:89
~TSL2561()
Definition: tsl2561.cxx:82
API for the TSL2561 Digital Light Sensor.
Definition: tsl2561.h:118
TSL2561(int bus=0, uint8_t devAddr=TSL2561_Address, uint8_t gain=GAIN_0X, uint8_t integrationTime=INTEGRATION_TIME1_101MS)
Definition: tsl2561.cxx:38