Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vl53l1x_api.c File Reference

Functions implementation. More...

#include "vl53l1x_api.h"
#include <string.h>
+ Include dependency graph for vl53l1x_api.c:

Go to the source code of this file.

Functions

VL53L1X_ERROR VL53L1X_GetSWVersion (VL53L1X_Version_t *pVersion)
 This function returns the SW driver version. More...
 
VL53L1X_ERROR VL53L1X_SetI2CAddress (VL53L1_DEV dev, uint8_t new_address)
 This function sets the sensor I2C address used in case multiple devices application, default address 0x52. More...
 
VL53L1X_ERROR VL53L1X_SensorInit (VL53L1_DEV dev)
 This function loads the 135 bytes default values to initialize the sensor. More...
 
void VL53L1X_BootDevice (VL53L1_DEV dev, uint16_t TimingBudgetInMs, uint16_t DistanceMode, uint32_t InterMeasurementInMs)
 Implement boot sequence of VL53L1 device as described in documentation See VL53L1X_SetTimingBudgetInMs, VL53L1X_SetDistanceMode and VL53L1X_SetInterMeasurementInMs for params details. More...
 
VL53L1X_ERROR VL53L1X_ClearInterrupt (VL53L1_DEV dev)
 This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event. More...
 
VL53L1X_ERROR VL53L1X_SetInterruptPolarity (VL53L1_DEV dev, uint8_t NewPolarity)
 This function programs the interrupt polarity
1=active high (default), 0=active low. More...
 
VL53L1X_ERROR VL53L1X_GetInterruptPolarity (VL53L1_DEV dev, uint8_t *pInterruptPolarity)
 This function returns the current interrupt polarity
1=active high (default), 0=active low. More...
 
VL53L1X_ERROR VL53L1X_StartRanging (VL53L1_DEV dev)
 This function starts the ranging distance operation
The ranging operation is continuous. More...
 
VL53L1X_ERROR VL53L1X_StopRanging (VL53L1_DEV dev)
 This function stops the ranging. More...
 
VL53L1X_ERROR VL53L1X_CheckForDataReady (VL53L1_DEV dev, uint8_t *isDataReady)
 This function checks if the new ranging data is available by polling the dedicated register. More...
 
VL53L1X_ERROR VL53L1X_SetTimingBudgetInMs (VL53L1_DEV dev, uint16_t TimingBudgetInMs)
 This function programs the timing budget in ms. More...
 
VL53L1X_ERROR VL53L1X_GetTimingBudgetInMs (VL53L1_DEV dev, uint16_t *pTimingBudget)
 This function returns the current timing budget in ms. More...
 
VL53L1X_ERROR VL53L1X_SetDistanceMode (VL53L1_DEV dev, uint16_t DM)
 This function programs the distance mode (1=short, 2=long(default)). More...
 
VL53L1X_ERROR VL53L1X_GetDistanceMode (VL53L1_DEV dev, uint16_t *DM)
 This function returns the current distance mode (1=short, 2=long). More...
 
VL53L1X_ERROR VL53L1X_SetInterMeasurementInMs (VL53L1_DEV dev, uint32_t InterMeasMs)
 This function programs the Intermeasurement period in ms
Intermeasurement period must be >/= timing budget. More...
 
VL53L1X_ERROR VL53L1X_GetInterMeasurementInMs (VL53L1_DEV dev, uint16_t *pIM)
 This function returns the Intermeasurement period in ms. More...
 
VL53L1X_ERROR VL53L1X_BootState (VL53L1_DEV dev, uint8_t *state)
 This function returns the boot state of the device (1:booted, 0:not booted) More...
 
VL53L1X_ERROR VL53L1X_GetSensorId (VL53L1_DEV dev, uint16_t *sensorId)
 This function returns the sensor id, sensor Id must be 0xEEAC. More...
 
VL53L1X_ERROR VL53L1X_GetDistance (VL53L1_DEV dev, uint16_t *distance)
 This function returns the distance measured by the sensor in mm. More...
 
VL53L1X_ERROR VL53L1X_GetSignalPerSpad (VL53L1_DEV dev, uint16_t *signalRate)
 This function returns the returned signal per SPAD in kcps/SPAD. More...
 
VL53L1X_ERROR VL53L1X_GetAmbientPerSpad (VL53L1_DEV dev, uint16_t *ambPerSp)
 This function returns the ambient per SPAD in kcps/SPAD. More...
 
VL53L1X_ERROR VL53L1X_GetSignalRate (VL53L1_DEV dev, uint16_t *signal)
 This function returns the returned signal in kcps. More...
 
VL53L1X_ERROR VL53L1X_GetSpadNb (VL53L1_DEV dev, uint16_t *spNb)
 This function returns the current number of enabled SPADs. More...
 
VL53L1X_ERROR VL53L1X_GetAmbientRate (VL53L1_DEV dev, uint16_t *ambRate)
 This function returns the ambient rate in kcps. More...
 
VL53L1X_ERROR VL53L1X_GetRangeStatus (VL53L1_DEV dev, uint8_t *rangeStatus)
 This function returns the ranging status error
(0:no error, 1:sigma failed, 2:signal failed, ..., 7:wrap-around) More...
 
VL53L1X_ERROR VL53L1X_GetResult (VL53L1_DEV dev, VL53L1X_Result_t *pResult)
 This function returns measurements and the range status in a single read access. More...
 
VL53L1X_ERROR VL53L1X_SetOffset (VL53L1_DEV dev, int16_t OffsetValue)
 This function programs the offset correction in mm. More...
 
VL53L1X_ERROR VL53L1X_GetOffset (VL53L1_DEV dev, int16_t *offset)
 This function returns the programmed offset correction value in mm. More...
 
VL53L1X_ERROR VL53L1X_SetXtalk (VL53L1_DEV dev, uint16_t XtalkValue)
 This function programs the xtalk correction value in cps (Count Per Second). More...
 
VL53L1X_ERROR VL53L1X_GetXtalk (VL53L1_DEV dev, uint16_t *xtalk)
 This function returns the current programmed xtalk correction value in cps. More...
 
VL53L1X_ERROR VL53L1X_SetDistanceThreshold (VL53L1_DEV dev, uint16_t ThreshLow, uint16_t ThreshHigh, uint8_t Window, uint8_t IntOnNoTarget)
 This function programs the threshold detection mode
Example:
VL53L1X_SetDistanceThreshold(dev,100,300,0,1): Below 100
VL53L1X_SetDistanceThreshold(dev,100,300,1,1): Above 300
VL53L1X_SetDistanceThreshold(dev,100,300,2,1): Out of window
VL53L1X_SetDistanceThreshold(dev,100,300,3,1): In window
. More...
 
VL53L1X_ERROR VL53L1X_GetDistanceThresholdWindow (VL53L1_DEV dev, uint16_t *window)
 This function returns the window detection mode (0=below; 1=above; 2=out; 3=in) More...
 
VL53L1X_ERROR VL53L1X_GetDistanceThresholdLow (VL53L1_DEV dev, uint16_t *low)
 This function returns the low threshold in mm. More...
 
VL53L1X_ERROR VL53L1X_GetDistanceThresholdHigh (VL53L1_DEV dev, uint16_t *high)
 This function returns the high threshold in mm. More...
 
VL53L1X_ERROR VL53L1X_SetROICenter (VL53L1_DEV dev, uint8_t ROICenter)
 This function programs the new user ROI center, please to be aware that there is no check in this function. More...
 
VL53L1X_ERROR VL53L1X_GetROICenter (VL53L1_DEV dev, uint8_t *ROICenter)
 This function returns the current user ROI center. More...
 
VL53L1X_ERROR VL53L1X_SetROI (VL53L1_DEV dev, uint16_t X, uint16_t Y)
 This function programs the ROI (Region of Interest)
The ROI position is centered, only the ROI size can be reprogrammed. More...
 
VL53L1X_ERROR VL53L1X_GetROI_XY (VL53L1_DEV dev, uint16_t *ROI_X, uint16_t *ROI_Y)
 This function returns width X and height Y. More...
 
VL53L1X_ERROR VL53L1X_SetSignalThreshold (VL53L1_DEV dev, uint16_t Signal)
 This function programs a new signal threshold in kcps (default=1024 kcps
. More...
 
VL53L1X_ERROR VL53L1X_GetSignalThreshold (VL53L1_DEV dev, uint16_t *signal)
 This function returns the current signal threshold in kcps. More...
 
VL53L1X_ERROR VL53L1X_SetSigmaThreshold (VL53L1_DEV dev, uint16_t Sigma)
 This function programs a new sigma threshold in mm (default=15 mm) More...
 
VL53L1X_ERROR VL53L1X_GetSigmaThreshold (VL53L1_DEV dev, uint16_t *sigma)
 This function returns the current sigma threshold in mm. More...
 
VL53L1X_ERROR VL53L1X_StartTemperatureUpdate (VL53L1_DEV dev)
 This function performs the temperature calibration. More...
 

Variables

const uint8_t VL51L1X_DEFAULT_CONFIGURATION []
 
static const uint8_t status_rtn [24]
 

Detailed Description

Functions implementation.

Definition in file vl53l1x_api.c.

Function Documentation

void VL53L1X_BootDevice ( VL53L1_DEV  dev,
uint16_t  TimingBudgetInMs,
uint16_t  DistanceMode,
uint32_t  InterMeasurementInMs 
)

Implement boot sequence of VL53L1 device as described in documentation See VL53L1X_SetTimingBudgetInMs, VL53L1X_SetDistanceMode and VL53L1X_SetInterMeasurementInMs for params details.

Definition at line 255 of file vl53l1x_api.c.

References state, VL53L1X_BootState(), VL53L1X_SensorInit(), VL53L1X_SetDistanceMode(), VL53L1X_SetInterMeasurementInMs(), VL53L1X_SetTimingBudgetInMs(), and VL53L1X_StartRanging().

Referenced by multi_ranger_boot_device(), and sonar_vl53l1x_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_BootState ( VL53L1_DEV  dev,
uint8_t state 
)

This function returns the boot state of the device (1:booted, 0:not booted)

Definition at line 557 of file vl53l1x_api.c.

References status, VL53L1_FIRMWARE__SYSTEM_STATUS, and VL53L1_RdByte().

Referenced by VL53L1X_BootDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_CheckForDataReady ( VL53L1_DEV  dev,
uint8_t isDataReady 
)

This function checks if the new ranging data is available by polling the dedicated register.

Parameters
isDataReady==0 -> not ready; isDataReady==1 -> ready

Definition at line 317 of file vl53l1x_api.c.

References GPIO__TIO_HV_STATUS, status, VL53L1_RdByte(), and VL53L1X_GetInterruptPolarity().

Referenced by VL53L1X_SensorInit(), and VL53L1X_StartTemperatureUpdate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_ClearInterrupt ( VL53L1_DEV  dev)

This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event.

Definition at line 271 of file vl53l1x_api.c.

References status, SYSTEM__INTERRUPT_CLEAR, and VL53L1_WrByte().

Referenced by VL53L1X_SensorInit(), and VL53L1X_StartTemperatureUpdate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_GetAmbientPerSpad ( VL53L1_DEV  dev,
uint16_t ambPerSp 
)

This function returns the ambient per SPAD in kcps/SPAD.

Definition at line 601 of file vl53l1x_api.c.

References RESULT__AMBIENT_COUNT_RATE_MCPS_SD, status, VL53L1_RdWord(), and VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetAmbientRate ( VL53L1_DEV  dev,
uint16_t ambRate 
)

This function returns the ambient rate in kcps.

Definition at line 634 of file vl53l1x_api.c.

References RESULT__AMBIENT_COUNT_RATE_MCPS_SD, status, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetDistance ( VL53L1_DEV  dev,
uint16_t distance 
)

This function returns the distance measured by the sensor in mm.

Definition at line 577 of file vl53l1x_api.c.

References status, VL53L1_RdWord(), and VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetDistanceMode ( VL53L1_DEV  dev,
uint16_t DM 
)

This function returns the current distance mode (1=short, 2=long).

Definition at line 516 of file vl53l1x_api.c.

References PHASECAL_CONFIG__TIMEOUT_MACROP, status, and VL53L1_RdByte().

Referenced by VL53L1X_SetTimingBudgetInMs().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_GetDistanceThresholdHigh ( VL53L1_DEV  dev,
uint16_t high 
)

This function returns the high threshold in mm.

Definition at line 768 of file vl53l1x_api.c.

References status, SYSTEM__THRESH_HIGH, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetDistanceThresholdLow ( VL53L1_DEV  dev,
uint16_t low 
)

This function returns the low threshold in mm.

Definition at line 758 of file vl53l1x_api.c.

References status, SYSTEM__THRESH_LOW, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetDistanceThresholdWindow ( VL53L1_DEV  dev,
uint16_t window 
)

This function returns the window detection mode (0=below; 1=above; 2=out; 3=in)

Definition at line 749 of file vl53l1x_api.c.

References status, SYSTEM__INTERRUPT_CONFIG_GPIO, and VL53L1_RdByte().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetInterMeasurementInMs ( VL53L1_DEV  dev,
uint16_t pIM 
)

This function returns the Intermeasurement period in ms.

Definition at line 543 of file vl53l1x_api.c.

References status, VL53L1_RdDWord(), VL53L1_RdWord(), VL53L1_RESULT__OSC_CALIBRATE_VAL, and VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetInterruptPolarity ( VL53L1_DEV  dev,
uint8_t pInterruptPolarity 
)

This function returns the current interrupt polarity
1=active high (default), 0=active low.

Definition at line 290 of file vl53l1x_api.c.

References GPIO_HV_MUX__CTRL, status, and VL53L1_RdByte().

Referenced by VL53L1X_CheckForDataReady().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_GetOffset ( VL53L1_DEV  dev,
int16_t offset 
)

This function returns the programmed offset correction value in mm.

Definition at line 691 of file vl53l1x_api.c.

References ALGO__PART_TO_PART_RANGE_OFFSET_MM, status, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetRangeStatus ( VL53L1_DEV  dev,
uint8_t rangeStatus 
)

This function returns the ranging status error
(0:no error, 1:sigma failed, 2:signal failed, ..., 7:wrap-around)

Definition at line 644 of file vl53l1x_api.c.

References status, status_rtn, VL53L1_RdByte(), and VL53L1_RESULT__RANGE_STATUS.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetResult ( VL53L1_DEV  dev,
VL53L1X_Result_t pResult 
)

This function returns measurements and the range status in a single read access.

Definition at line 658 of file vl53l1x_api.c.

References VL53L1X_Result_t::Ambient, VL53L1X_Result_t::Distance, VL53L1X_Result_t::NumSPADs, VL53L1X_Result_t::SigPerSPAD, status, VL53L1X_Result_t::Status, status_rtn, VL53L1_ReadMulti(), and VL53L1_RESULT__RANGE_STATUS.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetROI_XY ( VL53L1_DEV  dev,
uint16_t ROI_X,
uint16_t ROI_Y 
)

This function returns width X and height Y.

Definition at line 815 of file vl53l1x_api.c.

References ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE, status, and VL53L1_RdByte().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetROICenter ( VL53L1_DEV  dev,
uint8_t ROICenter 
)

This function returns the current user ROI center.

Definition at line 785 of file vl53l1x_api.c.

References ROI_CONFIG__USER_ROI_CENTRE_SPAD, status, and VL53L1_RdByte().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetSensorId ( VL53L1_DEV  dev,
uint16_t sensorId 
)

This function returns the sensor id, sensor Id must be 0xEEAC.

Definition at line 567 of file vl53l1x_api.c.

References status, VL53L1_IDENTIFICATION__MODEL_ID, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetSigmaThreshold ( VL53L1_DEV  dev,
uint16_t sigma 
)

This function returns the current sigma threshold in mm.

Definition at line 857 of file vl53l1x_api.c.

References RANGE_CONFIG__SIGMA_THRESH, status, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetSignalPerSpad ( VL53L1_DEV  dev,
uint16_t signalPerSp 
)

This function returns the returned signal per SPAD in kcps/SPAD.

With kcps stands for Kilo Count Per Second

Definition at line 588 of file vl53l1x_api.c.

References status, VL53L1_RdWord(), VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0, and VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetSignalRate ( VL53L1_DEV  dev,
uint16_t signal 
)

This function returns the returned signal in kcps.

Definition at line 612 of file vl53l1x_api.c.

References status, VL53L1_RdWord(), and VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetSignalThreshold ( VL53L1_DEV  dev,
uint16_t signal 
)

This function returns the current signal threshold in kcps.

Definition at line 834 of file vl53l1x_api.c.

References RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS, status, and VL53L1_RdWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetSpadNb ( VL53L1_DEV  dev,
uint16_t spNb 
)

This function returns the current number of enabled SPADs.

Definition at line 623 of file vl53l1x_api.c.

References status, VL53L1_RdWord(), and VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0.

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_GetTimingBudgetInMs ( VL53L1_DEV  dev,
uint16_t pTimingBudget 
)

This function returns the current timing budget in ms.

Definition at line 438 of file vl53l1x_api.c.

References RANGE_CONFIG__TIMEOUT_MACROP_A_HI, status, and VL53L1_RdWord().

Referenced by VL53L1X_SetDistanceMode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_GetXtalk ( VL53L1_DEV  dev,
uint16_t xtalk 
)

This function returns the current programmed xtalk correction value in cps.

Definition at line 718 of file vl53l1x_api.c.

References ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS, status, and VL53L1_RdDWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SensorInit ( VL53L1_DEV  dev)

This function loads the 135 bytes default values to initialize the sensor.

Parameters
devDevice address
Returns
0:success, != 0:failed

Definition at line 231 of file vl53l1x_api.c.

References status, VL51L1X_DEFAULT_CONFIGURATION, VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, VL53L1_WrByte(), VL53L1X_CheckForDataReady(), VL53L1X_ClearInterrupt(), VL53L1X_SetI2CAddress(), VL53L1X_StartRanging(), and VL53L1X_StopRanging().

Referenced by VL53L1X_BootDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_SetDistanceMode ( VL53L1_DEV  dev,
uint16_t  DistanceMode 
)

This function programs the distance mode (1=short, 2=long(default)).

Short mode max distance is limited to 1.3 m but better ambient immunity.
Long mode can range up to 4 m in the dark with 200 ms timing budget.

Definition at line 479 of file vl53l1x_api.c.

References PHASECAL_CONFIG__TIMEOUT_MACROP, RANGE_CONFIG__VALID_PHASE_HIGH, RANGE_CONFIG__VCSEL_PERIOD_A, RANGE_CONFIG__VCSEL_PERIOD_B, SD_CONFIG__INITIAL_PHASE_SD0, SD_CONFIG__WOI_SD0, status, VL53L1_WrByte(), VL53L1_WrWord(), VL53L1X_GetTimingBudgetInMs(), and VL53L1X_SetTimingBudgetInMs().

Referenced by VL53L1X_BootDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_SetDistanceThreshold ( VL53L1_DEV  dev,
uint16_t  ThreshLow,
uint16_t  ThreshHigh,
uint8_t  Window,
uint8_t  IntOnNoTarget 
)

This function programs the threshold detection mode
Example:
VL53L1X_SetDistanceThreshold(dev,100,300,0,1): Below 100
VL53L1X_SetDistanceThreshold(dev,100,300,1,1): Above 300
VL53L1X_SetDistanceThreshold(dev,100,300,2,1): Out of window
VL53L1X_SetDistanceThreshold(dev,100,300,3,1): In window
.

Parameters
dev: device address
ThreshLow(inmm) : the threshold under which one the device raises an interrupt if Window = 0
ThreshHigh(inmm) : the threshold above which one the device raises an interrupt if Window = 1
Windowdetection mode : 0=below, 1=above, 2=out, 3=in
IntOnNoTarget= 1 (No longer used - just use 1)

Definition at line 728 of file vl53l1x_api.c.

References status, SYSTEM__INTERRUPT_CONFIG_GPIO, SYSTEM__THRESH_HIGH, SYSTEM__THRESH_LOW, VL53L1_RdByte(), VL53L1_WrByte(), and VL53L1_WrWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetI2CAddress ( VL53L1_DEV  dev,
uint8_t  new_address 
)

This function sets the sensor I2C address used in case multiple devices application, default address 0x52.

Definition at line 222 of file vl53l1x_api.c.

References VL53L1_Dev_t::i2c_trans, i2c_transaction::slave_addr, status, VL53L1_I2C_SLAVE__DEVICE_ADDRESS, and VL53L1_WrByte().

Referenced by VL53L1X_SensorInit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_SetInterMeasurementInMs ( VL53L1_DEV  dev,
uint32_t  InterMeasurementInMs 
)

This function programs the Intermeasurement period in ms
Intermeasurement period must be >/= timing budget.

This condition is not checked by the API, the customer has the duty to check the condition. Default = 100 ms

Definition at line 530 of file vl53l1x_api.c.

References status, VL53L1_RdWord(), VL53L1_RESULT__OSC_CALIBRATE_VAL, VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD, and VL53L1_WrDWord().

Referenced by VL53L1X_BootDevice().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_SetInterruptPolarity ( VL53L1_DEV  dev,
uint8_t  NewPolarity 
)

This function programs the interrupt polarity
1=active high (default), 0=active low.

Definition at line 279 of file vl53l1x_api.c.

References GPIO_HV_MUX__CTRL, status, VL53L1_RdByte(), and VL53L1_WrByte().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetOffset ( VL53L1_DEV  dev,
int16_t  OffsetValue 
)

This function programs the offset correction in mm.

Parameters
OffsetValue:theoffset correction value to program in mm

Definition at line 678 of file vl53l1x_api.c.

References ALGO__PART_TO_PART_RANGE_OFFSET_MM, MM_CONFIG__INNER_OFFSET_MM, MM_CONFIG__OUTER_OFFSET_MM, status, and VL53L1_WrWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetROI ( VL53L1_DEV  dev,
uint16_t  X,
uint16_t  Y 
)

This function programs the ROI (Region of Interest)
The ROI position is centered, only the ROI size can be reprogrammed.


The smallest acceptable ROI size = 4

Parameters
X:ROIWidth; Y=ROI Height

Definition at line 794 of file vl53l1x_api.c.

References ROI_CONFIG__USER_ROI_CENTRE_SPAD, ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE, status, VL53L1_RdByte(), VL53L1_ROI_CONFIG__MODE_ROI_CENTRE_SPAD, and VL53L1_WrByte().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetROICenter ( VL53L1_DEV  dev,
uint8_t  ROICenter 
)

This function programs the new user ROI center, please to be aware that there is no check in this function.

if the ROI center vs ROI size is out of border the ranging function return error #13

Definition at line 778 of file vl53l1x_api.c.

References ROI_CONFIG__USER_ROI_CENTRE_SPAD, status, and VL53L1_WrByte().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetSigmaThreshold ( VL53L1_DEV  dev,
uint16_t  Sigma 
)

This function programs a new sigma threshold in mm (default=15 mm)

Definition at line 845 of file vl53l1x_api.c.

References RANGE_CONFIG__SIGMA_THRESH, status, and VL53L1_WrWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetSignalThreshold ( VL53L1_DEV  dev,
uint16_t  Signal 
)

This function programs a new signal threshold in kcps (default=1024 kcps
.

Definition at line 826 of file vl53l1x_api.c.

References RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS, status, and VL53L1_WrWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_SetTimingBudgetInMs ( VL53L1_DEV  dev,
uint16_t  TimingBudgetInMs 
)

This function programs the timing budget in ms.

Predefined values = 15, 20, 33, 50, 100(default), 200, 500.

Definition at line 336 of file vl53l1x_api.c.

References RANGE_CONFIG__TIMEOUT_MACROP_A_HI, RANGE_CONFIG__TIMEOUT_MACROP_B_HI, status, VL53L1_WrWord(), and VL53L1X_GetDistanceMode().

Referenced by VL53L1X_BootDevice(), and VL53L1X_SetDistanceMode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_SetXtalk ( VL53L1_DEV  dev,
uint16_t  XtalkValue 
)

This function programs the xtalk correction value in cps (Count Per Second).


This is the number of photons reflected back from the cover glass in cps.

Definition at line 703 of file vl53l1x_api.c.

References ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS, ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS, ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS, status, and VL53L1_WrWord().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_StartRanging ( VL53L1_DEV  dev)

This function starts the ranging distance operation
The ranging operation is continuous.

The clear interrupt has to be done after each get data to allow the interrupt to raise when the next data is ready
1=active high (default), 0=active low, use SetInterruptPolarity() to change the interrupt polarity if required.

Definition at line 301 of file vl53l1x_api.c.

References status, SYSTEM__MODE_START, and VL53L1_WrByte().

Referenced by VL53L1X_BootDevice(), VL53L1X_SensorInit(), and VL53L1X_StartTemperatureUpdate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VL53L1X_ERROR VL53L1X_StartTemperatureUpdate ( VL53L1_DEV  dev)

This function performs the temperature calibration.

It is recommended to call this function any time the temperature might have changed by more than 8 deg C without sensor ranging activity for an extended period.

Definition at line 868 of file vl53l1x_api.c.

References status, VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, VL53L1_WrByte(), VL53L1X_CheckForDataReady(), VL53L1X_ClearInterrupt(), VL53L1X_StartRanging(), and VL53L1X_StopRanging().

+ Here is the call graph for this function:

VL53L1X_ERROR VL53L1X_StopRanging ( VL53L1_DEV  dev)

This function stops the ranging.

Definition at line 309 of file vl53l1x_api.c.

References status, SYSTEM__MODE_START, and VL53L1_WrByte().

Referenced by VL53L1X_SensorInit(), and VL53L1X_StartTemperatureUpdate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const uint8_t status_rtn[24]
static
Initial value:
= { 255, 255, 255, 5, 2, 4, 1, 7, 3, 0,
255, 255, 9, 13, 255, 255, 255, 255, 10, 6,
255, 255, 11, 12
}

Definition at line 201 of file vl53l1x_api.c.

Referenced by VL53L1X_GetRangeStatus(), and VL53L1X_GetResult().

const uint8_t VL51L1X_DEFAULT_CONFIGURATION[]

Definition at line 107 of file vl53l1x_api.c.

Referenced by VL53L1X_SensorInit().