22 #ifndef ADAFRUIT_VL53L0X_H 23 #define ADAFRUIT_VL53L0X_H 32 #include "vl53l0x_api.h" 34 #define VL53L0X_I2C_ADDR 0x29 46 VL53L0X_SENSE_DEFAULT = 0,
47 VL53L0X_SENSE_LONG_RANGE,
48 VL53L0X_SENSE_HIGH_SPEED,
49 VL53L0X_SENSE_HIGH_ACCURACY
54 VL53L0X_Sense_config_t vl_config = VL53L0X_SENSE_DEFAULT);
70 rangingTest(VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
71 boolean debug =
false) {
76 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
77 boolean debug =
false);
82 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
83 boolean debug =
false);
87 FixPoint1616_t *pLimitCheckCurrent,
88 boolean debug =
false);
90 boolean debug =
false);
92 boolean debug =
false);
95 FixPoint1616_t ThresholdHigh,
96 boolean debug =
false);
98 FixPoint1616_t *pThresholdHigh,
99 boolean debug =
false);
102 VL53L0X_Error
getGpioConfig(VL53L0X_DeviceModes *pDeviceMode,
103 VL53L0X_GpioFunctionality *pFunctionality,
104 VL53L0X_InterruptPolarity *pPolarity,
105 boolean debug =
false);
107 VL53L0X_GpioFunctionality Functionality,
108 VL53L0X_InterruptPolarity Polarity,
109 boolean debug =
false);
146 uint8_t VCSELPulsePeriod);
153 FixPoint1616_t LimitCheckValue);
157 VL53L0X_Dev_t MyDevice;
158 VL53L0X_Dev_t *pMyDevice = &MyDevice;
159 VL53L0X_DeviceInfo_t DeviceInfo;
161 uint8_t _rangeStatus;
boolean setVcselPulsePeriod(VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriod)
Sets the VCSEL pulse period.
Definition: Adafruit_VL53L0X.cpp:885
boolean setAddress(uint8_t newAddr)
Change the I2C address of the sensor.
Definition: Adafruit_VL53L0X.cpp:194
boolean setLimitCheckValue(uint16_t LimitCheckId, FixPoint1616_t LimitCheckValue)
Set a specific limit check value.
Definition: Adafruit_VL53L0X.cpp:953
VL53L0X_Error getRangingMeasurement(VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
get a ranging measurement from the device
Definition: Adafruit_VL53L0X.cpp:628
boolean startRange(void)
Start a range operation.
Definition: Adafruit_VL53L0X.cpp:723
boolean startRangeContinuous(uint16_t period_ms=50)
Start a continuous range operation.
Definition: Adafruit_VL53L0X.cpp:791
boolean isRangeComplete(void)
Checks to see if a range operation has completed.
Definition: Adafruit_VL53L0X.cpp:744
uint16_t readRangeResult(void)
Return the range in mm for the last operation.
Definition: Adafruit_VL53L0X.cpp:770
VL53L0X_Error setDeviceMode(VL53L0X_DeviceModes DeviceMode, boolean debug=false)
Set a new device mode.
Definition: Adafruit_VL53L0X.cpp:448
uint16_t readRange(void)
Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value!...
Definition: Adafruit_VL53L0X.cpp:695
boolean setMeasurementTimingBudgetMicroSeconds(uint32_t budget_us)
Wrapper to ST library code to budget how long a measurement should take.
Definition: Adafruit_VL53L0X.cpp:856
boolean timeoutOccurred(void)
timeout status
Definition: Adafruit_VL53L0X.h:135
uint8_t getVcselPulsePeriod(VL53L0X_VcselPeriod VcselPeriodType)
Gets the VCSEL pulse period.
Definition: Adafruit_VL53L0X.cpp:901
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.
Definition: Adafruit_VL53L0X.cpp:57
void stopRangeContinuous(void)
Stop a continuous ranging operation.
Definition: Adafruit_VL53L0X.cpp:815
VL53L0X_Error getInterruptThresholds(FixPoint1616_t *pThresholdLow, FixPoint1616_t *pThresholdHigh, boolean debug=false)
Get high and low Interrupt thresholds.
Definition: Adafruit_VL53L0X.cpp:500
Class that stores state and functions for interacting with VL53L0X time-of-flight sensor chips...
Definition: Adafruit_VL53L0X.h:42
VL53L0X_Error setInterruptThresholds(FixPoint1616_t ThresholdLow, FixPoint1616_t ThresholdHigh, boolean debug=false)
Set low and high Interrupt thresholds.
Definition: Adafruit_VL53L0X.cpp:471
uint32_t getMeasurementTimingBudgetMicroSeconds(void)
Wrapper to ST library code to budget how long a measurement should take.
Definition: Adafruit_VL53L0X.cpp:868
VL53L0X_Error setGpioConfig(VL53L0X_DeviceModes DeviceMode, VL53L0X_GpioFunctionality Functionality, VL53L0X_InterruptPolarity Polarity, boolean debug=false)
Set the configuration of GPIO pin 0.
Definition: Adafruit_VL53L0X.cpp:572
VL53L0X_Error getSingleRangingMeasurement(VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
get a ranging measurement from the device
Definition: Adafruit_VL53L0X.cpp:328
VL53L0X_Error Status
Definition: Adafruit_VL53L0X.h:111
VL53L0X_Sense_config_t
Definition: Adafruit_VL53L0X.h:45
boolean waitRangeComplete(void)
Wait until Range operation has completed.
Definition: Adafruit_VL53L0X.cpp:757
VL53L0X_Error rangingTest(VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, boolean debug=false)
get a ranging measurement from the device
Definition: Adafruit_VL53L0X.h:70
VL53L0X_Error startMeasurement(boolean debug=false)
Start the ranging measurement from the device.
Definition: Adafruit_VL53L0X.cpp:371
#define VL53L0X_I2C_ADDR
Default sensor I2C address.
Definition: Adafruit_VL53L0X.h:34
VL53L0X_Error stopMeasurement(boolean debug=false)
Stop ranging measurement from the device.
Definition: Adafruit_VL53L0X.cpp:392
uint8_t readRangeStatus(void)
Request ranging success/error message (retrieve after ranging)
Definition: Adafruit_VL53L0X.cpp:714
VL53L0X_Error getGpioConfig(VL53L0X_DeviceModes *pDeviceMode, VL53L0X_GpioFunctionality *pFunctionality, VL53L0X_InterruptPolarity *pPolarity, boolean debug=false)
Get current configuration for GPIO pin 0.
Definition: Adafruit_VL53L0X.cpp:600
VL53L0X_Error getLimitCheckCurrent(uint8_t LimitCheckId, FixPoint1616_t *pLimitCheckCurrent, boolean debug=false)
Stop ranging measurement from the device.
Definition: Adafruit_VL53L0X.cpp:415
FixPoint1616_t getLimitCheckValue(uint16_t LimitCheckId)
Get a specific limit check value.
Definition: Adafruit_VL53L0X.cpp:968
VL53L0X_Error getDeviceMode(VL53L0X_DeviceModes *pDeviceMode, boolean debug=false)
Get current new device mode.
Definition: Adafruit_VL53L0X.cpp:528
VL53L0X_Error clearInterruptMask(boolean debug=false)
Clear system interrupt condition.
Definition: Adafruit_VL53L0X.cpp:549
void printRangeStatus(VL53L0X_RangingMeasurementData_t *pRangingMeasurementData)
print a ranging measurement out via Serial.print in a human-readable format
Definition: Adafruit_VL53L0X.cpp:667
uint8_t getLimitCheckEnable(uint16_t LimitCheckId)
Get specific limit check enable state.
Definition: Adafruit_VL53L0X.cpp:935
boolean setLimitCheckEnable(uint16_t LimitCheckId, uint8_t LimitCheckEnable)
Enable/Disable a specific limit check.
Definition: Adafruit_VL53L0X.cpp:920
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 ...
Definition: Adafruit_VL53L0X.cpp:222