Class that stores state and functions for interacting with LTR390 UV Sensor.
More...
#include <Adafruit_LTR390.h>
Class that stores state and functions for interacting with LTR390 UV Sensor.
◆ begin()
bool Adafruit_LTR390::begin |
( |
TwoWire * |
theWire = &Wire | ) |
|
Setups the hardware for talking to the LTR390.
- Parameters
-
theWire | An optional pointer to an I2C interface |
- Returns
- True if initialization was successful, otherwise false.
◆ reset()
bool Adafruit_LTR390::reset |
( |
void |
| ) |
|
Perform a soft reset with 10ms delay.
- Returns
- True on success (reset bit was cleared post-write)
◆ enable()
void Adafruit_LTR390::enable |
( |
bool |
en | ) |
|
Enable or disable the light sensor.
- Parameters
-
en | True to enable, False to disable |
◆ enabled()
bool Adafruit_LTR390::enabled |
( |
void |
| ) |
|
Read the enabled-bit from the sensor.
- Returns
- True if enabled
◆ setMode()
Set the sensor mode to EITHER ambient (LTR390_MODE_ALS) or UV (LTR390_MODE_UVS)
- Parameters
-
mode | The desired mode - LTR390_MODE_UVS or LTR390_MODE_ALS |
◆ getMode()
get the sensor's mode
- Returns
- The current mode - LTR390_MODE_UVS or LTR390_MODE_ALS
◆ setGain()
Set the sensor gain.
- Parameters
-
gain | The desired gain: LTR390_GAIN_1, LTR390_GAIN_3, LTR390_GAIN_6 LTR390_GAIN_9 or LTR390_GAIN_18 |
◆ getGain()
Get the sensor's gain.
- Returns
- gain The current gain: LTR390_GAIN_1, LTR390_GAIN_3, LTR390_GAIN_6 LTR390_GAIN_9 or LTR390_GAIN_18
◆ setResolution()
Set the sensor resolution. Higher resolutions take longer to read!
- Parameters
-
res | The desired resolution: LTR390_RESOLUTION_13BIT, LTR390_RESOLUTION_16BIT, LTR390_RESOLUTION_17BIT, LTR390_RESOLUTION_18BIT, LTR390_RESOLUTION_19BIT or LTR390_RESOLUTION_20BIT |
◆ getResolution()
Get the sensor's resolution.
- Returns
- The current resolution: LTR390_RESOLUTION_13BIT, LTR390_RESOLUTION_16BIT, LTR390_RESOLUTION_17BIT, LTR390_RESOLUTION_18BIT, LTR390_RESOLUTION_19BIT or LTR390_RESOLUTION_20BIT
◆ setThresholds()
void Adafruit_LTR390::setThresholds |
( |
uint32_t |
lower, |
|
|
uint32_t |
higher |
|
) |
| |
Set the interrupt output threshold range for lower and upper. When the sensor is below the lower, or above upper, interrupt will fire.
- Parameters
-
lower | The lower value to compare against the data register. |
higher | The higher value to compare against the data register. |
◆ configInterrupt()
void Adafruit_LTR390::configInterrupt |
( |
bool |
enable, |
|
|
ltr390_mode_t |
source, |
|
|
uint8_t |
persistance = 0 |
|
) |
| |
Configure the interrupt based on the thresholds in setThresholds() When the sensor is below the lower, or above upper thresh, interrupt will fire.
- Parameters
-
enable | Whether the interrupt output is enabled |
source | Whether to use the ALS or UVS data register to compare |
persistance | The number of consecutive out-of-range readings before we fire the IRQ. Default is 0 (each reading will fire) |
◆ newDataAvailable()
bool Adafruit_LTR390::newDataAvailable |
( |
void |
| ) |
|
Checks if new data is available in data register.
- Returns
- True on new data available
◆ readUVS()
uint32_t Adafruit_LTR390::readUVS |
( |
void |
| ) |
|
Read 3-bytes out of UV data register, does not check if data is new!
- Returns
- Up to 20 bits, right shifted into a 32 bit int
◆ readALS()
uint32_t Adafruit_LTR390::readALS |
( |
void |
| ) |
|
Read 3-bytes out of ambient data register, does not check if data is new!
- Returns
- Up to 20 bits, right shifted into a 32 bit int
The documentation for this class was generated from the following files: