VL53L0X World smallest Time-of-Flight (ToF) ranging sensor
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: HelloWorld_ST_Sensors mbed-os-mqtt-client Multi_VL53L0X DISCO-IOT01_HomeEnv ... more
Fork of VL53L0X by
Calc_sigma_estimate
Functions | |
VL53L0X_Error | VL53L0X_get_ranging_measurement_data (VL53L0X_DEV dev, VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data) |
Retrieve the measurements from device for a given setup. | |
VL53L0X_Error | VL53L0X_perform_single_ranging_measurement (VL53L0X_DEV dev, VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data) |
Performs a single ranging measurement and retrieve the ranging measurement data. | |
VL53L0X_Error | VL53L0X_set_reference_spads (VL53L0X_DEV dev, uint32_t refSpadCount, uint8_t is_aperture_spads) |
Applies Reference SPAD configuration. | |
VL53L0X_Error | VL53L0X_perform_ref_calibration (VL53L0X_DEV dev, uint8_t *p_vhv_settings, uint8_t *p_phase_cal) |
Perform Reference Calibration. | |
VL53L0X_Error | VL53L0X_perform_ref_spad_management (VL53L0X_DEV dev, uint32_t *ref_spad_count, uint8_t *is_aperture_spads) |
Performs Reference Spad Management. | |
VL53L0X_Error | VL53L0X_set_device_address (VL53L0X_DEV dev, uint8_t device_address) |
Set new device address. | |
VL53L0X_Error | VL53L0X_set_gpio_config (VL53L0X_DEV dev, uint8_t pin, VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality, VL53L0X_InterruptPolarity polarity) |
Set the configuration of GPIO pin for a given device. | |
VL53L0X_Error | VL53L0X_get_fraction_enable (VL53L0X_DEV dev, uint8_t *p_enabled) |
Gets the fraction enable parameter indicating the resolution of range measurements. | |
VL53L0X_Error | VL53L0X_set_measurement_timing_budget_micro_seconds (VL53L0X_DEV dev, uint32_t measurement_timing_budget_micro_seconds) |
Set Ranging Timing Budget in microseconds. | |
VL53L0X_Error | VL53L0X_set_sequence_step_enable (VL53L0X_DEV dev, VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled) |
Sets the (on/off) state of a requested sequence step. | |
VL53L0X_Error | VL53L0X_set_limit_check_enable (VL53L0X_DEV dev, uint16_t limit_check_id, uint8_t limit_check_enable) |
Enable/Disable a specific limit check. | |
VL53L0X_Error | VL53L0X_static_init (VL53L0X_DEV dev) |
Do basic device init (and eventually patch loading) This function will change the VL53L0X_State from VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE. | |
VL53L0X_Error | VL53L0X_stop_measurement (VL53L0X_DEV dev) |
Stop device measurement. | |
VL53L0X_Error | VL53L0X_get_stop_completed_status (VL53L0X_DEV dev, uint32_t *p_stop_status) |
Return device stop completion status. | |
int | init_sensor (uint8_t new_addr) |
Initialize the sensor with default values. | |
int | start_measurement (OperatingMode operating_mode, void(*fptr)(void)) |
Start the measure indicated by operating mode. | |
int | get_measurement (OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *p_data) |
Get results for the measure indicated by operating mode. | |
int | stop_measurement (OperatingMode operating_mode) |
Stop the currently running measure indicate by operating_mode. | |
int | handle_irq (OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *data) |
Interrupt handling func to be called by user after an INT is occourred. |
Detailed Description
Estimates the range sigma
Function Documentation
int get_measurement | ( | OperatingMode | operating_mode, |
VL53L0X_RangingMeasurementData_t * | p_data | ||
) | [inherited] |
Get results for the measure indicated by operating mode.
- Parameters:
-
[in] operating_mode specifies requested measure results [out] p_data pointer to the MeasureData_t structure to read data in to
- Returns:
- "0" on success
Definition at line 5442 of file VL53L0X.cpp.
int handle_irq | ( | OperatingMode | operating_mode, |
VL53L0X_RangingMeasurementData_t * | data | ||
) | [inherited] |
Interrupt handling func to be called by user after an INT is occourred.
- Parameters:
-
[in] opeating_mode indicating the in progress measure [out] Data pointer to the MeasureData_t structure to read data in to
- Returns:
- "0" on success
Definition at line 5503 of file VL53L0X.cpp.
int init_sensor | ( | uint8_t | new_addr ) | [inherited] |
Initialize the sensor with default values.
- Returns:
- "0" on success
Definition at line 5231 of file VL53L0X.cpp.
int start_measurement | ( | OperatingMode | operating_mode, |
void(*)(void) | fptr | ||
) | [inherited] |
Start the measure indicated by operating mode.
- Parameters:
-
[in] operating_mode specifies requested measure [in] fptr specifies call back function must be !NULL in case of interrupt measure
- Returns:
- "0" on success
Definition at line 5301 of file VL53L0X.cpp.
int stop_measurement | ( | OperatingMode | operating_mode ) | [inherited] |
Stop the currently running measure indicate by operating_mode.
- Parameters:
-
[in] operating_mode specifies requested measure to stop
- Returns:
- "0" on success
Definition at line 5473 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_get_fraction_enable | ( | VL53L0X_DEV | dev, |
uint8_t * | p_enabled | ||
) | [inherited] |
Gets the fraction enable parameter indicating the resolution of range measurements.
- Function Description
- Gets the fraction enable state, which translates to the resolution of range measurements as follows :Enabled:=0.25mm resolution, Not Enabled:=1mm resolution.
- Note:
- This function Accesses the device
- Parameters:
-
dev Device Handle p_enabled Output Parameter reporting the fraction enable state.
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 4235 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_get_ranging_measurement_data | ( | VL53L0X_DEV | dev, |
VL53L0X_RangingMeasurementData_t * | p_ranging_measurement_data | ||
) | [inherited] |
Retrieve the measurements from device for a given setup.
- Function Description
- Get data from last successful Ranging measurement
- Warning:
- USER should take care about VL53L0X_GetNumberOfROIZones() before get data. PAL will fill a NumberOfROIZones times the corresponding data structure used in the measurement function.
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle p_ranging_measurement_data Pointer to the data structure to fill up.
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 3502 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_get_stop_completed_status | ( | VL53L0X_DEV | dev, |
uint32_t * | p_stop_status | ||
) | [inherited] |
Return device stop completion status.
- Function Description
- Returns stop completiob status. User shall call this function after a stop command
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle p_stop_status Pointer to status variable to update
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 4991 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_perform_ref_calibration | ( | VL53L0X_DEV | dev, |
uint8_t * | p_vhv_settings, | ||
uint8_t * | p_phase_cal | ||
) | [inherited] |
Perform Reference Calibration.
Perform a reference calibration of the Device. This function should be run from time to time before doing a ranging measurement. This function will launch a special ranging measurement, so if interrupt are enable an interrupt will be done. This function will clear the interrupt generated automatically.
- Warning:
- This function is a blocking function
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle p_vhv_settings Pointer to vhv settings parameter. p_phase_cal Pointer to PhaseCal parameter.
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 4096 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_perform_ref_spad_management | ( | VL53L0X_DEV | dev, |
uint32_t * | ref_spad_count, | ||
uint8_t * | is_aperture_spads | ||
) | [inherited] |
Performs Reference Spad Management.
- Function Description
- The reference SPAD initialization procedure determines the minimum amount of reference spads to be enables to achieve a target reference signal rate and should be performed once during initialization.
- Note:
- This function Access to the device
- This function change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
- Parameters:
-
dev Device Handle ref_spad_count Reports ref Spad Count is_aperture_spads Reports if spads are of type aperture or non-aperture. 1:=aperture, 0:=Non-Aperture
- Returns:
- VL53L0X_ERROR_NONE Success
- VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure.
- "Other error code" See VL53L0X_Error
Definition at line 4109 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_perform_single_ranging_measurement | ( | VL53L0X_DEV | dev, |
VL53L0X_RangingMeasurementData_t * | p_ranging_measurement_data | ||
) | [inherited] |
Performs a single ranging measurement and retrieve the ranging measurement data.
- Function Description
- This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING with VL53L0X_SetDeviceMode(), It performs measurement with VL53L0X_PerformSingleMeasurement() It get data from last successful Ranging measurement with VL53L0X_GetRangingMeasurementData. Finally it clear the interrupt with VL53L0X_ClearInterruptMask().
- Note:
- This function Access to the device
- This function change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
- Parameters:
-
dev Device Handle p_ranging_measurement_data Pointer to the data structure to fill up.
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 3658 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_set_device_address | ( | VL53L0X_DEV | dev, |
uint8_t | device_address | ||
) | [inherited] |
Set new device address.
After completion the device will answer to the new address programmed. This function should be called when several devices are used in parallel before start programming the sensor. When a single device us used, there is no need to call this function.
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle device_address The new Device address
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 4124 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_set_gpio_config | ( | VL53L0X_DEV | dev, |
uint8_t | pin, | ||
VL53L0X_DeviceModes | device_mode, | ||
VL53L0X_GpioFunctionality | functionality, | ||
VL53L0X_InterruptPolarity | polarity | ||
) | [inherited] |
Set the configuration of GPIO pin for a given device.
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle pin ID of the GPIO Pin functionality Select Pin functionality. Refer to VL53L0X_GpioFunctionality device_mode Device Mode associated to the Gpio. polarity Set interrupt polarity. Active high or active low see VL53L0X_InterruptPolarity
- Returns:
- VL53L0X_ERROR_NONE Success
- VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
- VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs when Functionality programmed is not in the supported list: Supported value are: VL53L0X_GPIOFUNCTIONALITY_OFF, VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW, VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH, VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT, VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
- "Other error code" See VL53L0X_Error
Definition at line 4136 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_set_limit_check_enable | ( | VL53L0X_DEV | dev, |
uint16_t | limit_check_id, | ||
uint8_t | limit_check_enable | ||
) | [inherited] |
Enable/Disable a specific limit check.
- Function Description
- This function Enable/Disable a specific limit check. The limit check is identified with the LimitCheckId.
- Note:
- This function doesn't Access to the device
- Parameters:
-
dev Device Handle limit_check_id Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). limit_check_enable if 1 the check limit corresponding to LimitCheckId is Enabled if 0 the check limit corresponding to LimitCheckId is disabled
- Returns:
- VL53L0X_ERROR_NONE Success
- VL53L0X_ERROR_INVALID_PARAMS This error is returned when LimitCheckId value is out of range.
- "Other error code" See VL53L0X_Error
Definition at line 4675 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds | ( | VL53L0X_DEV | dev, |
uint32_t | measurement_timing_budget_micro_seconds | ||
) | [inherited] |
Set Ranging Timing Budget in microseconds.
- Function Description
- Defines the maximum time allowed by the user to the device to run a full ranging sequence for the current mode (ranging, histogram, ASL ...)
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle measurement_timing_budget_micro_seconds Max measurement time in microseconds. Valid values are: >= 17000 microsecs when wraparound enabled >= 12000 microsecs when wraparound disabled
- Returns:
- VL53L0X_ERROR_NONE Success
- VL53L0X_ERROR_INVALID_PARAMS This error is returned if MeasurementTimingBudgetMicroSeconds out of range
- "Other error code" See VL53L0X_Error
Definition at line 4571 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_set_reference_spads | ( | VL53L0X_DEV | dev, |
uint32_t | refSpadCount, | ||
uint8_t | is_aperture_spads | ||
) | [inherited] |
Applies Reference SPAD configuration.
- Function Description
- This function applies a given number of reference spads, identified as either Aperture or Non-Aperture. The requested spad count and type are stored within the device specific parameters data for access by the host.
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle refSpadCount Number of ref spads. is_aperture_spads Defines if spads are of type aperture or non-aperture. 1:=aperture, 0:=Non-Aperture
- Returns:
- VL53L0X_ERROR_NONE Success
- VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference spad configuration.
- "Other error code" See VL53L0X_Error
Definition at line 4013 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_set_sequence_step_enable | ( | VL53L0X_DEV | dev, |
VL53L0X_SequenceStepId | sequence_step_id, | ||
uint8_t | sequence_step_enabled | ||
) | [inherited] |
Sets the (on/off) state of a requested sequence step.
- Function Description
- This function enables/disables a requested sequence step.
- Note:
- This function Accesses the device
- Parameters:
-
dev Device Handle sequence_step_id Sequence step identifier. sequence_step_enabled Demanded state {0=Off,1=On} is enabled.
- Returns:
- VL53L0X_ERROR_NONE Success
- VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not supported.
- "Other error code" See VL53L0X_Error
Definition at line 4585 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_static_init | ( | VL53L0X_DEV | dev ) | [inherited] |
Do basic device init (and eventually patch loading) This function will change the VL53L0X_State from VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
In this stage all default setting will be applied.
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 4778 of file VL53L0X.cpp.
VL53L0X_Error VL53L0X_stop_measurement | ( | VL53L0X_DEV | dev ) | [inherited] |
Stop device measurement.
Will set the device in standby mode at end of current measurement
Not necessary in single mode as device shall return automatically in standby mode at end of measurement. This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING to VL53L0X_STATE_IDLE.
- Note:
- This function Access to the device
- Parameters:
-
dev Device Handle
- Returns:
- VL53L0X_ERROR_NONE Success
- "Other error code" See VL53L0X_Error
Definition at line 4963 of file VL53L0X.cpp.
Generated on Tue Jul 12 2022 19:07:41 by 1.7.2