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

Class that stores state and functions for interacting with VL53L0X time-of-flight sensor chips. More...

#include <Adafruit_VL53L0X.hpp>

Public Types

enum  VL53L0X_Sense_config_t { VL53L0X_SENSE_DEFAULT = 0 , VL53L0X_SENSE_LONG_RANGE , VL53L0X_SENSE_HIGH_SPEED , VL53L0X_SENSE_HIGH_ACCURACY }

Public Member Functions

 Adafruit_VL53L0X (TwoWire &, uint8_t i2cAddr=VL53L0X_I2C_ADDR)
 Bind the I2C bus and initial 7-bit address. Call begin() before ranging.
boolean begin (VL53L0X_Sense_config_t vl_config=VL53L0X_SENSE_DEFAULT, boolean debug=false)
 Initialize the bus and sensor with a ranging preset.
boolean setAddress (uint8_t newAddr)
 Change the sensor I2C address; return true on success.
VL53L0X_Error rangingTest (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
 get a ranging measurement from the device
VL53L0X_Error getSingleRangingMeasurement (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
 Perform a blocking single measurement into pRangingMeasurementData.
void printRangeStatus (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData)
 Print a human-readable interpretation of the supplied measurement RangeStatus.
VL53L0X_Error getRangingMeasurement (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
 Read a measurement into caller storage; return ST API status.
VL53L0X_Error startMeasurement (boolean debug=false)
 Start measurement using the configured device mode; return ST status.
VL53L0X_Error stopMeasurement (boolean debug=false)
 Stop measurement using the ST API; return ST status.
VL53L0X_Error getLimitCheckCurrent (uint8_t LimitCheckId, FixPoint1616_t *pLimitCheckCurrent, boolean debug=false)
 Read the selected limit-check result into a 16.16 fixed-point output; return ST status.
VL53L0X_Error getDeviceMode (VL53L0X_DeviceModes *pDeviceMode, boolean debug=false)
 Read the device mode into pDeviceMode; return ST status.
VL53L0X_Error setDeviceMode (VL53L0X_DeviceModes DeviceMode, boolean debug=false)
 Set the ST device mode; return ST status.
VL53L0X_Error setInterruptThresholds (FixPoint1616_t ThresholdLow, FixPoint1616_t ThresholdHigh, boolean debug=false)
 Set low/high interrupt thresholds in ST 16.16 distance format; return ST status.
VL53L0X_Error getInterruptThresholds (FixPoint1616_t *pThresholdLow, FixPoint1616_t *pThresholdHigh, boolean debug=false)
 Read low/high ST 16.16 interrupt thresholds into caller storage; return ST status.
VL53L0X_Error clearInterruptMask (boolean debug=false)
 Clear the sensor interrupt mask; return ST status.
VL53L0X_Error getGpioConfig (VL53L0X_DeviceModes *pDeviceMode, VL53L0X_GpioFunctionality *pFunctionality, VL53L0X_InterruptPolarity *pPolarity, boolean debug=false)
 Read device mode, GPIO function, and polarity into caller storage; return ST status.
VL53L0X_Error setGpioConfig (VL53L0X_DeviceModes DeviceMode, VL53L0X_GpioFunctionality Functionality, VL53L0X_InterruptPolarity Polarity, boolean debug=false)
 Configure the interrupt GPIO function/polarity for DeviceMode; return ST status.
uint16_t readRange (void)
 Perform a single-shot measurement; return millimeters or 0xFFFF on API error. Check readRangeStatus() before using the distance.
uint8_t readRangeStatus (void)
 Return the last cached measurement RangeStatus (zero indicates a valid range).
boolean startRange (void)
 Start a nonblocking single range; return true on API success.
boolean isRangeComplete (void)
 Return true when data is ready or an API error occurred; inspect Status.
boolean waitRangeComplete (void)
 Wait for measurement readiness; return false on API error.
uint16_t readRangeResult (void)
 Read completed range in millimeters, or 0xFFFF on API error; check readRangeStatus().
boolean startRangeContinuous (uint16_t period_ms=50)
 Start continuous ranging with period_ms between measurements; return true on success.
void stopRangeContinuous (void)
 Stop continuous ranging and update Status.
boolean timeoutOccurred (void)
 timeout status
boolean configSensor (VL53L0X_Sense_config_t vl_config)
 Apply a ranging preset; return true on API success.
boolean setMeasurementTimingBudgetMicroSeconds (uint32_t budget_us)
 Set the measurement timing budget in microseconds; return true on success.
uint32_t getMeasurementTimingBudgetMicroSeconds (void)
 Return the measurement timing budget in microseconds; inspect Status for API errors.
boolean setVcselPulsePeriod (VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriod)
 Set the selected VCSEL pulse period in PCLK units; return true on success.
uint8_t getVcselPulsePeriod (VL53L0X_VcselPeriod VcselPeriodType)
 Return the selected VCSEL pulse period in PCLK units; inspect Status for errors.
boolean setLimitCheckEnable (uint16_t LimitCheckId, uint8_t LimitCheckEnable)
 Enable/disable the specified ST limit check; return true on success.
uint8_t getLimitCheckEnable (uint16_t LimitCheckId)
 Return the selected limit-check enable value; inspect Status for API errors.
boolean setLimitCheckValue (uint16_t LimitCheckId, FixPoint1616_t LimitCheckValue)
 Set the selected ST limit threshold in 16.16 fixed-point format; return true on success.
FixPoint1616_t getLimitCheckValue (uint16_t LimitCheckId)
 Return the selected ST limit threshold in 16.16 format; inspect Status for errors.

Public Attributes

VL53L0X_Error Status

Detailed Description

Class that stores state and functions for interacting with VL53L0X time-of-flight sensor chips.

Member Enumeration Documentation

◆ VL53L0X_Sense_config_t

Sensor configurations

50 {
51 VL53L0X_SENSE_DEFAULT = 0,
52 VL53L0X_SENSE_LONG_RANGE,
53 VL53L0X_SENSE_HIGH_SPEED,
54 VL53L0X_SENSE_HIGH_ACCURACY
VL53L0X_Sense_config_t
Definition Adafruit_VL53L0X.hpp:50

Member Function Documentation

◆ begin()

boolean Adafruit_VL53L0X::begin ( VL53L0X_Sense_config_t vl_config = VL53L0X_SENSE_DEFAULT,
boolean debug = false )

Initialize the bus and sensor with a ranging preset.

Parameters
vl_configDefault, long-range, high-speed, or high-accuracy preset.
debugEnable diagnostic printing.
Returns
True on successful initialization; false on API failure.

◆ getSingleRangingMeasurement()

VL53L0X_Error Adafruit_VL53L0X::getSingleRangingMeasurement ( VL53L0X_RangingMeasurementData_t * pRangingMeasurementData,
boolean debug = false )

Perform a blocking single measurement into pRangingMeasurementData.

Returns
ST status (VL53L0X_ERROR_NONE on success); inspect the result RangeStatus too.

◆ rangingTest()

VL53L0X_Error Adafruit_VL53L0X::rangingTest ( VL53L0X_RangingMeasurementData_t * pRangingMeasurementData,
boolean debug = false )
inline

get a ranging measurement from the device

Parameters
pRangingMeasurementDatathe pointer to the struct the data will be stored in
debugOptional debug flag. If true debug information will print via Serial.print during execution. Defaults to false.
Returns
ST API status: VL53L0X_ERROR_NONE on success.
84 {
85 return getSingleRangingMeasurement(pRangingMeasurementData, debug);
86 };
VL53L0X_Error getSingleRangingMeasurement(VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
Perform a blocking single measurement into pRangingMeasurementData.

◆ timeoutOccurred()

boolean Adafruit_VL53L0X::timeoutOccurred ( void )
inline

timeout status

Returns
Always false; timeout tracking is not implemented.
213{ return false; }

Member Data Documentation

◆ Status

VL53L0X_Error Adafruit_VL53L0X::Status
Initial value:
=
VL53L0X_ERROR_NONE

indicates whether or not the sensor has encountered an error


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