|
Adafruit Library
|
Class that stores state and functions for interacting with VL53L0X time-of-flight sensor chips. More...
#include <Adafruit_VL53L0X.h>
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 | |
| boolean | begin (uint8_t i2c_addr=VL53L0X_I2C_ADDR, boolean debug=false, TwoWire *i2c=&Wire, VL53L0X_Sense_config_t vl_config=VL53L0X_SENSE_DEFAULT) |
| Setups the I2C interface and hardware. More... | |
| boolean | setAddress (uint8_t newAddr) |
| Change the I2C address of the sensor. More... | |
| VL53L0X_Error | rangingTest (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false) |
| get a ranging measurement from the device More... | |
| VL53L0X_Error | getSingleRangingMeasurement (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false) |
| get a ranging measurement from the device More... | |
| void | printRangeStatus (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData) |
| print a ranging measurement out via Serial.print in a human-readable format More... | |
| VL53L0X_Error | getRangingMeasurement (VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false) |
| get a ranging measurement from the device More... | |
| VL53L0X_Error | startMeasurement (boolean debug=false) |
| Start the ranging measurement from the device. More... | |
| VL53L0X_Error | stopMeasurement (boolean debug=false) |
| Stop ranging measurement from the device. More... | |
| VL53L0X_Error | getLimitCheckCurrent (uint8_t LimitCheckId, FixPoint1616_t *pLimitCheckCurrent, boolean debug=false) |
| Stop ranging measurement from the device. More... | |
| VL53L0X_Error | getDeviceMode (VL53L0X_DeviceModes *pDeviceMode, boolean debug=false) |
| Get current new device mode. More... | |
| VL53L0X_Error | setDeviceMode (VL53L0X_DeviceModes DeviceMode, boolean debug=false) |
| Set a new device mode. More... | |
| VL53L0X_Error | setInterruptThresholds (FixPoint1616_t ThresholdLow, FixPoint1616_t ThresholdHigh, boolean debug=false) |
| Set low and high Interrupt thresholds. More... | |
| VL53L0X_Error | getInterruptThresholds (FixPoint1616_t *pThresholdLow, FixPoint1616_t *pThresholdHigh, boolean debug=false) |
| Get high and low Interrupt thresholds. More... | |
| VL53L0X_Error | clearInterruptMask (boolean debug=false) |
| Clear system interrupt condition. More... | |
| VL53L0X_Error | getGpioConfig (VL53L0X_DeviceModes *pDeviceMode, VL53L0X_GpioFunctionality *pFunctionality, VL53L0X_InterruptPolarity *pPolarity, boolean debug=false) |
| Get current configuration for GPIO pin 0. More... | |
| VL53L0X_Error | setGpioConfig (VL53L0X_DeviceModes DeviceMode, VL53L0X_GpioFunctionality Functionality, VL53L0X_InterruptPolarity Polarity, boolean debug=false) |
| Set the configuration of GPIO pin 0. More... | |
| uint16_t | readRange (void) |
| Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value! More... | |
| uint8_t | readRangeStatus (void) |
| Request ranging success/error message (retrieve after ranging) More... | |
| boolean | startRange (void) |
| Start a range operation. More... | |
| boolean | isRangeComplete (void) |
| Checks to see if a range operation has completed. More... | |
| boolean | waitRangeComplete (void) |
| Wait until Range operation has completed. More... | |
| uint16_t | readRangeResult (void) |
| Return the range in mm for the last operation. More... | |
| boolean | startRangeContinuous (uint16_t period_ms=50) |
| Start a continuous range operation. More... | |
| void | stopRangeContinuous (void) |
| Stop a continuous ranging operation. | |
| boolean | timeoutOccurred (void) |
| timeout status More... | |
| boolean | configSensor (VL53L0X_Sense_config_t vl_config) |
| Configure the sensor for one of the ways the example ST sketches configure the sensors for different usages. More... | |
| boolean | setMeasurementTimingBudgetMicroSeconds (uint32_t budget_us) |
| Wrapper to ST library code to budget how long a measurement should take. More... | |
| uint32_t | getMeasurementTimingBudgetMicroSeconds (void) |
| Wrapper to ST library code to budget how long a measurement should take. More... | |
| boolean | setVcselPulsePeriod (VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriod) |
| Sets the VCSEL pulse period. More... | |
| uint8_t | getVcselPulsePeriod (VL53L0X_VcselPeriod VcselPeriodType) |
| Gets the VCSEL pulse period. More... | |
| boolean | setLimitCheckEnable (uint16_t LimitCheckId, uint8_t LimitCheckEnable) |
| Enable/Disable a specific limit check. More... | |
| uint8_t | getLimitCheckEnable (uint16_t LimitCheckId) |
| Get specific limit check enable state. More... | |
| boolean | setLimitCheckValue (uint16_t LimitCheckId, FixPoint1616_t LimitCheckValue) |
| Set a specific limit check value. More... | |
| FixPoint1616_t | getLimitCheckValue (uint16_t LimitCheckId) |
| Get a specific limit check value. More... | |
Public Attributes | |
| VL53L0X_Error | Status |
Class that stores state and functions for interacting with VL53L0X time-of-flight sensor chips.
Sensor configurations
| boolean Adafruit_VL53L0X::begin | ( | uint8_t | i2c_addr = VL53L0X_I2C_ADDR, |
| boolean | debug = false, |
||
| TwoWire * | i2c = &Wire, |
||
| VL53L0X_Sense_config_t | vl_config = VL53L0X_SENSE_DEFAULT |
||
| ) |
Setups the I2C interface and hardware.
| i2c_addr | Optional I2C address the sensor can be found on. Default is 0x29 |
| debug | Optional debug flag. If true, debug information will print out via Serial.print during setup. Defaults to false. |
| i2c | Optional I2C bus the sensor is located on. Default is Wire |
| vl_config | Sensor configuration |
| boolean Adafruit_VL53L0X::setAddress | ( | uint8_t | newAddr | ) |
Change the I2C address of the sensor.
| newAddr | the new address to set the sensor to |
|
inline |
get a ranging measurement from the device
| pRangingMeasurementData | the pointer to the struct the data will be stored in |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::getSingleRangingMeasurement | ( | VL53L0X_RangingMeasurementData_t * | RangingMeasurementData, |
| boolean | debug = false |
||
| ) |
get a ranging measurement from the device
| RangingMeasurementData | the pointer to the struct the data will be stored in |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| void Adafruit_VL53L0X::printRangeStatus | ( | VL53L0X_RangingMeasurementData_t * | pRangingMeasurementData | ) |
print a ranging measurement out via Serial.print in a human-readable format
| pRangingMeasurementData | a pointer to the ranging measurement data |
| VL53L0X_Error Adafruit_VL53L0X::getRangingMeasurement | ( | VL53L0X_RangingMeasurementData_t * | RangingMeasurementData, |
| boolean | debug = false |
||
| ) |
get a ranging measurement from the device
| RangingMeasurementData | the pointer to the struct the data will be stored in |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::startMeasurement | ( | boolean | debug = false | ) |
Start the ranging measurement from the device.
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::stopMeasurement | ( | boolean | debug = false | ) |
Stop ranging measurement from the device.
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::getLimitCheckCurrent | ( | uint8_t | LimitCheckId, |
| FixPoint1616_t * | pLimitCheckCurrent, | ||
| boolean | debug = false |
||
| ) |
Stop ranging measurement from the device.
| LimitCheckId | Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). |
| pLimitCheckCurrent | Pointer to current Value for a given LimitCheckId. |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::getDeviceMode | ( | VL53L0X_DeviceModes * | pDeviceMode, |
| boolean | debug = false |
||
| ) |
Get current new device mode.
| pDeviceMode | Pointer to current apply mode value |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::setDeviceMode | ( | VL53L0X_DeviceModes | DeviceMode, |
| boolean | debug = false |
||
| ) |
Set a new device mode.
| DeviceMode | New device mode to apply Valid values are: VL53L0X_DEVICEMODE_SINGLE_RANGING VL53L0X_DEVICEMODE_CONTINUOUS_RANGING VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY VL53L0X_HISTOGRAMMODE_RETURN_ONLY VL53L0X_HISTOGRAMMODE_BOTH |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::setInterruptThresholds | ( | FixPoint1616_t | ThresholdLow, |
| FixPoint1616_t | ThresholdHigh, | ||
| boolean | debug = false |
||
| ) |
Set low and high Interrupt thresholds.
| ThresholdLow | Low threshold (mm, lux ..., depending on the mode) |
| ThresholdHigh | High threshold (mm, lux ..., depending on the mode) |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::getInterruptThresholds | ( | FixPoint1616_t * | pThresholdLow, |
| FixPoint1616_t * | pThresholdHigh, | ||
| boolean | debug = false |
||
| ) |
Get high and low Interrupt thresholds.
| pThresholdLow | Low threshold (mm, lux ..., depending on the mode) |
| pThresholdHigh | High threshold (mm, lux ..., depending on the mode) |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::clearInterruptMask | ( | boolean | debug = false | ) |
Clear system interrupt condition.
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::getGpioConfig | ( | VL53L0X_DeviceModes * | pDeviceMode, |
| VL53L0X_GpioFunctionality * | pFunctionality, | ||
| VL53L0X_InterruptPolarity * | pPolarity, | ||
| boolean | debug = false |
||
| ) |
Get current configuration for GPIO pin 0.
| pDeviceMode | Pointer to Device Mode associated to the Gpio. |
| pFunctionality | Pointer to Pin functionality. |
| pPolarity | Pointer to interrupt polarity. Active high or active low. |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| VL53L0X_Error Adafruit_VL53L0X::setGpioConfig | ( | VL53L0X_DeviceModes | DeviceMode, |
| VL53L0X_GpioFunctionality | Functionality, | ||
| VL53L0X_InterruptPolarity | Polarity, | ||
| boolean | debug = false |
||
| ) |
Set the configuration of GPIO pin 0.
| DeviceMode | Device Mode associated to the Gpio. |
| Functionality | Select Pin functionality. |
| Polarity | Set interrupt polarity. Active high or active low. |
| debug | Optional debug flag. If true debug information will print via Serial.print during execution. Defaults to false. |
| uint16_t Adafruit_VL53L0X::readRange | ( | void | ) |
Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value!
| uint8_t Adafruit_VL53L0X::readRangeStatus | ( | void | ) |
Request ranging success/error message (retrieve after ranging)
| boolean Adafruit_VL53L0X::startRange | ( | void | ) |
Start a range operation.
| boolean Adafruit_VL53L0X::isRangeComplete | ( | void | ) |
Checks to see if a range operation has completed.
| boolean Adafruit_VL53L0X::waitRangeComplete | ( | void | ) |
Wait until Range operation has completed.
| uint16_t Adafruit_VL53L0X::readRangeResult | ( | void | ) |
Return the range in mm for the last operation.
| boolean Adafruit_VL53L0X::startRangeContinuous | ( | uint16_t | period_ms = 50 | ) |
Start a continuous range operation.
| period_ms | inter measurement period in milliseconds |
|
inline |
timeout status
| boolean Adafruit_VL53L0X::configSensor | ( | VL53L0X_Sense_config_t | vl_config | ) |
Configure the sensor for one of the ways the example ST sketches configure the sensors for different usages.
| vl_config | Which configureation you are trying to configure for It should be one of the following VL53L0X_SENSE_DEFAULT VL53L0X_SENSE_LONG_RANGE VL53L0X_SENSE_HIGH_SPEED, VL53L0X_SENSE_HIGH_ACCURACY |
| boolean Adafruit_VL53L0X::setMeasurementTimingBudgetMicroSeconds | ( | uint32_t | budget_us | ) |
Wrapper to ST library code to budget how long a measurement should take.
| budget_us | the new budget |
| uint32_t Adafruit_VL53L0X::getMeasurementTimingBudgetMicroSeconds | ( | void | ) |
Wrapper to ST library code to budget how long a measurement should take.
| boolean Adafruit_VL53L0X::setVcselPulsePeriod | ( | VL53L0X_VcselPeriod | VcselPeriodType, |
| uint8_t | VCSELPulsePeriod | ||
| ) |
Sets the VCSEL pulse period.
| VcselPeriodType | VCSEL period identifier (pre-range|final). |
| VCSELPulsePeriod | VCSEL period value |
| uint8_t Adafruit_VL53L0X::getVcselPulsePeriod | ( | VL53L0X_VcselPeriod | VcselPeriodType | ) |
Gets the VCSEL pulse period.
| VcselPeriodType | VCSEL period identifier (pre-range|final). |
| boolean Adafruit_VL53L0X::setLimitCheckEnable | ( | uint16_t | LimitCheckId, |
| uint8_t | LimitCheckEnable | ||
| ) |
Enable/Disable a specific limit check.
| LimitCheckId | Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). |
| LimitCheckEnable | if 1 the check limit corresponding to LimitCheckId is Enabled if 0 the check limit corresponding to LimitCheckId is disabled |
| uint8_t Adafruit_VL53L0X::getLimitCheckEnable | ( | uint16_t | LimitCheckId | ) |
Get specific limit check enable state.
| LimitCheckId | Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). |
| boolean Adafruit_VL53L0X::setLimitCheckValue | ( | uint16_t | LimitCheckId, |
| FixPoint1616_t | LimitCheckValue | ||
| ) |
Set a specific limit check value.
| LimitCheckId | Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). LimitCheckId |
| LimitCheckValue | Limit Check Value |
| FixPoint1616_t Adafruit_VL53L0X::getLimitCheckValue | ( | uint16_t | LimitCheckId | ) |
Get a specific limit check value.
| LimitCheckId | Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). |
| VL53L0X_Error Adafruit_VL53L0X::Status |
indicates whether or not the sensor has encountered an error
1.8.13