ESP32-CAM
|
#include <tsl2591.h>
Public Member Functions | |
TSL2591 (uint8_t i2cAddress, uint8_t sdaPin, uint8_t sclPin) | |
Construct a new TSL2591::TSL2591 object. More... | |
boolean | begin (void) |
Starts I2C communication with sensor. More... | |
void | enable (void) |
Enables device. More... | |
void | disable (void) |
Disables the device. More... | |
uint16_t | getLuminosity (uint8_t channel) |
Reads luminosity from selected channel (Visible and/or IR) More... | |
uint32_t | getFullLuminosity (void) |
Reads luminosity from both channels (Visible and IR) More... | |
float | calculateLux (uint16_t ch0, uint16_t ch1) |
Calculates lux value from both channels (Visible and IR) readings. More... | |
void | setGain (tsl2591Gain_t gain) |
Set light sensor gain. More... | |
void | setTiming (tsl2591IntegrationTime_t integration) |
Set light sensor integration time. More... | |
tsl2591IntegrationTime_t | getTiming () |
Get light sensor integration time. More... | |
tsl2591Gain_t | getGain () |
Get light sensor gain. More... | |
uint8_t | getStatus (void) |
Reads the device status byte. More... | |
unsigned char | readByte (unsigned char address) |
Read byte as char from I2C. More... | |
boolean | writeByte (unsigned char address, unsigned char value) |
Write byte to I2C. More... | |
uint8_t | readUInt (unsigned char address) |
Read two bytes as integer from I2C. More... | |
TSL2591 (uint8_t i2cAddress, uint8_t sdaPin, uint8_t sclPin) | |
boolean | begin (void) |
void | enable (void) |
void | disable (void) |
uint16_t | getLuminosity (uint8_t channel) |
uint32_t | getFullLuminosity (void) |
float | calculateLux (uint16_t ch0, uint16_t ch1) |
void | setGain (tsl2591Gain_t gain) |
void | setTiming (tsl2591IntegrationTime_t integration) |
tsl2591IntegrationTime_t | getTiming () |
tsl2591Gain_t | getGain () |
uint8_t | getStatus (void) |
unsigned char | readByte (unsigned char address) |
boolean | writeByte (unsigned char address, unsigned char value) |
uint8_t | readUInt (unsigned char address) |
TSL2591::TSL2591 | ( | uint8_t | i2cAddress, |
uint8_t | sdaPin, | ||
uint8_t | sclPin | ||
) |
Construct a new TSL2591::TSL2591 object.
i2cAddress | |
sdaPin | |
sclPin |
TSL2591::TSL2591 | ( | uint8_t | i2cAddress, |
uint8_t | sdaPin, | ||
uint8_t | sclPin | ||
) |
boolean TSL2591::begin | ( | void | ) |
Starts I2C communication with sensor.
Checks device ID Sets default integration time and gain
boolean TSL2591::begin | ( | void | ) |
float TSL2591::calculateLux | ( | uint16_t | ch0, |
uint16_t | ch1 | ||
) |
float TSL2591::calculateLux | ( | uint16_t | ch0, |
uint16_t | ch1 | ||
) |
Calculates lux value from both channels (Visible and IR) readings.
ch0 | |
ch1 |
void TSL2591::disable | ( | void | ) |
void TSL2591::disable | ( | void | ) |
Disables the device.
PowerOff
void TSL2591::enable | ( | void | ) |
Enables device.
PowerOn + ADC + Interrupts
void TSL2591::enable | ( | void | ) |
uint32_t TSL2591::getFullLuminosity | ( | void | ) |
uint32_t TSL2591::getFullLuminosity | ( | void | ) |
Reads luminosity from both channels (Visible and IR)
tsl2591Gain_t TSL2591::getGain | ( | ) |
Get light sensor gain.
Necessary beacause class member _gain is private
tsl2591Gain_t TSL2591::getGain | ( | ) |
uint16_t TSL2591::getLuminosity | ( | uint8_t | channel | ) |
Reads luminosity from selected channel (Visible and/or IR)
channel |
uint16_t TSL2591::getLuminosity | ( | uint8_t | channel | ) |
uint8_t TSL2591::getStatus | ( | void | ) |
Reads the device status byte.
uint8_t TSL2591::getStatus | ( | void | ) |
tsl2591IntegrationTime_t TSL2591::getTiming | ( | ) |
tsl2591IntegrationTime_t TSL2591::getTiming | ( | ) |
Get light sensor integration time.
Necessary beacause class member _integration is private
unsigned char TSL2591::readByte | ( | unsigned char | address | ) |
unsigned char TSL2591::readByte | ( | unsigned char | address | ) |
Read byte as char from I2C.
address |
uint8_t TSL2591::readUInt | ( | unsigned char | address | ) |
Read two bytes as integer from I2C.
address |
uint8_t TSL2591::readUInt | ( | unsigned char | address | ) |
void TSL2591::setGain | ( | tsl2591Gain_t | gain | ) |
void TSL2591::setGain | ( | tsl2591Gain_t | gain | ) |
Set light sensor gain.
gain |
void TSL2591::setTiming | ( | tsl2591IntegrationTime_t | integration | ) |
Set light sensor integration time.
integration |
void TSL2591::setTiming | ( | tsl2591IntegrationTime_t | integration | ) |
boolean TSL2591::writeByte | ( | unsigned char | address, |
unsigned char | value | ||
) |
boolean TSL2591::writeByte | ( | unsigned char | address, |
unsigned char | value | ||
) |
Write byte to I2C.
address | |
value |