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

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

#include <Adafruit_LTR329_LTR303.h>

Inheritance diagram for Adafruit_LTR329:
Adafruit_LTR303

Public Member Functions

 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...
 

Protected Attributes

Adafruit_I2CDevice * i2c_dev = NULL
 The underlying I2C interface.
 

Detailed Description

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

Member Function Documentation

◆ begin()

bool Adafruit_LTR329::begin ( TwoWire *  theWire = &Wire)

Setups the hardware for talking to the LTR329.

Parameters
theWireAn optional pointer to an I2C interface
Returns
True if initialization was successful, otherwise false.

◆ reset()

bool Adafruit_LTR329::reset ( void  )

Perform a soft reset with 10ms delay.

Returns
True on success

◆ enable()

void Adafruit_LTR329::enable ( bool  en)

Enable or disable the light sensor.

Parameters
enTrue to enable, False to disable

◆ enabled()

bool Adafruit_LTR329::enabled ( void  )

Read the enabled-bit from the sensor.

Returns
True if enabled

◆ setGain()

void Adafruit_LTR329::setGain ( ltr329_gain_t  gain)

Set the sensor gain.

Parameters
gainThe desired gain: LTR3XX_GAIN_1, LTR3XX_GAIN_2, LTR3XX_GAIN_4 LTR3XX_GAIN_8, LTR3XX_GAIN_48 or LTR3XX_GAIN_96

◆ getGain()

ltr329_gain_t Adafruit_LTR329::getGain ( void  )

Get the sensor's gain.

Returns
gain The current gain: LTR3XX_GAIN_1, LTR3XX_GAIN_2, LTR3XX_GAIN_4 LTR3XX_GAIN_8, LTR3XX_GAIN_48 or LTR3XX_GAIN_96

◆ setIntegrationTime()

void Adafruit_LTR329::setIntegrationTime ( ltr329_integrationtime_t  inttime)

Set the sensor integration time. Longer times are more sensitive but take longer to read!

Parameters
inttimeThe desired integration time (in millis): LTR3XX_INTEGTIME_50, LTR3XX_INTEGTIME_100, LTR3XX_INTEGTIME_150, LTR3XX_INTEGTIME_200,LTR3XX_INTEGTIME_250, LTR3XX_INTEGTIME_300, LTR3XX_INTEGTIME_350, LTR3XX_INTEGTIME_400,

◆ getIntegrationTime()

ltr329_integrationtime_t Adafruit_LTR329::getIntegrationTime ( void  )

Get the sensor's integration time for light sensing.

Returns
The current integration time, in milliseconds. LTR3XX_INTEGTIME_50, LTR3XX_INTEGTIME_100, LTR3XX_INTEGTIME_150, LTR3XX_INTEGTIME_200,LTR3XX_INTEGTIME_250, LTR3XX_INTEGTIME_300, LTR3XX_INTEGTIME_350, LTR3XX_INTEGTIME_400,

◆ setMeasurementRate()

void Adafruit_LTR329::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.

Parameters
rateThe desired measurement rate (in millis): LTR3XX_MEASRATE_50, LTR3XX_MEASRATE_100, LTR3XX_MEASRATE_200, LTR3XX_MEASRATE_500, LTR3XX_MEASRATE_1000, or LTR3XX_MEASRATE_2000

◆ getMeasurementRate()

ltr329_measurerate_t Adafruit_LTR329::getMeasurementRate ( void  )

Get the sensor's measurement rate.

Returns
The current measurement rate (in millis): LTR3XX_MEASRATE_50, LTR3XX_MEASRATE_100, LTR3XX_MEASRATE_200, LTR3XX_MEASRATE_500, LTR3XX_MEASRATE_1000, or LTR3XX_MEASRATE_2000

◆ newDataAvailable()

bool Adafruit_LTR329::newDataAvailable ( void  )

Checks if new data is available in data register.

Returns
True on new data available

◆ readBothChannels()

bool Adafruit_LTR329::readBothChannels ( uint16_t &  ch0,
uint16_t &  ch1 
)

Read both 16-bit channels at once, and place data into argument pointers.

Parameters
ch0Reference to uint16_t where visible+IR data will be stored
ch1Reference to uint16_t where IR-only data will be stored
Returns
True if data is valid (no over-run), false on bad data

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