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>
|
| enum class | RangingMode { Continuous
, Autonomous
} |
| | Continuous or autonomous sensor ranging mode. More...
|
|
|
| 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.
|
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.
◆ RangingMode
Continuous or autonomous sensor ranging mode.
28{ Continuous, Autonomous };
◆ 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
-
| ready | Set false first, then updated from the sensor on success. |
- Returns
- ST status; requires initialization and active ranging.
◆ 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.
◆ getIntegrationTimeMs()
| uint8_t VL53L5CX::getIntegrationTimeMs |
( |
uint32_t & | ms | ) |
|
Read integration time after initialization.
- Parameters
-
| ms | Output integration time in milliseconds. |
- Returns
- ST status.
◆ getRangingData()
Read a frame while ranging; call checkDataReady() first.
- Parameters
-
| results | Caller-owned result storage populated by the ST API. |
- Returns
- ST status.
◆ getRangingMode()
Read the ranging mode after initialization.
- Parameters
-
| mode | Output 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
-
| address | New 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
-
| ms | Sensor-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
-
| frequency | Sensor-supported frequency for the selected resolution and mode. |
- Returns
- ST status from the underlying API.
◆ setRangingMode()
Select continuous or autonomous operation while initialized and stopped.
- Parameters
-
- 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
-
| resolution | VL53L5CX_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: