Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
VL53L5CX Class Reference

VL53L5CX multi-zone time-of-flight sensor wrapper. Call begin(), configure while stopped, then startRanging(). Poll checkDataReady() before getRangingData(). Status-returning methods use ST codes (0 = success). Keep this object and VL53L5CX_ResultsData in static storage on embedded targets. More...

#include <VL53L5CX.hpp>

Public Types

enum class  RangingMode { Continuous , Autonomous }
 Continuous or autonomous sensor ranging mode. More...

Public Member Functions

 VL53L5CX (TwoWire &wire, uint8_t address=0x29)
 Bind the I2C bus and initial 7-bit address (default 0x29).
 VL53L5CX (const VL53L5CX &)=delete
 Copying is disabled because configuration contains transport state.
VL53L5CX & operator= (const VL53L5CX &)=delete
 Copy assignment is disabled because configuration contains transport state.
uint8_t begin ()
 Initialize the bus, probe and load sensor firmware, then select continuous mode.
uint8_t setAddress (uint8_t address)
 Change the sensor and host address while initialized and stopped.
uint8_t setResolution (uint8_t resolution)
 Set the zone resolution while initialized and stopped.
uint8_t setRangingFrequencyHz (uint8_t frequency)
 Set frame frequency in hertz while initialized and stopped.
uint8_t setRangingMode (RangingMode mode)
 Select continuous or autonomous operation while initialized and stopped.
uint8_t getRangingMode (RangingMode &mode)
 Read the ranging mode after initialization.
uint8_t setIntegrationTimeMs (uint32_t ms)
 Set integration time in milliseconds while initialized and stopped.
uint8_t getIntegrationTimeMs (uint32_t &ms)
 Read integration time after initialization.
uint32_t getTransportRetryCount () const
 Return the sum of transport read retries and firmware-write retries.
uint8_t startRanging ()
 Start measurements after initialization while stopped.
uint8_t stopRanging ()
 Stop measurements after initialization.
uint8_t checkDataReady (bool &ready)
 Poll for a new frame while ranging.
uint8_t getRangingData (VL53L5CX_ResultsData &results)
 Read a frame while ranging; call checkDataReady() first.
VL53L5CX_Configuration * configuration ()
 Return a borrowed pointer to the raw ST configuration. Callers must obey ST sequencing rules and keep wrapper state consistent; changes through this pointer bypass the wrapper checks.

Detailed Description

VL53L5CX multi-zone time-of-flight sensor wrapper. Call begin(), configure while stopped, then startRanging(). Poll checkDataReady() before getRangingData(). Status-returning methods use ST codes (0 = success). Keep this object and VL53L5CX_ResultsData in static storage on embedded targets.

Member Enumeration Documentation

◆ RangingMode

enum class VL53L5CX::RangingMode
strong

Continuous or autonomous sensor ranging mode.

28{ Continuous, Autonomous };

Member Function Documentation

◆ begin()

uint8_t VL53L5CX::begin ( )

Initialize the bus, probe and load sensor firmware, then select continuous mode.

Returns
ST status; an invalid address or active ranging prevents initialization.

◆ checkDataReady()

uint8_t VL53L5CX::checkDataReady ( bool & ready)

Poll for a new frame while ranging.

Parameters
readySet false first, then updated from the sensor on success.
Returns
ST status; requires initialization and active ranging.

◆ configuration()

VL53L5CX_Configuration * VL53L5CX::configuration ( )
inline

Return a borrowed pointer to the raw ST configuration. Callers must obey ST sequencing rules and keep wrapper state consistent; changes through this pointer bypass the wrapper checks.

122{ return &config; }

◆ getIntegrationTimeMs()

uint8_t VL53L5CX::getIntegrationTimeMs ( uint32_t & ms)

Read integration time after initialization.

Parameters
msOutput integration time in milliseconds.
Returns
ST status.

◆ getRangingData()

uint8_t VL53L5CX::getRangingData ( VL53L5CX_ResultsData & results)

Read a frame while ranging; call checkDataReady() first.

Parameters
resultsCaller-owned result storage populated by the ST API.
Returns
ST status.

◆ getRangingMode()

uint8_t VL53L5CX::getRangingMode ( RangingMode & mode)

Read the ranging mode after initialization.

Parameters
modeOutput updated on success.
Returns
ST status.

◆ getTransportRetryCount()

uint32_t VL53L5CX::getTransportRetryCount ( ) const
inline

Return the sum of transport read retries and firmware-write retries.

91 {
92 return config.platform.readRetries + config.platform.firmwareWriteRetries;
93 }

◆ setAddress()

uint8_t VL53L5CX::setAddress ( uint8_t address)

Change the sensor and host address while initialized and stopped.

Parameters
addressNew 7-bit address from 0x08 through 0x77.
Returns
ST status; the host address changes only after the sensor accepts it.

◆ setIntegrationTimeMs()

uint8_t VL53L5CX::setIntegrationTimeMs ( uint32_t ms)

Set integration time in milliseconds while initialized and stopped.

Parameters
msSensor-supported integration time.
Returns
ST status from the underlying API.

◆ setRangingFrequencyHz()

uint8_t VL53L5CX::setRangingFrequencyHz ( uint8_t frequency)

Set frame frequency in hertz while initialized and stopped.

Parameters
frequencySensor-supported frequency for the selected resolution and mode.
Returns
ST status from the underlying API.

◆ setRangingMode()

uint8_t VL53L5CX::setRangingMode ( RangingMode mode)

Select continuous or autonomous operation while initialized and stopped.

Parameters
modeRanging mode.
Returns
ST status; invalid enum values are rejected.

◆ setResolution()

uint8_t VL53L5CX::setResolution ( uint8_t resolution)

Set the zone resolution while initialized and stopped.

Parameters
resolutionVL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8.
Returns
ST status.

◆ startRanging()

uint8_t VL53L5CX::startRanging ( )

Start measurements after initialization while stopped.

Returns
ST status; the local ranging flag is set only on success.

◆ stopRanging()

uint8_t VL53L5CX::stopRanging ( )

Stop measurements after initialization.

Returns
ST status; the local ranging flag is cleared only on success.

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