Adafruit LTR-329 and LTR-303 Light Sensors Library
Public Member Functions | List of all members
Adafruit_LTR303 Class Reference

Class that stores state and functions for interacting with LTR303 Light Sensor. More...

#include <Adafruit_LTR329_LTR303.h>

Inheritance diagram for Adafruit_LTR303:
Adafruit_LTR329

Public Member Functions

 Adafruit_LTR303 ()
 Instantiates a new LTR303 class.
 
void enableInterrupt (bool en)
 Enables the interrupt output pin. More...
 
void setInterruptPolarity (bool pol)
 The INT pin has a polarity setting for active low or high! More...
 
void setLowThreshold (uint16_t value)
 The low threshold for ALS reading interrupts : values BELOW this trigger an interrupt. More...
 
uint16_t getLowThreshold (void)
 The low threshold for ALS reading interrupt getter. More...
 
void setHighThreshold (uint16_t value)
 The high threshold for ALS reading interrupts : values ABOVE this trigger an interrupt. More...
 
uint16_t getHighThreshold (void)
 The high threshold for ALS reading interrupt getter. More...
 
void setIntPersistance (uint8_t counts)
 The default behavior is an interrupt on every value that is under/over the threshold ranges. However, you're more likely to get spurious IRQs, so we can set it to require "N counts in a row" before an IRQ. More...
 
uint8_t getIntPersistance (void)
 Getter for the number of counts required to trigger IRQ. More...
 
- Public Member Functions inherited from Adafruit_LTR329
 Adafruit_LTR329 ()
 Instantiates a new LTR329 class.
 
bool begin (TwoWire *theWire=&Wire)
 Setups the hardware for talking to the LTR329. More...
 
bool reset (void)
 Perform a soft reset with 10ms delay. More...
 
void enable (bool en)
 Enable or disable the light sensor. More...
 
bool enabled (void)
 Read the enabled-bit from the sensor. More...
 
void setGain (ltr329_gain_t gain)
 Set the sensor gain. More...
 
ltr329_gain_t getGain (void)
 Get the sensor's gain. More...
 
void setIntegrationTime (ltr329_integrationtime_t inttime)
 Set the sensor integration time. Longer times are more sensitive but take longer to read! More...
 
ltr329_integrationtime_t getIntegrationTime (void)
 Get the sensor's integration time for light sensing. More...
 
void setMeasurementRate (ltr329_measurerate_t rate)
 Set the sensor measurement rate. Longer times are needed when the integration time is longer OR if you want to have lower power usage. More...
 
ltr329_measurerate_t getMeasurementRate (void)
 Get the sensor's measurement rate. More...
 
bool newDataAvailable (void)
 Checks if new data is available in data register. More...
 
bool readBothChannels (uint16_t &ch0, uint16_t &ch1)
 Read both 16-bit channels at once, and place data into argument pointers. More...
 

Additional Inherited Members

- Protected Attributes inherited from Adafruit_LTR329
Adafruit_I2CDevice * i2c_dev = NULL
 The underlying I2C interface.
 

Detailed Description

Class that stores state and functions for interacting with LTR303 Light Sensor.

Member Function Documentation

◆ enableInterrupt()

void Adafruit_LTR303::enableInterrupt ( bool  en)

Enables the interrupt output pin.

Parameters
enPass in 'true' to enable the output pin, false to tri-state

◆ setInterruptPolarity()

void Adafruit_LTR303::setInterruptPolarity ( bool  pol)

The INT pin has a polarity setting for active low or high!

Parameters
polFor active LOW set to 'false', for active HIGH set to 'true'

◆ setLowThreshold()

void Adafruit_LTR303::setLowThreshold ( uint16_t  value)

The low threshold for ALS reading interrupts : values BELOW this trigger an interrupt.

Parameters
valueThis number is compared against the 'visible + IR' data register

◆ getLowThreshold()

uint16_t Adafruit_LTR303::getLowThreshold ( void  )

The low threshold for ALS reading interrupt getter.

Returns
The value that ALS compares for low-value interrupts

◆ setHighThreshold()

void Adafruit_LTR303::setHighThreshold ( uint16_t  value)

The high threshold for ALS reading interrupts : values ABOVE this trigger an interrupt.

Parameters
valueThis number is compared against the 'visible + IR' data register

◆ getHighThreshold()

uint16_t Adafruit_LTR303::getHighThreshold ( void  )

The high threshold for ALS reading interrupt getter.

Returns
The value that ALS compares for high-value interrupts

◆ setIntPersistance()

void Adafruit_LTR303::setIntPersistance ( uint8_t  counts)

The default behavior is an interrupt on every value that is under/over the threshold ranges. However, you're more likely to get spurious IRQs, so we can set it to require "N counts in a row" before an IRQ.

Parameters
counts1 count is IRQ for each reading, 2 counts means we need two outside readings in a row, etc up to 16.

◆ getIntPersistance()

uint8_t Adafruit_LTR303::getIntPersistance ( void  )

Getter for the number of counts required to trigger IRQ.

Returns
1 count is IRQ for each reading, 2 counts means we need two outside readings in a row, etc up to 16.

The documentation for this class was generated from the following files: