LTR-507 Light And Proximity Sensor Arduino Library 1.0.0
Library used to easily operate with the LTR-507 Light And Proximity Sensor
Loading...
Searching...
No Matches
LTR507 Class Reference

#include <LTR-507-Light-And-Proximity-Sensor-SOLDERED.h>

Inherits EasyC.

Public Member Functions

 LTR507 ()
 
void init ()
 Function which initializes sensor, also begins I2C communication.
 
void setPSMode (bool mode)
 Function that enables or disables PS measurements.
 
void setALSMode (bool mode)
 Function that enables or disables ALS measurements.
 
void setLEDPulseFreq (uint8_t freq)
 Function that sets the pulse frequency of the LED.
 
void setLEDDutyCycle (uint8_t duty)
 Function that sets the duty cycle of the LED.
 
void setPSMeasRate (uint8_t psMeasRate)
 Function that sets the measuring rate of the proximity sensor.
 
void setLEDPeakCurrent (uint8_t peakCurrent)
 Function that sets the peak current of the LED.
 
void setPSNumPulses (uint8_t numPulses)
 Function that sets the number of pulses for each measurement.
 
void setALSGain (uint8_t alsGain)
 Function that sets the gain for ALS measurement.
 
void setALSBitWidth (uint8_t alsBitWidth)
 Function that sets ALS measurement bit width.
 
void setALSMeasRate (uint8_t alsMeasRate)
 Function that sets ALS measurement rate.
 
uint16_t getLightIntensity ()
 Get the light intensity.
 
uint16_t getProximity ()
 Get the proximity.
 
- Public Member Functions inherited from EasyC
 EasyC ()
 Main constructor for easyC version.
 
void begin ()
 Initializes sensors on native or easyC on default address.
 
void begin (uint8_t _address)
 Initializes sensors on supplied i2c address.
 
int sendAddress (char regAddr)
 Private function to send a single byte to sensor.
 
int readData (char a[], int n)
 Private function to read n bytes over i2c.
 
int readRegister (char regAddr, char a[], size_t n)
 Private function to send over i2c and then read n bytes.
 
int sendData (const uint8_t *a, int n)
 Private function to write n bytes over i2c.
 

Protected Member Functions

void initializeNative ()
 Overloaded function for virtual in base class to initialize sensor specific.
 

Private Attributes

uint8_t raw [2]
 

Additional Inherited Members

- Public Attributes inherited from EasyC
int native = 0
 
bool beginDone = 0
 
int err
 
char address
 
const char defaultAddress = 0x30
 

Constructor & Destructor Documentation

◆ LTR507()

LTR507::LTR507 ( )
inline

Member Function Documentation

◆ getLightIntensity()

uint16_t LTR507::getLightIntensity ( )

Get the light intensity.

Returns
uint16_t, the light intensity value read by the sensor

◆ getProximity()

uint16_t LTR507::getProximity ( )

Get the proximity.

Returns
uint16_t, the proximity value read by the sensor

◆ init()

void LTR507::init ( )

Function which initializes sensor, also begins I2C communication.

Returns
none

◆ initializeNative()

void LTR507::initializeNative ( )
protectedvirtual

Overloaded function for virtual in base class to initialize sensor specific.

Implements EasyC.

◆ setALSBitWidth()

void LTR507::setALSBitWidth ( uint8_t alsBitWidth)

Function that sets ALS measurement bit width.

Parameters
uint8_tbitWidth: You can use: -LTR507_ALS_ADC_BIT_WIDTH_20BIT -LTR507_ALS_ADC_BIT_WIDTH_19BIT -LTR507_ALS_ADC_BIT_WIDTH_18BIT -LTR507_ALS_ADC_BIT_WIDTH_17BIT -LTR507_ALS_ADC_BIT_WIDTH_16BIT -LTR507_ALS_ADC_BIT_WIDTH_12BIT -LTR507_ALS_ADC_BIT_WIDTH_8BIT -LTR507_ALS_ADC_BIT_WIDTH_4BIT

◆ setALSGain()

void LTR507::setALSGain ( uint8_t alsGain)

Function that sets the gain for ALS measurement.

Parameters
uint8_talsGain: You can use: -LTR507_ALS_GAIN_RANGE1 -LTR507_ALS_GAIN_RANGE2 -LTR507_ALS_GAIN_RANGE3 -LTR507_ALS_GAIN_RANGE4

◆ setALSMeasRate()

void LTR507::setALSMeasRate ( uint8_t alsMeasRate)

Function that sets ALS measurement rate.

Parameters
uint8_talsMeasRate: You can use: -LTR507_ALS_MEASUREMENT_RATE_100MS -LTR507_ALS_MEASUREMENT_RATE_200MS -LTR507_ALS_MEASUREMENT_RATE_500MS -LTR507_ALS_MEASUREMENT_RATE_1000MS -LTR507_ALS_MEASUREMENT_RATE_2000MS

◆ setALSMode()

void LTR507::setALSMode ( bool mode)

Function that enables or disables ALS measurements.

Parameters
boolmode: true to enable, false to disable

◆ setLEDDutyCycle()

void LTR507::setLEDDutyCycle ( uint8_t duty)

Function that sets the duty cycle of the LED.

Parameters
uint8_tduty: You can use: -LTR507_LED_CURRENT_DUTY_DEFAULT

◆ setLEDPeakCurrent()

void LTR507::setLEDPeakCurrent ( uint8_t peakCurrent)

Function that sets the peak current of the LED.

Parameters
uint8_tpeakCurrent: You can use: -LTR507_LED_PEAK_CURRENT_5MA -LTR507_LED_PEAK_CURRENT_10MA -LTR507_LED_PEAK_CURRENT_20MA -LTR507_LED_PEAK_CURRENT_50MA

◆ setLEDPulseFreq()

void LTR507::setLEDPulseFreq ( uint8_t freq)

Function that sets the pulse frequency of the LED.

Parameters
uint8_tfreq: You can use: -LTR507_LED_PULSE_FREQ_30KHZ -LTR507_LED_PULSE_FREQ_40KHZ -LTR507_LED_PULSE_FREQ_50KHZ -LTR507_LED_PULSE_FREQ_60KHZ -LTR507_LED_PULSE_FREQ_70KHZ -LTR507_LED_PULSE_FREQ_80KHZ -LTR507_LED_PULSE_FREQ_90KHZ -LTR507_LED_PULSE_FREQ_100KHZ

◆ setPSMeasRate()

void LTR507::setPSMeasRate ( uint8_t psMeasRate)

Function that sets the measuring rate of the proximity sensor.

Parameters
uint8_tpsMeasRate: You can use: -LTR507_PS_MEASUREMENT_RATE_12_5MS -LTR507_PS_MEASUREMENT_RATE_50MS -LTR507_PS_MEASUREMENT_RATE_70MS -LTR507_PS_MEASUREMENT_RATE_100MS -LTR507_PS_MEASUREMENT_RATE_200MS -LTR507_PS_MEASUREMENT_RATE_500MS -LTR507_PS_MEASUREMENT_RATE_1000MS -LTR507_PS_MEASUREMENT_RATE_2000MS

◆ setPSMode()

void LTR507::setPSMode ( bool mode)

Function that enables or disables PS measurements.

Parameters
boolmode: true to enable, false to disable

◆ setPSNumPulses()

void LTR507::setPSNumPulses ( uint8_t numPulses)

Function that sets the number of pulses for each measurement.

Parameters
uint8_tnumPulses: You can use values from 1 to 15. Default is 1.

Member Data Documentation

◆ raw

uint8_t LTR507::raw[2]
private

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