SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SensorLTR553 Class Reference

Driver for the LTR-553ALS-01 ambient light + proximity sensor (I2C). More...

#include <SensorLTR553.hpp>

Inheritance diagram for SensorLTR553:
[legend]

Public Types

enum  IrqLevel { ALS_IRQ_ACTIVE_LOW , ALS_IRQ_ACTIVE_HIGH }
 Interrupt pin active level. More...
 
enum  IrqMode { ALS_IRQ_DISABLE = 0 , ALS_IRQ_ONLY_PS = 1 , ALS_IRQ_ONLY_ALS = 2 , ALS_IRQ_BOTH = 3 }
 Interrupt trigger source. More...
 
enum  LightSensorGain {
  ALS_GAIN_1X = 0x00 , ALS_GAIN_2X = 0x01 , ALS_GAIN_4X = 0x02 , ALS_GAIN_8X = 0x03 ,
  ALS_GAIN_48X = 0x06 , ALS_GAIN_96X = 0x07
}
 ALS gain selection. More...
 
enum  PsLedPeriod {
  PS_LED_PLUSE_30KHZ , PS_LED_PLUSE_40KHZ , PS_LED_PLUSE_50KHZ , PS_LED_PLUSE_60KHZ ,
  PS_LED_PLUSE_70KHZ , PS_LED_PLUSE_80KHZ , PS_LED_PLUSE_90KHZ , PS_LED_PLUSE_100KHZ
}
 PS LED pulse modulation frequency (REG_PS_LED bits 7:5). More...
 
enum  PsLedDuty { PS_LED_DUTY_25 , PS_LED_DUTY_50 , PS_LED_DUTY_75 , PS_LED_DUTY_100 }
 PS LED duty cycle (REG_PS_LED bits 4:3). More...
 
enum  PsLedCurrent {
  PS_LED_CUR_5MA , PS_LED_CUR_10MA , PS_LED_CUR_20MA , PS_LED_CUR_50MA ,
  PS_LED_CUR_100MA
}
 PS LED peak current selection (REG_PS_LED bits 2:0). More...
 
enum  PsRate {
  PS_MEAS_RATE_50MS , PS_MEAS_RATE_70MS , PS_MEAS_RATE_100MS , PS_MEAS_RATE_200MS ,
  PS_MEAS_RATE_500MS , PS_MEAS_RATE_1000MS , PS_MEAS_RATE_2000MS , PS_MEAS_RATE_10MS = 8
}
 PS measurement rate (REG_PS_MEAS_RATE field). More...
 
enum  IntegrationTime {
  ALS_INTEGRATION_TIME_100MS , ALS_INTEGRATION_TIME_50MS , ALS_INTEGRATION_TIME_200MS , ALS_INTEGRATION_TIME_400MS ,
  ALS_INTEGRATION_TIME_150MS , ALS_INTEGRATION_TIME_250MS , ALS_INTEGRATION_TIME_300MS , ALS_INTEGRATION_TIME_350MS
}
 ALS integration time (REG_ALS_MEAS_RATE bits 5:3). More...
 
enum  MeasurementRate {
  ALS_MEASUREMENT_TIME_50MS , ALS_MEASUREMENT_TIME_100MS , ALS_MEASUREMENT_TIME_200MS , ALS_MEASUREMENT_TIME_500MS ,
  ALS_MEASUREMENT_TIME_1000MS , ALS_MEASUREMENT_TIME_2000MS
}
 ALS measurement repeat rate (REG_ALS_MEAS_RATE bits 2:0). More...
 

Public Member Functions

 SensorLTR553 ()=default
 Construct an uninitialized driver instance.
 
 ~SensorLTR553 ()=default
 Destructor.
 
void setIRQLevel (IrqLevel level)
 Set interrupt pin polarity.
 
void enableIRQ (IrqMode mode)
 Enable interrupts and select which measurement sources can trigger them.
 
void disableIRQ ()
 Disable all interrupt sources (mode bits = 0).
 
bool psAvailable ()
 Check PS data ready flag.
 
void setLightSensorThreshold (uint16_t low, uint16_t high)
 Set ALS threshold window.
 
void setLightSensorPersists (uint8_t count)
 Configure ALS interrupt persistence count.
 
void setLightSensorRate (IntegrationTime alsIntegrationTime, MeasurementRate alsMeasurementRate)
 Configure ALS integration time and measurement repeat rate.
 
void enableLightSensor ()
 Enable ALS measurement.
 
void disableLightSensor ()
 Disable ALS measurement.
 
void setLightSensorGain (LightSensorGain gain)
 Set ALS gain.
 
int getLightSensor (uint8_t ch)
 Read ALS raw data from channel 0 or 1.
 
void setProximityPersists (uint8_t count)
 Configure PS interrupt persistence count.
 
void setProximityThreshold (uint16_t low, uint16_t high)
 Set PS threshold window.
 
void setProximityRate (PsRate rate)
 Set PS measurement rate.
 
void enableProximity ()
 Enable proximity measurement.
 
void disableProximity ()
 Disable proximity measurement.
 
void enablePsIndicator ()
 Enable PS indicator.
 
void disablePsIndicator ()
 Disable PS indicator.
 
int getProximity (bool *saturated=NULL)
 Read proximity raw data.
 
void setPsLedPulsePeriod (PsLedPeriod period)
 Set PS LED pulse modulation frequency (REG_PS_LED bits 7:5).
 
void setPsLedDutyCycle (PsLedDuty duty)
 Set PS LED duty cycle (REG_PS_LED bits 4:3).
 
void setPsLedCurrent (PsLedCurrent cur)
 Set PS LED peak current (REG_PS_LED bits 2:0).
 
void setPsLedPulses (uint8_t pulesNum)
 Set number of PS LED pulses (REG_PS_N_PULSES bits 3:0).
 
int getPartID ()
 Get Part ID (REG_PART_ID high nibble).
 
int getRevisionID ()
 Get Revision ID (REG_PART_ID low nibble).
 
int getManufacturerID ()
 Read Manufacturer ID (REG_MANUFAC_ID).
 
void reset ()
 Software reset (REG_ALS_CONTR bit1).
 
- Public Member Functions inherited from I2CDeviceNoHal
bool begin (SensorCommCustom::CustomCallback callback, uint8_t addr)
 Initialize the sensor using custom callback interface.
 
- Public Member Functions inherited from DeviceBeginCommon
virtual ~DeviceBeginCommon ()
 
uint8_t getAddress () const
 
uint8_t getInterface () const
 
- Public Member Functions inherited from SensorCommWrapper
 SensorCommWrapper ()=default
 
int readReg (uint8_t reg) const
 
int readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const
 
int readBuff (uint8_t *buf, size_t len) const
 
int writeReg (uint8_t reg, uint8_t val)
 
int writeRegBuff (uint8_t reg, uint8_t *buf, size_t len)
 
int writeBuff (uint8_t *buf, size_t len)
 
int writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len)
 
bool setRegBit (uint8_t reg, uint8_t bit)
 
bool clrRegBit (uint8_t reg, uint8_t bit)
 
bool getRegBit (uint8_t reg, uint8_t bit)
 
int updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted)
 
void setAddress (uint8_t address)
 
void setAck (bool enable)
 
- Public Member Functions inherited from SensorCommInterface
virtual ~SensorCommInterface ()=default
 

Static Protected Attributes

static constexpr uint8_t REG_ALS_CONTR = 0x80
 
static constexpr uint8_t REG_PS_CONTR = 0x81
 
static constexpr uint8_t REG_PS_LED = 0x82
 
static constexpr uint8_t REG_PS_N_PULSES = 0x83
 
static constexpr uint8_t REG_PS_MEAS_RATE = 0x84
 
static constexpr uint8_t REG_ALS_MEAS_RATE = 0x85
 
static constexpr uint8_t REG_PART_ID = 0x86
 
static constexpr uint8_t REG_MANUFAC_ID = 0x87
 
static constexpr uint8_t REG_ALS_DATA_CH1_0 = 0x88
 
static constexpr uint8_t REG_ALS_DATA_CH1_1 = 0x89
 
static constexpr uint8_t REG_ALS_DATA_CH0_0 = 0x8A
 
static constexpr uint8_t REG_ALS_DATA_CH0_1 = 0x8B
 
static constexpr uint8_t REG_ALS_PS_STATUS = 0x8C
 
static constexpr uint8_t REG_PS_DATA_0 = 0x8D
 
static constexpr uint8_t REG_PS_DATA_1 = 0x8E
 
static constexpr uint8_t REG_INTERRUPT = 0x8F
 
static constexpr uint8_t REG_PS_THRES_UP_0 = 0x90
 
static constexpr uint8_t REG_PS_THRES_UP_1 = 0x91
 
static constexpr uint8_t REG_PS_THRES_LOW_0 = 0x92
 
static constexpr uint8_t REG_PS_THRES_LOW_1 = 0x93
 
static constexpr uint8_t REG_PS_OFFSET_1 = 0x94
 
static constexpr uint8_t REG_PS_OFFSET_0 = 0x95
 
static constexpr uint8_t REG_ALS_THRES_UP_0 = 0x97
 
static constexpr uint8_t REG_ALS_THRES_UP_1 = 0x98
 
static constexpr uint8_t REG_ALS_THRES_LOW_0 = 0x99
 
static constexpr uint8_t REG_ALS_THRES_LOW_1 = 0x9A
 
static constexpr uint8_t REG_INTERRUPT_PERSIST = 0x9E
 
static constexpr uint8_t LTR553_DEFAULT_MAN_ID = 0x05
 Default manufacturer ID.
 

Additional Inherited Members

- Protected Member Functions inherited from DeviceBeginCommon
 DeviceBeginCommon ()=default
 
virtual bool ensureValid () const override
 
virtual SensorCommBasegetComm () const override
 
virtual void beforeBegin ()
 
virtual void afterCommReady ()
 
virtual void afterInitSuccess (uint8_t param)
 
virtual void onBeginFail ()
 
bool fail ()
 
void clearCommState ()
 
template<typename CreateComm >
bool beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
 
- Protected Attributes inherited from DeviceBeginCommon
std::unique_ptr< SensorCommBasecomm
 
std::unique_ptr< SensorHalhal
 
std::unique_ptr< SensorCommStaticstaticComm
 
uint8_t _addr = 0
 
uint8_t _iface = COMM_CUSTOM
 

Detailed Description

Driver for the LTR-553ALS-01 ambient light + proximity sensor (I2C).

This class provides a lightweight register-level driver for:

  • ALS (Ambient Light Sensing) configuration and reading
  • PS (Proximity Sensing) configuration and reading
  • Threshold window configuration
  • Interrupt configuration (polarity + source selection)

The register map and bit fields follow the LTR-553ALS-01 datasheet.

Warning
You must call begin() successfully before calling any other methods.

Definition at line 53 of file sensor/light_sensor/SensorLTR553.hpp.

Member Enumeration Documentation

◆ IntegrationTime

ALS integration time (REG_ALS_MEAS_RATE bits 5:3).

Datasheet mapping (bits 5:3):

  • 000: 100ms (default)
  • 001: 50ms
  • 010: 200ms
  • 011: 400ms
  • 100: 150ms
  • 101: 250ms
  • 110: 300ms
  • 111: 350ms
Enumerator
ALS_INTEGRATION_TIME_100MS 
ALS_INTEGRATION_TIME_50MS 
ALS_INTEGRATION_TIME_200MS 
ALS_INTEGRATION_TIME_400MS 
ALS_INTEGRATION_TIME_150MS 
ALS_INTEGRATION_TIME_250MS 
ALS_INTEGRATION_TIME_300MS 
ALS_INTEGRATION_TIME_350MS 

Definition at line 161 of file sensor/light_sensor/SensorLTR553.hpp.

◆ IrqLevel

Interrupt pin active level.

Enumerator
ALS_IRQ_ACTIVE_LOW 

INT pin is active-low (default)

ALS_IRQ_ACTIVE_HIGH 

INT pin is active-high.

Definition at line 59 of file sensor/light_sensor/SensorLTR553.hpp.

◆ IrqMode

Interrupt trigger source.

This selects which measurement(s) can assert the interrupt pin.

Enumerator
ALS_IRQ_DISABLE 

No measurement can trigger interrupt (default)

ALS_IRQ_ONLY_PS 

Only PS measurement can trigger interrupt.

ALS_IRQ_ONLY_ALS 

Only ALS measurement can trigger interrupt.

ALS_IRQ_BOTH 

Both ALS and PS measurement can trigger interrupt.

Definition at line 69 of file sensor/light_sensor/SensorLTR553.hpp.

◆ LightSensorGain

ALS gain selection.

Note: Actual lux range depends on gain and integration time.

Enumerator
ALS_GAIN_1X 

1 lux to 64k lux (default)

ALS_GAIN_2X 

0.5 lux to 32k lux

ALS_GAIN_4X 

0.25 lux to 16k lux

ALS_GAIN_8X 

0.125 lux to 8k lux

ALS_GAIN_48X 

0.02 lux to 1.3k lux

ALS_GAIN_96X 

0.01 lux to 600 lux

Definition at line 81 of file sensor/light_sensor/SensorLTR553.hpp.

◆ MeasurementRate

ALS measurement repeat rate (REG_ALS_MEAS_RATE bits 2:0).

Datasheet mapping (bits 2:0):

  • 000: 50ms
  • 001: 100ms
  • 010: 200ms
  • 011: 500ms (default)
  • 100: 1000ms
  • 110: 2000ms
Note
Some values may be reserved per datasheet.
Enumerator
ALS_MEASUREMENT_TIME_50MS 
ALS_MEASUREMENT_TIME_100MS 
ALS_MEASUREMENT_TIME_200MS 
ALS_MEASUREMENT_TIME_500MS 
ALS_MEASUREMENT_TIME_1000MS 
ALS_MEASUREMENT_TIME_2000MS 

Definition at line 185 of file sensor/light_sensor/SensorLTR553.hpp.

◆ PsLedCurrent

PS LED peak current selection (REG_PS_LED bits 2:0).

Note
The enum values are kept consistent with the original library design. Please refer to the datasheet current encoding table if you need strict mapping.
Enumerator
PS_LED_CUR_5MA 

5mA

PS_LED_CUR_10MA 

10mA

PS_LED_CUR_20MA 

20mA

PS_LED_CUR_50MA 

50mA

PS_LED_CUR_100MA 

100mA

Definition at line 124 of file sensor/light_sensor/SensorLTR553.hpp.

◆ PsLedDuty

PS LED duty cycle (REG_PS_LED bits 4:3).

Datasheet: 00=25%, 01=50%, 10=75%, 11=100%.

Enumerator
PS_LED_DUTY_25 

25%

PS_LED_DUTY_50 

50%

PS_LED_DUTY_75 

75%

PS_LED_DUTY_100 

100% (default)

Definition at line 111 of file sensor/light_sensor/SensorLTR553.hpp.

◆ PsLedPeriod

PS LED pulse modulation frequency (REG_PS_LED bits 7:5).

Datasheet: 000=30kHz ... 111=100kHz.

Enumerator
PS_LED_PLUSE_30KHZ 

30kHz

PS_LED_PLUSE_40KHZ 

40kHz

PS_LED_PLUSE_50KHZ 

50kHz

PS_LED_PLUSE_60KHZ 

60kHz (default)

PS_LED_PLUSE_70KHZ 

70kHz

PS_LED_PLUSE_80KHZ 

80kHz

PS_LED_PLUSE_90KHZ 

90kHz

PS_LED_PLUSE_100KHZ 

100kHz

Definition at line 95 of file sensor/light_sensor/SensorLTR553.hpp.

◆ PsRate

PS measurement rate (REG_PS_MEAS_RATE field).

Note
PS_MEAS_RATE_10MS uses value 8, matching the original implementation.
Enumerator
PS_MEAS_RATE_50MS 
PS_MEAS_RATE_70MS 
PS_MEAS_RATE_100MS 
PS_MEAS_RATE_200MS 
PS_MEAS_RATE_500MS 
PS_MEAS_RATE_1000MS 
PS_MEAS_RATE_2000MS 
PS_MEAS_RATE_10MS 

Definition at line 137 of file sensor/light_sensor/SensorLTR553.hpp.

Constructor & Destructor Documentation

◆ SensorLTR553()

SensorLTR553::SensorLTR553 ( )
default

Construct an uninitialized driver instance.

◆ ~SensorLTR553()

SensorLTR553::~SensorLTR553 ( )
default

Destructor.

Deinitializes the communication backend if created.

Member Function Documentation

◆ disableIRQ()

void SensorLTR553::disableIRQ ( )
inline

Disable all interrupt sources (mode bits = 0).

Definition at line 234 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_INTERRUPT, and SensorCommWrapper::updateBits().

◆ disableLightSensor()

void SensorLTR553::disableLightSensor ( )
inline

Disable ALS measurement.

Definition at line 314 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::clrRegBit(), and REG_ALS_CONTR.

◆ disableProximity()

void SensorLTR553::disableProximity ( )
inline

Disable proximity measurement.

Definition at line 409 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_CONTR, and SensorCommWrapper::updateBits().

◆ disablePsIndicator()

void SensorLTR553::disablePsIndicator ( )
inline

Disable PS indicator.

Definition at line 425 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::clrRegBit(), and REG_PS_CONTR.

◆ enableIRQ()

void SensorLTR553::enableIRQ ( IrqMode  mode)
inline

Enable interrupts and select which measurement sources can trigger them.

Parameters
modeInterrupt source mode.

Definition at line 223 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_INTERRUPT, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ enableLightSensor()

void SensorLTR553::enableLightSensor ( )
inline

Enable ALS measurement.

Definition at line 306 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_ALS_CONTR, and SensorCommWrapper::setRegBit().

Referenced by setup().

◆ enableProximity()

void SensorLTR553::enableProximity ( )
inline

Enable proximity measurement.

Definition at line 401 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_CONTR, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ enablePsIndicator()

void SensorLTR553::enablePsIndicator ( )
inline

Enable PS indicator.

Definition at line 417 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_CONTR, and SensorCommWrapper::setRegBit().

Referenced by setup().

◆ getLightSensor()

int SensorLTR553::getLightSensor ( uint8_t  ch)
inline

Read ALS raw data from channel 0 or 1.

Parameters
chChannel index (0 or 1). Any non-1 value will be treated as channel 0.
Returns
Raw 16-bit value on success, -1 on invalid data or I2C error.

Definition at line 335 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::getRegBit(), SensorCommWrapper::readRegBuff(), REG_ALS_DATA_CH0_0, REG_ALS_DATA_CH1_0, and REG_ALS_PS_STATUS.

Referenced by loop().

◆ getManufacturerID()

int SensorLTR553::getManufacturerID ( )
inline

Read Manufacturer ID (REG_MANUFAC_ID).

Expected value is LTR553_DEFAULT_MAN_ID.

Returns
Manufacturer ID (or -1 on I2C error depending on backend).

Definition at line 536 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::readReg(), and REG_MANUFAC_ID.

◆ getPartID()

int SensorLTR553::getPartID ( )
inline

Get Part ID (REG_PART_ID high nibble).

Returns
Part ID on success, -1 on error.

Definition at line 506 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::readReg(), and REG_PART_ID.

◆ getProximity()

int SensorLTR553::getProximity ( bool *  saturated = NULL)
inline

Read proximity raw data.

Proximity data is 11-bit:

  • Low 8 bits: REG_PS_DATA_0
  • High 3 bits: REG_PS_DATA_1 bits [2:0]
Parameters
saturatedOptional pointer; will be set true if saturation flag is asserted (bit7).
Returns
Proximity value on success, -1 on I2C error.

Definition at line 440 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::readRegBuff(), and REG_PS_DATA_0.

Referenced by loop().

◆ getRevisionID()

int SensorLTR553::getRevisionID ( )
inline

Get Revision ID (REG_PART_ID low nibble).

Returns
Revision ID on success, -1 on error.

Definition at line 520 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::readReg(), and REG_PART_ID.

◆ psAvailable()

bool SensorLTR553::psAvailable ( )
inline

Check PS data ready flag.

Returns
true if PS data is ready (REG_ALS_PS_STATUS bit0), false otherwise.
Note
Function name follows original implementation.

Definition at line 250 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::getRegBit(), and REG_ALS_PS_STATUS.

◆ reset()

void SensorLTR553::reset ( )
inline

Software reset (REG_ALS_CONTR bit1).

Definition at line 545 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_ALS_CONTR, and SensorCommWrapper::setRegBit().

◆ setIRQLevel()

void SensorLTR553::setIRQLevel ( IrqLevel  level)
inline

Set interrupt pin polarity.

Parameters
levelDesired active level.

Definition at line 209 of file sensor/light_sensor/SensorLTR553.hpp.

References SensorCommWrapper::clrRegBit(), level, REG_INTERRUPT, and SensorCommWrapper::setRegBit().

Referenced by setup().

◆ setLightSensorGain()

void SensorLTR553::setLightSensorGain ( LightSensorGain  gain)
inline

Set ALS gain.

Parameters
gainGain selection.

Definition at line 324 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_ALS_CONTR, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setLightSensorPersists()

void SensorLTR553::setLightSensorPersists ( uint8_t  count)
inline

Configure ALS interrupt persistence count.

Datasheet (REG_INTERRUPT_PERSIST 0x9E):

  • ALS Persist bits [3:0]
Parameters
countNumber of consecutive ALS out-of-range events before asserting interrupt.
Warning
Passing 0 will underflow due to (count - 1). Keep as-is to match original behavior.

Definition at line 282 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_INTERRUPT_PERSIST, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setLightSensorRate()

void SensorLTR553::setLightSensorRate ( IntegrationTime  alsIntegrationTime,
MeasurementRate  alsMeasurementRate 
)
inline

Configure ALS integration time and measurement repeat rate.

Datasheet (REG_ALS_MEAS_RATE 0x85):

  • ALS integration time bits [5:3]
  • ALS measurement repeat rate bits [2:0]
Parameters
alsIntegrationTimeALS integration time.
alsMeasurementRateALS measurement repeat rate.

Definition at line 297 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_ALS_MEAS_RATE, and SensorCommWrapper::writeReg().

◆ setLightSensorThreshold()

void SensorLTR553::setLightSensorThreshold ( uint16_t  low,
uint16_t  high 
)
inline

Set ALS threshold window.

If ALS measurement is outside [low, high], interrupt may be asserted depending on IRQ settings.

Parameters
lowLow threshold.
highHigh threshold.

Definition at line 263 of file sensor/light_sensor/SensorLTR553.hpp.

References sensorlib::_highByte(), sensorlib::_lowByte(), REG_ALS_THRES_UP_0, and SensorCommWrapper::writeRegBuff().

Referenced by setup().

◆ setProximityPersists()

void SensorLTR553::setProximityPersists ( uint8_t  count)
inline

Configure PS interrupt persistence count.

Datasheet (REG_INTERRUPT_PERSIST 0x9E):

  • PS Persist bits [7:4]
Parameters
countNumber of consecutive PS out-of-range events before asserting interrupt. count=0 maps to register value 0 (every PS out of range).

Definition at line 365 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_INTERRUPT_PERSIST, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setProximityRate()

void SensorLTR553::setProximityRate ( PsRate  rate)
inline

Set PS measurement rate.

Parameters
rateProximity measurement rate selection.

Definition at line 393 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_MEAS_RATE, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setProximityThreshold()

void SensorLTR553::setProximityThreshold ( uint16_t  low,
uint16_t  high 
)
inline

Set PS threshold window.

Parameters
lowLow threshold (12-bit effective).
highHigh threshold (12-bit effective).

Definition at line 380 of file sensor/light_sensor/SensorLTR553.hpp.

References sensorlib::_lowByte(), REG_PS_THRES_LOW_0, REG_PS_THRES_LOW_1, REG_PS_THRES_UP_0, REG_PS_THRES_UP_1, and SensorCommWrapper::writeReg().

Referenced by setup().

◆ setPsLedCurrent()

void SensorLTR553::setPsLedCurrent ( PsLedCurrent  cur)
inline

Set PS LED peak current (REG_PS_LED bits 2:0).

Parameters
curLED peak current selection.

Definition at line 482 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_LED, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setPsLedDutyCycle()

void SensorLTR553::setPsLedDutyCycle ( PsLedDuty  duty)
inline

Set PS LED duty cycle (REG_PS_LED bits 4:3).

Parameters
dutyLED duty cycle selection.

Definition at line 472 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_LED, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setPsLedPulsePeriod()

void SensorLTR553::setPsLedPulsePeriod ( PsLedPeriod  period)
inline

Set PS LED pulse modulation frequency (REG_PS_LED bits 7:5).

Parameters
periodLED pulse modulation frequency selection.

Definition at line 462 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_LED, and SensorCommWrapper::updateBits().

Referenced by setup().

◆ setPsLedPulses()

void SensorLTR553::setPsLedPulses ( uint8_t  pulesNum)
inline

Set number of PS LED pulses (REG_PS_N_PULSES bits 3:0).

Parameters
pulesNumNumber of pulses (0..15).

Definition at line 492 of file sensor/light_sensor/SensorLTR553.hpp.

References REG_PS_N_PULSES, and SensorCommWrapper::updateBits().

Referenced by setup().

Member Data Documentation

◆ LTR553_DEFAULT_MAN_ID

constexpr uint8_t SensorLTR553::LTR553_DEFAULT_MAN_ID = 0x05
staticconstexprprotected

Default manufacturer ID.

Definition at line 596 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_ALS_CONTR

constexpr uint8_t SensorLTR553::REG_ALS_CONTR = 0x80
staticconstexprprotected

◆ REG_ALS_DATA_CH0_0

constexpr uint8_t SensorLTR553::REG_ALS_DATA_CH0_0 = 0x8A
staticconstexprprotected

Definition at line 577 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by getLightSensor().

◆ REG_ALS_DATA_CH0_1

constexpr uint8_t SensorLTR553::REG_ALS_DATA_CH0_1 = 0x8B
staticconstexprprotected

Definition at line 578 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_ALS_DATA_CH1_0

constexpr uint8_t SensorLTR553::REG_ALS_DATA_CH1_0 = 0x88
staticconstexprprotected

Definition at line 575 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by getLightSensor().

◆ REG_ALS_DATA_CH1_1

constexpr uint8_t SensorLTR553::REG_ALS_DATA_CH1_1 = 0x89
staticconstexprprotected

Definition at line 576 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_ALS_MEAS_RATE

constexpr uint8_t SensorLTR553::REG_ALS_MEAS_RATE = 0x85
staticconstexprprotected

Definition at line 572 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setLightSensorRate().

◆ REG_ALS_PS_STATUS

constexpr uint8_t SensorLTR553::REG_ALS_PS_STATUS = 0x8C
staticconstexprprotected

Definition at line 579 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by getLightSensor(), and psAvailable().

◆ REG_ALS_THRES_LOW_0

constexpr uint8_t SensorLTR553::REG_ALS_THRES_LOW_0 = 0x99
staticconstexprprotected

Definition at line 591 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_ALS_THRES_LOW_1

constexpr uint8_t SensorLTR553::REG_ALS_THRES_LOW_1 = 0x9A
staticconstexprprotected

Definition at line 592 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_ALS_THRES_UP_0

constexpr uint8_t SensorLTR553::REG_ALS_THRES_UP_0 = 0x97
staticconstexprprotected

Definition at line 589 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setLightSensorThreshold().

◆ REG_ALS_THRES_UP_1

constexpr uint8_t SensorLTR553::REG_ALS_THRES_UP_1 = 0x98
staticconstexprprotected

Definition at line 590 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_INTERRUPT

constexpr uint8_t SensorLTR553::REG_INTERRUPT = 0x8F
staticconstexprprotected

Definition at line 582 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by disableIRQ(), enableIRQ(), and setIRQLevel().

◆ REG_INTERRUPT_PERSIST

constexpr uint8_t SensorLTR553::REG_INTERRUPT_PERSIST = 0x9E
staticconstexprprotected

◆ REG_MANUFAC_ID

constexpr uint8_t SensorLTR553::REG_MANUFAC_ID = 0x87
staticconstexprprotected

Definition at line 574 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by getManufacturerID().

◆ REG_PART_ID

constexpr uint8_t SensorLTR553::REG_PART_ID = 0x86
staticconstexprprotected

Definition at line 573 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by getPartID(), and getRevisionID().

◆ REG_PS_CONTR

constexpr uint8_t SensorLTR553::REG_PS_CONTR = 0x81
staticconstexprprotected

◆ REG_PS_DATA_0

constexpr uint8_t SensorLTR553::REG_PS_DATA_0 = 0x8D
staticconstexprprotected

Definition at line 580 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by getProximity().

◆ REG_PS_DATA_1

constexpr uint8_t SensorLTR553::REG_PS_DATA_1 = 0x8E
staticconstexprprotected

Definition at line 581 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_PS_LED

constexpr uint8_t SensorLTR553::REG_PS_LED = 0x82
staticconstexprprotected

◆ REG_PS_MEAS_RATE

constexpr uint8_t SensorLTR553::REG_PS_MEAS_RATE = 0x84
staticconstexprprotected

Definition at line 571 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setProximityRate().

◆ REG_PS_N_PULSES

constexpr uint8_t SensorLTR553::REG_PS_N_PULSES = 0x83
staticconstexprprotected

Definition at line 570 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setPsLedPulses().

◆ REG_PS_OFFSET_0

constexpr uint8_t SensorLTR553::REG_PS_OFFSET_0 = 0x95
staticconstexprprotected

Definition at line 588 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_PS_OFFSET_1

constexpr uint8_t SensorLTR553::REG_PS_OFFSET_1 = 0x94
staticconstexprprotected

Definition at line 587 of file sensor/light_sensor/SensorLTR553.hpp.

◆ REG_PS_THRES_LOW_0

constexpr uint8_t SensorLTR553::REG_PS_THRES_LOW_0 = 0x92
staticconstexprprotected

Definition at line 585 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setProximityThreshold().

◆ REG_PS_THRES_LOW_1

constexpr uint8_t SensorLTR553::REG_PS_THRES_LOW_1 = 0x93
staticconstexprprotected

Definition at line 586 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setProximityThreshold().

◆ REG_PS_THRES_UP_0

constexpr uint8_t SensorLTR553::REG_PS_THRES_UP_0 = 0x90
staticconstexprprotected

Definition at line 583 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setProximityThreshold().

◆ REG_PS_THRES_UP_1

constexpr uint8_t SensorLTR553::REG_PS_THRES_UP_1 = 0x91
staticconstexprprotected

Definition at line 584 of file sensor/light_sensor/SensorLTR553.hpp.

Referenced by setProximityThreshold().


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