![]() |
LTR-507 Light And Proximity Sensor Arduino Library 1.0.0
Library used to easily operate with the LTR-507 Light And Proximity Sensor
|
#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. | |
![]() | |
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 | |
![]() | |
int | native = 0 |
bool | beginDone = 0 |
int | err |
char | address |
const char | defaultAddress = 0x30 |
|
inline |
uint16_t LTR507::getLightIntensity | ( | ) |
Get the light intensity.
uint16_t LTR507::getProximity | ( | ) |
Get the proximity.
void LTR507::init | ( | ) |
Function which initializes sensor, also begins I2C communication.
|
protectedvirtual |
Overloaded function for virtual in base class to initialize sensor specific.
Implements EasyC.
void LTR507::setALSBitWidth | ( | uint8_t | alsBitWidth | ) |
Function that sets ALS measurement bit width.
uint8_t | bitWidth: 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 |
void LTR507::setALSGain | ( | uint8_t | alsGain | ) |
Function that sets the gain for ALS measurement.
uint8_t | alsGain: You can use: -LTR507_ALS_GAIN_RANGE1 -LTR507_ALS_GAIN_RANGE2 -LTR507_ALS_GAIN_RANGE3 -LTR507_ALS_GAIN_RANGE4 |
void LTR507::setALSMeasRate | ( | uint8_t | alsMeasRate | ) |
Function that sets ALS measurement rate.
uint8_t | alsMeasRate: 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 |
void LTR507::setALSMode | ( | bool | mode | ) |
Function that enables or disables ALS measurements.
bool | mode: true to enable, false to disable |
void LTR507::setLEDDutyCycle | ( | uint8_t | duty | ) |
Function that sets the duty cycle of the LED.
uint8_t | duty: You can use: -LTR507_LED_CURRENT_DUTY_DEFAULT |
void LTR507::setLEDPeakCurrent | ( | uint8_t | peakCurrent | ) |
Function that sets the peak current of the LED.
uint8_t | peakCurrent: You can use: -LTR507_LED_PEAK_CURRENT_5MA -LTR507_LED_PEAK_CURRENT_10MA -LTR507_LED_PEAK_CURRENT_20MA -LTR507_LED_PEAK_CURRENT_50MA |
void LTR507::setLEDPulseFreq | ( | uint8_t | freq | ) |
Function that sets the pulse frequency of the LED.
uint8_t | freq: 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 |
void LTR507::setPSMeasRate | ( | uint8_t | psMeasRate | ) |
Function that sets the measuring rate of the proximity sensor.
uint8_t | psMeasRate: 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 |
void LTR507::setPSMode | ( | bool | mode | ) |
Function that enables or disables PS measurements.
bool | mode: true to enable, false to disable |
void LTR507::setPSNumPulses | ( | uint8_t | numPulses | ) |
Function that sets the number of pulses for each measurement.
uint8_t | numPulses: You can use values from 1 to 15. Default is 1. |
|
private |