Class that stores state and functions for interacting with TSL2591 Light Sensor.
More...
#include <Adafruit_TSL2591.h>
Class that stores state and functions for interacting with TSL2591 Light Sensor.
◆ Adafruit_TSL2591()
Adafruit_TSL2591::Adafruit_TSL2591 |
( |
int32_t |
sensorID = -1 | ) |
|
Instantiates a new Adafruit TSL2591 class.
- Parameters
-
sensorID | An optional ID # so you can track this sensor, it will tag sensorEvents you create. |
◆ begin() [1/2]
boolean Adafruit_TSL2591::begin |
( |
TwoWire * |
theWire, |
|
|
uint8_t |
addr = TSL2591_ADDR |
|
) |
| |
Setups the I2C interface and hardware, identifies if chip is found.
- Parameters
-
theWire | a reference to TwoWire instance |
addr | The I2C adress of the sensor (Default 0x29) |
- Returns
- True if a TSL2591 is found, false on any failure
◆ begin() [2/2]
boolean Adafruit_TSL2591::begin |
( |
uint8_t |
addr = TSL2591_ADDR | ) |
|
Setups the I2C interface and hardware, identifies if chip is found.
- Parameters
-
addr | The I2C adress of the sensor (Default 0x29) |
- Returns
- True if a TSL2591 is found, false on any failure
◆ calculateLux()
float Adafruit_TSL2591::calculateLux |
( |
uint16_t |
ch0, |
|
|
uint16_t |
ch1 |
|
) |
| |
Calculates the visible Lux based on the two light sensors.
- Parameters
-
ch0 | Data from channel 0 (IR+Visible) |
ch1 | Data from channel 1 (IR) |
- Returns
- Lux, based on AMS coefficients (or < 0 if overflow)
◆ setGain()
Setter for sensor light gain.
- Parameters
-
◆ setTiming()
Setter for sensor integration time setting.
- Parameters
-
◆ getLuminosity()
uint16_t Adafruit_TSL2591::getLuminosity |
( |
uint8_t |
channel | ) |
|
Reads the raw data from the channel.
- Parameters
-
channel | Can be 0 (IR+Visible, 1 (IR) or 2 (Visible only) |
- Returns
- 16-bit raw count, or 0 if channel is invalid
◆ getFullLuminosity()
uint32_t Adafruit_TSL2591::getFullLuminosity |
( |
void |
| ) |
|
Reads the raw data from both light channels.
- Returns
- 32-bit raw count where high word is IR, low word is IR+Visible
◆ getTiming()
◆ getGain()
◆ registerInterrupt()
void Adafruit_TSL2591::registerInterrupt |
( |
uint16_t |
lowerThreshold, |
|
|
uint16_t |
upperThreshold, |
|
|
tsl2591Persist_t |
persist = TSL2591_PERSIST_ANY |
|
) |
| |
Set up the interrupt to go off when light level is outside the lower/upper range.
- Parameters
-
lowerThreshold | Raw light data reading level that is the lower value threshold for interrupt |
upperThreshold | Raw light data reading level that is the higher value threshold for interrupt |
persist | How many counts we must be outside range for interrupt to fire, default is any single value |
◆ getStatus()
uint8_t Adafruit_TSL2591::getStatus |
( |
void |
| ) |
|
Gets the most recent sensor event from the hardware status register.
- Returns
- Sensor status as a byte. Bit 0 is ALS Valid. Bit 4 is ALS Interrupt. Bit 5 is No-persist Interrupt.
◆ getEvent()
bool Adafruit_TSL2591::getEvent |
( |
sensors_event_t * |
event | ) |
|
Gets the most recent sensor event.
- Parameters
-
event | Pointer to Adafruit_Sensor sensors_event_t object that will be filled with sensor data |
- Returns
- True on success, False on failure
◆ getSensor()
void Adafruit_TSL2591::getSensor |
( |
sensor_t * |
sensor | ) |
|
Gets the overall sensor_t data including the type, range and resulution.
- Parameters
-
sensor | Pointer to Adafruit_Sensor sensor_t object that will be filled with sensor type data |
The documentation for this class was generated from the following files: