Go to the documentation of this file.
8 #define TSL2591_COMMAND_BIT 0xA0
10 #define TSL2591_VISIBLE 2
11 #define TSL2591_INFRARED 1
12 #define TSL2591_FULLSPECTRUM 0
14 #define TSL2591_ENABLE_POWEROFF 0x00
15 #define TSL2591_ENABLE_POWERON 0x01
16 #define TSL2591_ENABLE_AEN 0x02
17 #define TSL2591_ENABLE_AIEN 0x10
18 #define TSL2591_ENABLE_NPIEN 0x80
20 #define TSL2591_LUX_DF 408.0F
69 TSL2591(uint8_t i2cAddress, uint8_t sdaPin, uint8_t sclPin);
85 unsigned char readByte(
unsigned char address);
86 boolean writeByte(
unsigned char address,
unsigned char value);
87 uint8_t
readUInt(
unsigned char address);
tsl2591Gain_t
Enumeration for the sensor gain.
Definition: tsl2591.h:58
@ TSL2591_REGISTER_THRESHOLD_AILTH
Definition: tsl2591.h:28
@ TSL2591_REGISTER_THRESHOLD_NPAILTL
Definition: tsl2591.h:31
tsl2591IntegrationTime_t
Enumeration for the sensor integration timing.
Definition: tsl2591.h:46
@ TSL2591_INTEGRATIONTIME_100MS
Definition: tsl2591.h:48
void setTiming(tsl2591IntegrationTime_t integration)
Set light sensor integration time.
Definition: tsl2591.cpp:126
void enable(void)
Enables device.
Definition: tsl2591.cpp:60
tsl2591IntegrationTime_t getTiming()
Get light sensor integration time.
Definition: tsl2591.cpp:147
@ TSL2591_REGISTER_CONTROL
Definition: tsl2591.h:26
@ TSL2591_REGISTER_THRESHOLD_NPAILTH
Definition: tsl2591.h:32
@ TSL2591_REGISTER_PACKAGE_PID
Definition: tsl2591.h:36
tsl2591Gain_t getGain()
Get light sensor gain.
Definition: tsl2591.cpp:116
float calculateLux(uint16_t ch0, uint16_t ch1)
Calculates lux value from both channels (Visible and IR) readings.
Definition: tsl2591.cpp:159
uint32_t getFullLuminosity(void)
Reads luminosity from both channels (Visible and IR)
Definition: tsl2591.cpp:232
@ TSL2591_REGISTER_ENABLE
Definition: tsl2591.h:25
@ TSL2591_INTEGRATIONTIME_400MS
Definition: tsl2591.h:51
@ TSL2591_INTEGRATIONTIME_500MS
Definition: tsl2591.h:52
@ TSL2591_INTEGRATIONTIME_200MS
Definition: tsl2591.h:49
void setGain(tsl2591Gain_t gain)
Set light sensor gain.
Definition: tsl2591.cpp:95
@ TSL2591_GAIN_LOW
Definition: tsl2591.h:60
@ TSL2591_GAIN_HIGH
medium gain (25x)
Definition: tsl2591.h:62
@ TSL2591_INTEGRATIONTIME_300MS
Definition: tsl2591.h:50
@ TSL2591_REGISTER_THRESHOLD_NPAIHTH
Definition: tsl2591.h:34
void disable(void)
Disables the device.
Definition: tsl2591.cpp:78
TSL2591(uint8_t i2cAddress, uint8_t sdaPin, uint8_t sclPin)
Construct a new TSL2591::TSL2591 object.
Definition: tsl2591.cpp:11
@ TSL2591_REGISTER_PERSIST_FILTER
Definition: tsl2591.h:35
@ TSL2591_REGISTER_CHAN0_HIGH
Definition: tsl2591.h:40
@ TSL2591_REGISTER_THRESHOLD_AIHTH
Definition: tsl2591.h:30
@ TSL2591_GAIN_MAX
medium gain (428x)
Definition: tsl2591.h:63
@ TSL2591_REGISTER_DEVICE_ID
Definition: tsl2591.h:37
@ TSL2591_REGISTER_DEVICE_STATUS
Definition: tsl2591.h:38
@ TSL2591_GAIN_MED
low gain (1x)
Definition: tsl2591.h:61
boolean writeByte(unsigned char address, unsigned char value)
Write byte to I2C.
Definition: tsl2591.cpp:341
boolean begin(void)
Starts I2C communication with sensor.
Definition: tsl2591.cpp:30
@ TSL2591_REGISTER_CHAN0_LOW
Definition: tsl2591.h:39
uint8_t readUInt(unsigned char address)
Read two bytes as integer from I2C.
Definition: tsl2591.cpp:360
@ TSL2591_REGISTER_THRESHOLD_AILTL
Definition: tsl2591.h:27
@ TSL2591_REGISTER_CHAN1_HIGH
Definition: tsl2591.h:42
uint16_t getLuminosity(uint8_t channel)
Reads luminosity from selected channel (Visible and/or IR)
Definition: tsl2591.cpp:266
@ TSL2591_REGISTER_THRESHOLD_NPAIHTL
Definition: tsl2591.h:33
uint8_t getStatus(void)
Reads the device status byte.
Definition: tsl2591.cpp:291
@ TSL2591_REGISTER_THRESHOLD_AIHTL
Definition: tsl2591.h:29
unsigned char readByte(unsigned char address)
Read byte as char from I2C.
Definition: tsl2591.cpp:315
@ TSL2591_INTEGRATIONTIME_600MS
Definition: tsl2591.h:53
@ TSL2591_REGISTER_CHAN1_LOW
Definition: tsl2591.h:41