Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
vl53l5cx_api.h File Reference
+ Include dependency graph for vl53l5cx_api.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VL53L5CX_Configuration
 Structure VL53L5CX_Configuration contains the sensor configuration. More...
 
struct  VL53L5CX_ResultsData
 Structure VL53L5CX_ResultsData contains the ranging results of VL53L5CX. More...
 
union  Block_header
 
struct  VL53L5CX_ResultsData.motion_indicator
 
struct  Block_header.__unnamed347__
 

Macros

#define VL53L5CX_API_REVISION   "VL53L5CX_1.3.10"
 Copyright (c) 2021 STMicroelectronics. More...
 
#define VL53L5CX_DEFAULT_I2C_ADDRESS   ((uint16_t)0x52)
 Default I2C address of VL53L5CX sensor. More...
 
#define VL53L5CX_RESOLUTION_4X4   ((uint8_t) 16U)
 Macro VL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8 allows setting sensor in 4x4 mode or 8x8 mode, using function vl53l5cx_set_resolution(). More...
 
#define VL53L5CX_RESOLUTION_8X8   ((uint8_t) 64U)
 
#define VL53L5CX_TARGET_ORDER_CLOSEST   ((uint8_t) 1U)
 Macro VL53L5CX_TARGET_ORDER_STRONGEST or VL53L5CX_TARGET_ORDER_CLOSEST are used to select the target order for data output. More...
 
#define VL53L5CX_TARGET_ORDER_STRONGEST   ((uint8_t) 2U)
 
#define VL53L5CX_RANGING_MODE_CONTINUOUS   ((uint8_t) 1U)
 Macro VL53L5CX_RANGING_MODE_CONTINUOUS and VL53L5CX_RANGING_MODE_AUTONOMOUS are used to change the ranging mode. More...
 
#define VL53L5CX_RANGING_MODE_AUTONOMOUS   ((uint8_t) 3U)
 
#define VL53L5CX_POWER_MODE_SLEEP   ((uint8_t) 0U)
 The default power mode is VL53L5CX_POWER_MODE_WAKEUP. More...
 
#define VL53L5CX_POWER_MODE_WAKEUP   ((uint8_t) 1U)
 
#define VL53L5CX_STATUS_OK   ((uint8_t) 0U)
 Macro VL53L5CX_STATUS_OK indicates that VL53L5 sensor has no error. More...
 
#define VL53L5CX_STATUS_TIMEOUT_ERROR   ((uint8_t) 1U)
 
#define VL53L5CX_STATUS_CORRUPTED_FRAME   ((uint8_t) 2U)
 
#define VL53L5CX_STATUS_CRC_CSUM_FAILED   ((uint8_t) 3U)
 
#define VL53L5CX_STATUS_XTALK_FAILED   ((uint8_t) 4U)
 
#define VL53L5CX_MCU_ERROR   ((uint8_t) 66U)
 
#define VL53L5CX_STATUS_INVALID_PARAM   ((uint8_t) 127U)
 
#define VL53L5CX_STATUS_ERROR   ((uint8_t) 255U)
 
#define VL53L5CX_START_BH   ((uint32_t)0x0000000DU)
 Definitions for Range results block headers. More...
 
#define VL53L5CX_METADATA_BH   ((uint32_t)0x54B400C0U)
 
#define VL53L5CX_COMMONDATA_BH   ((uint32_t)0x54C00040U)
 
#define VL53L5CX_AMBIENT_RATE_BH   ((uint32_t)0x54D00104U)
 
#define VL53L5CX_NB_TARGET_DETECTED_BH   ((uint32_t)0x57D00401U)
 
#define VL53L5CX_SPAD_COUNT_BH   ((uint32_t)0x55D00404U)
 
#define VL53L5CX_SIGNAL_RATE_BH   ((uint32_t)0x58900404U)
 
#define VL53L5CX_RANGE_SIGMA_MM_BH   ((uint32_t)0x64900402U)
 
#define VL53L5CX_DISTANCE_BH   ((uint32_t)0x66900402U)
 
#define VL53L5CX_REFLECTANCE_BH   ((uint32_t)0x6A900401U)
 
#define VL53L5CX_TARGET_STATUS_BH   ((uint32_t)0x6B900401U)
 
#define VL53L5CX_MOTION_DETECT_BH   ((uint32_t)0xCC5008C0U)
 
#define VL53L5CX_METADATA_IDX   ((uint16_t)0x54B4U)
 
#define VL53L5CX_SPAD_COUNT_IDX   ((uint16_t)0x55D0U)
 
#define VL53L5CX_AMBIENT_RATE_IDX   ((uint16_t)0x54D0U)
 
#define VL53L5CX_NB_TARGET_DETECTED_IDX   ((uint16_t)0x57D0U)
 
#define VL53L5CX_SIGNAL_RATE_IDX   ((uint16_t)0x5890U)
 
#define VL53L5CX_RANGE_SIGMA_MM_IDX   ((uint16_t)0x6490U)
 
#define VL53L5CX_DISTANCE_IDX   ((uint16_t)0x6690U)
 
#define VL53L5CX_REFLECTANCE_EST_PC_IDX   ((uint16_t)0x6A90U)
 
#define VL53L5CX_TARGET_STATUS_IDX   ((uint16_t)0x6B90U)
 
#define VL53L5CX_MOTION_DETEC_IDX   ((uint16_t)0xCC50U)
 
#define VL53L5CX_NVM_DATA_SIZE   ((uint16_t)492U)
 Inner Macro for API. More...
 
#define VL53L5CX_CONFIGURATION_SIZE   ((uint16_t)972U)
 
#define VL53L5CX_OFFSET_BUFFER_SIZE   ((uint16_t)488U)
 
#define VL53L5CX_XTALK_BUFFER_SIZE   ((uint16_t)776U)
 
#define VL53L5CX_DCI_ZONE_CONFIG   ((uint16_t)0x5450U)
 
#define VL53L5CX_DCI_FREQ_HZ   ((uint16_t)0x5458U)
 
#define VL53L5CX_DCI_INT_TIME   ((uint16_t)0x545CU)
 
#define VL53L5CX_DCI_FW_NB_TARGET   ((uint16_t)0x5478)
 
#define VL53L5CX_DCI_RANGING_MODE   ((uint16_t)0xAD30U)
 
#define VL53L5CX_DCI_DSS_CONFIG   ((uint16_t)0xAD38U)
 
#define VL53L5CX_DCI_TARGET_ORDER   ((uint16_t)0xAE64U)
 
#define VL53L5CX_DCI_SHARPENER   ((uint16_t)0xAED8U)
 
#define VL53L5CX_DCI_INTERNAL_CP   ((uint16_t)0xB39CU)
 
#define VL53L5CX_DCI_SYNC_PIN   ((uint16_t)0xB5F0U)
 
#define VL53L5CX_DCI_MOTION_DETECTOR_CFG   ((uint16_t)0xBFACU)
 
#define VL53L5CX_DCI_SINGLE_RANGE   ((uint16_t)0xD964U)
 
#define VL53L5CX_DCI_OUTPUT_CONFIG   ((uint16_t)0xD968U)
 
#define VL53L5CX_DCI_OUTPUT_ENABLES   ((uint16_t)0xD970U)
 
#define VL53L5CX_DCI_OUTPUT_LIST   ((uint16_t)0xD980U)
 
#define VL53L5CX_DCI_PIPE_CONTROL   ((uint16_t)0xDB80U)
 
#define VL53L5CX_GLARE_FILTER   ((uint16_t)0xE108U)
 
#define VL53L5CX_UI_CMD_STATUS   ((uint16_t)0x2C00U)
 
#define VL53L5CX_UI_CMD_START   ((uint16_t)0x2C04U)
 
#define VL53L5CX_UI_CMD_END   ((uint16_t)0x2FFFU)
 
#define L5CX_AMB_SIZE   260U
 Inner values for API. More...
 
#define L5CX_SPAD_SIZE   260U
 
#define L5CX_NTAR_SIZE   68U
 
#define L5CX_SPS_SIZE   ((256U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U)
 
#define L5CX_SIGR_SIZE   ((128U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U)
 
#define L5CX_DIST_SIZE   ((128U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U)
 
#define L5CX_RFLEST_SIZE   ((64U *VL53L5CX_NB_TARGET_PER_ZONE) + 4U)
 
#define L5CX_STA_SIZE   ((64U *VL53L5CX_NB_TARGET_PER_ZONE) + 4U)
 
#define L5CX_MOT_SIZE   144U
 
#define VL53L5CX_MAX_RESULTS_SIZE
 Macro VL53L5CX_MAX_RESULTS_SIZE indicates the maximum size used by output through I2C. More...
 
#define VL53L5CX_TEMPORARY_BUFFER_SIZE   ((uint32_t) 1024U)
 Macro VL53L5CX_TEMPORARY_BUFFER_SIZE can be used to know the size of the temporary buffer. More...
 

Functions

uint8_t vl53l5cx_is_alive (VL53L5CX_Configuration *p_dev, uint8_t *p_is_alive)
 
uint8_t vl53l5cx_init (VL53L5CX_Configuration *p_dev)
 Mandatory function used to initialize the sensor. More...
 
uint8_t vl53l5cx_set_i2c_address (VL53L5CX_Configuration *p_dev, uint16_t i2c_address)
 This function is used to change the I2C address of the sensor. More...
 
uint8_t vl53l5cx_get_power_mode (VL53L5CX_Configuration *p_dev, uint8_t *p_power_mode)
 This function is used to get the current sensor power mode. More...
 
uint8_t vl53l5cx_set_power_mode (VL53L5CX_Configuration *p_dev, uint8_t power_mode)
 This function is used to set the sensor in Low Power mode, for example if the sensor is not used during a long time. More...
 
uint8_t vl53l5cx_start_ranging (VL53L5CX_Configuration *p_dev)
 This function starts a ranging session. More...
 
uint8_t vl53l5cx_stop_ranging (VL53L5CX_Configuration *p_dev)
 This function stops the ranging session. More...
 
uint8_t vl53l5cx_check_data_ready (VL53L5CX_Configuration *p_dev, uint8_t *p_isReady)
 This function checks if a new data is ready by polling I2C. More...
 
uint8_t vl53l5cx_get_ranging_data (VL53L5CX_Configuration *p_dev, VL53L5CX_ResultsData *p_results)
 This function gets the ranging data, using the selected output and the resolution. More...
 
uint8_t vl53l5cx_get_resolution (VL53L5CX_Configuration *p_dev, uint8_t *p_resolution)
 This function gets the current resolution (4x4 or 8x8). More...
 
uint8_t vl53l5cx_set_resolution (VL53L5CX_Configuration *p_dev, uint8_t resolution)
 This function sets a new resolution (4x4 or 8x8). More...
 
uint8_t vl53l5cx_get_ranging_frequency_hz (VL53L5CX_Configuration *p_dev, uint8_t *p_frequency_hz)
 This function gets the current ranging frequency in Hz. More...
 
uint8_t vl53l5cx_set_ranging_frequency_hz (VL53L5CX_Configuration *p_dev, uint8_t frequency_hz)
 This function sets a new ranging frequency in Hz. More...
 
uint8_t vl53l5cx_get_integration_time_ms (VL53L5CX_Configuration *p_dev, uint32_t *p_time_ms)
 This function gets the current integration time in ms. More...
 
uint8_t vl53l5cx_set_integration_time_ms (VL53L5CX_Configuration *p_dev, uint32_t integration_time_ms)
 This function sets a new integration time in ms. More...
 
uint8_t vl53l5cx_get_sharpener_percent (VL53L5CX_Configuration *p_dev, uint8_t *p_sharpener_percent)
 This function gets the current sharpener in percent. More...
 
uint8_t vl53l5cx_set_sharpener_percent (VL53L5CX_Configuration *p_dev, uint8_t sharpener_percent)
 This function sets a new sharpener value in percent. More...
 
uint8_t vl53l5cx_get_target_order (VL53L5CX_Configuration *p_dev, uint8_t *p_target_order)
 This function gets the current target order (closest or strongest). More...
 
uint8_t vl53l5cx_set_target_order (VL53L5CX_Configuration *p_dev, uint8_t target_order)
 This function sets a new target order. More...
 
uint8_t vl53l5cx_get_ranging_mode (VL53L5CX_Configuration *p_dev, uint8_t *p_ranging_mode)
 This function is used to get the ranging mode. More...
 
uint8_t vl53l5cx_set_ranging_mode (VL53L5CX_Configuration *p_dev, uint8_t ranging_mode)
 This function is used to set the ranging mode. More...
 
uint8_t vl53l5cx_enable_internal_cp (VL53L5CX_Configuration *p_dev)
 This function is used to disable the VCSEL charge pump This optimizes the power consumption of the device To be used only if AVDD = 3.3V. More...
 
uint8_t vl53l5cx_disable_internal_cp (VL53L5CX_Configuration *p_dev)
 This function is used to disable the VCSEL charge pump This optimizes the power consumption of the device To be used only if AVDD = 3.3V. More...
 
uint8_t vl53l5cx_dci_read_data (VL53L5CX_Configuration *p_dev, uint8_t *data, uint32_t index, uint16_t data_size)
 This function can be used to read 'extra data' from DCI. More...
 
uint8_t vl53l5cx_dci_write_data (VL53L5CX_Configuration *p_dev, uint8_t *data, uint32_t index, uint16_t data_size)
 This function can be used to write 'extra data' to DCI. More...
 
uint8_t vl53l5cx_dci_replace_data (VL53L5CX_Configuration *p_dev, uint8_t *data, uint32_t index, uint16_t data_size, uint8_t *new_data, uint16_t new_data_size, uint16_t new_data_pos)
 This function can be used to replace 'extra data' in DCI. More...
 

Data Structure Documentation

◆ VL53L5CX_Configuration

struct VL53L5CX_Configuration

Structure VL53L5CX_Configuration contains the sensor configuration.

User MUST not manually change these field, except for the sensor address.

Definition at line 270 of file vl53l5cx_api.h.

+ Collaboration diagram for VL53L5CX_Configuration:
Data Fields
uint32_t data_read_size
uint8_t * default_configuration
uint8_t * default_xtalk
uint8_t is_auto_stop_enabled
uint8_t offset_data[VL53L5CX_OFFSET_BUFFER_SIZE]
VL53L5CX_Platform platform
uint8_t streamcount
uint8_t temp_buffer[VL53L5CX_TEMPORARY_BUFFER_SIZE]
uint8_t xtalk_data[VL53L5CX_XTALK_BUFFER_SIZE]

◆ VL53L5CX_ResultsData

struct VL53L5CX_ResultsData

Structure VL53L5CX_ResultsData contains the ranging results of VL53L5CX.

If user wants more than 1 target per zone, the results can be split into 2 sub-groups :

  • Per zone results. These results are common to all targets (ambient_per_spad , nb_target_detected and nb_spads_enabled).
  • Per target results : These results are different relative to the detected target (signal_per_spad, range_sigma_mm, distance_mm, reflectance, target_status).

Definition at line 304 of file vl53l5cx_api.h.

+ Collaboration diagram for VL53L5CX_ResultsData:
Data Fields
uint32_t ambient_per_spad[VL53L5CX_RESOLUTION_8X8]
int16_t distance_mm[(VL53L5CX_RESOLUTION_8X8 *VL53L5CX_NB_TARGET_PER_ZONE)]
struct VL53L5CX_ResultsData motion_indicator
uint32_t nb_spads_enabled[VL53L5CX_RESOLUTION_8X8]
uint8_t nb_target_detected[VL53L5CX_RESOLUTION_8X8]
uint16_t range_sigma_mm[(VL53L5CX_RESOLUTION_8X8 *VL53L5CX_NB_TARGET_PER_ZONE)]
uint8_t reflectance[(VL53L5CX_RESOLUTION_8X8 *VL53L5CX_NB_TARGET_PER_ZONE)]
uint32_t signal_per_spad[(VL53L5CX_RESOLUTION_8X8 *VL53L5CX_NB_TARGET_PER_ZONE)]
int8_t silicon_temp_degc
uint8_t target_status[(VL53L5CX_RESOLUTION_8X8 *VL53L5CX_NB_TARGET_PER_ZONE)]

◆ Block_header

union Block_header

Definition at line 371 of file vl53l5cx_api.h.

+ Collaboration diagram for Block_header:
Data Fields
struct Block_header __unnamed__
uint32_t bytes

◆ VL53L5CX_ResultsData.motion_indicator

struct VL53L5CX_ResultsData.motion_indicator

Definition at line 356 of file vl53l5cx_api.h.

Data Fields
uint32_t global_indicator_1
uint32_t global_indicator_2
uint32_t motion[32]
uint8_t nb_of_aggregates
uint8_t nb_of_detected_aggregates
uint8_t spare
uint8_t status

◆ Block_header.__unnamed347__

struct Block_header.__unnamed347__

Definition at line 373 of file vl53l5cx_api.h.

Data Fields
uint32_t idx: 16
uint32_t size: 12
uint32_t type: 4

Macro Definition Documentation

◆ L5CX_AMB_SIZE

#define L5CX_AMB_SIZE   260U

Inner values for API.

Max buffer size depends of the selected output.

Definition at line 188 of file vl53l5cx_api.h.

◆ L5CX_DIST_SIZE

#define L5CX_DIST_SIZE   ((128U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U)

Definition at line 218 of file vl53l5cx_api.h.

◆ L5CX_MOT_SIZE

#define L5CX_MOT_SIZE   144U

Definition at line 236 of file vl53l5cx_api.h.

◆ L5CX_NTAR_SIZE

#define L5CX_NTAR_SIZE   68U

Definition at line 200 of file vl53l5cx_api.h.

◆ L5CX_RFLEST_SIZE

#define L5CX_RFLEST_SIZE   ((64U *VL53L5CX_NB_TARGET_PER_ZONE) + 4U)

Definition at line 224 of file vl53l5cx_api.h.

◆ L5CX_SIGR_SIZE

#define L5CX_SIGR_SIZE   ((128U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U)

Definition at line 212 of file vl53l5cx_api.h.

◆ L5CX_SPAD_SIZE

#define L5CX_SPAD_SIZE   260U

Definition at line 194 of file vl53l5cx_api.h.

◆ L5CX_SPS_SIZE

#define L5CX_SPS_SIZE   ((256U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U)

Definition at line 206 of file vl53l5cx_api.h.

◆ L5CX_STA_SIZE

#define L5CX_STA_SIZE   ((64U *VL53L5CX_NB_TARGET_PER_ZONE) + 4U)

Definition at line 230 of file vl53l5cx_api.h.

◆ VL53L5CX_AMBIENT_RATE_BH

#define VL53L5CX_AMBIENT_RATE_BH   ((uint32_t)0x54D00104U)

Definition at line 128 of file vl53l5cx_api.h.

◆ VL53L5CX_AMBIENT_RATE_IDX

#define VL53L5CX_AMBIENT_RATE_IDX   ((uint16_t)0x54D0U)

Definition at line 140 of file vl53l5cx_api.h.

◆ VL53L5CX_API_REVISION

#define VL53L5CX_API_REVISION   "VL53L5CX_1.3.10"

Copyright (c) 2021 STMicroelectronics.

All rights reserved.

This software component is provided to you as part of a software package and applicable license terms are in the Package_license file. If you received this software component outside of a package or without applicable license terms, the terms of the BSD-3-Clause license shall apply. You may obtain a copy of the BSD-3-Clause at: https://opensource.org/licenses/BSD-3-Clause

Current driver version.

Definition at line 32 of file vl53l5cx_api.h.

◆ VL53L5CX_COMMONDATA_BH

#define VL53L5CX_COMMONDATA_BH   ((uint32_t)0x54C00040U)

Definition at line 127 of file vl53l5cx_api.h.

◆ VL53L5CX_CONFIGURATION_SIZE

#define VL53L5CX_CONFIGURATION_SIZE   ((uint16_t)972U)

Definition at line 156 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_DSS_CONFIG

#define VL53L5CX_DCI_DSS_CONFIG   ((uint16_t)0xAD38U)

Definition at line 165 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_FREQ_HZ

#define VL53L5CX_DCI_FREQ_HZ   ((uint16_t)0x5458U)

Definition at line 161 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_FW_NB_TARGET

#define VL53L5CX_DCI_FW_NB_TARGET   ((uint16_t)0x5478)

Definition at line 163 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_INT_TIME

#define VL53L5CX_DCI_INT_TIME   ((uint16_t)0x545CU)

Definition at line 162 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_INTERNAL_CP

#define VL53L5CX_DCI_INTERNAL_CP   ((uint16_t)0xB39CU)

Definition at line 168 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_MOTION_DETECTOR_CFG

#define VL53L5CX_DCI_MOTION_DETECTOR_CFG   ((uint16_t)0xBFACU)

Definition at line 170 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_OUTPUT_CONFIG

#define VL53L5CX_DCI_OUTPUT_CONFIG   ((uint16_t)0xD968U)

Definition at line 172 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_OUTPUT_ENABLES

#define VL53L5CX_DCI_OUTPUT_ENABLES   ((uint16_t)0xD970U)

Definition at line 173 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_OUTPUT_LIST

#define VL53L5CX_DCI_OUTPUT_LIST   ((uint16_t)0xD980U)

Definition at line 174 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_PIPE_CONTROL

#define VL53L5CX_DCI_PIPE_CONTROL   ((uint16_t)0xDB80U)

Definition at line 175 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_RANGING_MODE

#define VL53L5CX_DCI_RANGING_MODE   ((uint16_t)0xAD30U)

Definition at line 164 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_SHARPENER

#define VL53L5CX_DCI_SHARPENER   ((uint16_t)0xAED8U)

Definition at line 167 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_SINGLE_RANGE

#define VL53L5CX_DCI_SINGLE_RANGE   ((uint16_t)0xD964U)

Definition at line 171 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_SYNC_PIN

#define VL53L5CX_DCI_SYNC_PIN   ((uint16_t)0xB5F0U)

Definition at line 169 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_TARGET_ORDER

#define VL53L5CX_DCI_TARGET_ORDER   ((uint16_t)0xAE64U)

Definition at line 166 of file vl53l5cx_api.h.

◆ VL53L5CX_DCI_ZONE_CONFIG

#define VL53L5CX_DCI_ZONE_CONFIG   ((uint16_t)0x5450U)

Definition at line 160 of file vl53l5cx_api.h.

◆ VL53L5CX_DEFAULT_I2C_ADDRESS

#define VL53L5CX_DEFAULT_I2C_ADDRESS   ((uint16_t)0x52)

Default I2C address of VL53L5CX sensor.

Can be changed using function vl53l5cx_set_i2c_address() function is called.

Definition at line 39 of file vl53l5cx_api.h.

◆ VL53L5CX_DISTANCE_BH

#define VL53L5CX_DISTANCE_BH   ((uint32_t)0x66900402U)

Definition at line 133 of file vl53l5cx_api.h.

◆ VL53L5CX_DISTANCE_IDX

#define VL53L5CX_DISTANCE_IDX   ((uint16_t)0x6690U)

Definition at line 144 of file vl53l5cx_api.h.

◆ VL53L5CX_GLARE_FILTER

#define VL53L5CX_GLARE_FILTER   ((uint16_t)0xE108U)

Definition at line 176 of file vl53l5cx_api.h.

◆ VL53L5CX_MAX_RESULTS_SIZE

#define VL53L5CX_MAX_RESULTS_SIZE
Value:
( 40U \
+ L5CX_MOT_SIZE + 20U)
#define L5CX_RFLEST_SIZE
Definition: vl53l5cx_api.h:224
#define L5CX_AMB_SIZE
Inner values for API.
Definition: vl53l5cx_api.h:188
#define L5CX_NTAR_SIZE
Definition: vl53l5cx_api.h:200
#define L5CX_DIST_SIZE
Definition: vl53l5cx_api.h:218
#define L5CX_SPAD_SIZE
Definition: vl53l5cx_api.h:194
#define L5CX_MOT_SIZE
Definition: vl53l5cx_api.h:236
#define L5CX_STA_SIZE
Definition: vl53l5cx_api.h:230
#define L5CX_SIGR_SIZE
Definition: vl53l5cx_api.h:212
#define L5CX_SPS_SIZE
Definition: vl53l5cx_api.h:206

Macro VL53L5CX_MAX_RESULTS_SIZE indicates the maximum size used by output through I2C.

Value 40 corresponds to headers + meta-data + common-data and 20 corresponds to the footer.

Definition at line 247 of file vl53l5cx_api.h.

◆ VL53L5CX_MCU_ERROR

#define VL53L5CX_MCU_ERROR   ((uint8_t) 66U)

Definition at line 90 of file vl53l5cx_api.h.

◆ VL53L5CX_METADATA_BH

#define VL53L5CX_METADATA_BH   ((uint32_t)0x54B400C0U)

Definition at line 126 of file vl53l5cx_api.h.

◆ VL53L5CX_METADATA_IDX

#define VL53L5CX_METADATA_IDX   ((uint16_t)0x54B4U)

Definition at line 138 of file vl53l5cx_api.h.

◆ VL53L5CX_MOTION_DETEC_IDX

#define VL53L5CX_MOTION_DETEC_IDX   ((uint16_t)0xCC50U)

Definition at line 147 of file vl53l5cx_api.h.

◆ VL53L5CX_MOTION_DETECT_BH

#define VL53L5CX_MOTION_DETECT_BH   ((uint32_t)0xCC5008C0U)

Definition at line 136 of file vl53l5cx_api.h.

◆ VL53L5CX_NB_TARGET_DETECTED_BH

#define VL53L5CX_NB_TARGET_DETECTED_BH   ((uint32_t)0x57D00401U)

Definition at line 129 of file vl53l5cx_api.h.

◆ VL53L5CX_NB_TARGET_DETECTED_IDX

#define VL53L5CX_NB_TARGET_DETECTED_IDX   ((uint16_t)0x57D0U)

Definition at line 141 of file vl53l5cx_api.h.

◆ VL53L5CX_NVM_DATA_SIZE

#define VL53L5CX_NVM_DATA_SIZE   ((uint16_t)492U)

Inner Macro for API.

Not for user, only for development.

Definition at line 155 of file vl53l5cx_api.h.

◆ VL53L5CX_OFFSET_BUFFER_SIZE

#define VL53L5CX_OFFSET_BUFFER_SIZE   ((uint16_t)488U)

Definition at line 157 of file vl53l5cx_api.h.

◆ VL53L5CX_POWER_MODE_SLEEP

#define VL53L5CX_POWER_MODE_SLEEP   ((uint8_t) 0U)

The default power mode is VL53L5CX_POWER_MODE_WAKEUP.

User can choose the mode VL53L5CX_POWER_MODE_SLEEP to save power consumption is the device is not used. The low power mode retains the firmware and the configuration. Both modes can be changed using function vl53l5cx_set_power_mode().

Definition at line 76 of file vl53l5cx_api.h.

◆ VL53L5CX_POWER_MODE_WAKEUP

#define VL53L5CX_POWER_MODE_WAKEUP   ((uint8_t) 1U)

Definition at line 77 of file vl53l5cx_api.h.

◆ VL53L5CX_RANGE_SIGMA_MM_BH

#define VL53L5CX_RANGE_SIGMA_MM_BH   ((uint32_t)0x64900402U)

Definition at line 132 of file vl53l5cx_api.h.

◆ VL53L5CX_RANGE_SIGMA_MM_IDX

#define VL53L5CX_RANGE_SIGMA_MM_IDX   ((uint16_t)0x6490U)

Definition at line 143 of file vl53l5cx_api.h.

◆ VL53L5CX_RANGING_MODE_AUTONOMOUS

#define VL53L5CX_RANGING_MODE_AUTONOMOUS   ((uint8_t) 3U)

Definition at line 67 of file vl53l5cx_api.h.

◆ VL53L5CX_RANGING_MODE_CONTINUOUS

#define VL53L5CX_RANGING_MODE_CONTINUOUS   ((uint8_t) 1U)

Macro VL53L5CX_RANGING_MODE_CONTINUOUS and VL53L5CX_RANGING_MODE_AUTONOMOUS are used to change the ranging mode.

Autonomous mode can be used to set a precise integration time, whereas continuous is always maximum.

Definition at line 66 of file vl53l5cx_api.h.

◆ VL53L5CX_REFLECTANCE_BH

#define VL53L5CX_REFLECTANCE_BH   ((uint32_t)0x6A900401U)

Definition at line 134 of file vl53l5cx_api.h.

◆ VL53L5CX_REFLECTANCE_EST_PC_IDX

#define VL53L5CX_REFLECTANCE_EST_PC_IDX   ((uint16_t)0x6A90U)

Definition at line 145 of file vl53l5cx_api.h.

◆ VL53L5CX_RESOLUTION_4X4

#define VL53L5CX_RESOLUTION_4X4   ((uint8_t) 16U)

Macro VL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8 allows setting sensor in 4x4 mode or 8x8 mode, using function vl53l5cx_set_resolution().

Definition at line 47 of file vl53l5cx_api.h.

◆ VL53L5CX_RESOLUTION_8X8

#define VL53L5CX_RESOLUTION_8X8   ((uint8_t) 64U)

Definition at line 48 of file vl53l5cx_api.h.

◆ VL53L5CX_SIGNAL_RATE_BH

#define VL53L5CX_SIGNAL_RATE_BH   ((uint32_t)0x58900404U)

Definition at line 131 of file vl53l5cx_api.h.

◆ VL53L5CX_SIGNAL_RATE_IDX

#define VL53L5CX_SIGNAL_RATE_IDX   ((uint16_t)0x5890U)

Definition at line 142 of file vl53l5cx_api.h.

◆ VL53L5CX_SPAD_COUNT_BH

#define VL53L5CX_SPAD_COUNT_BH   ((uint32_t)0x55D00404U)

Definition at line 130 of file vl53l5cx_api.h.

◆ VL53L5CX_SPAD_COUNT_IDX

#define VL53L5CX_SPAD_COUNT_IDX   ((uint16_t)0x55D0U)

Definition at line 139 of file vl53l5cx_api.h.

◆ VL53L5CX_START_BH

#define VL53L5CX_START_BH   ((uint32_t)0x0000000DU)

Definitions for Range results block headers.

Definition at line 125 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_CORRUPTED_FRAME

#define VL53L5CX_STATUS_CORRUPTED_FRAME   ((uint8_t) 2U)

Definition at line 87 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_CRC_CSUM_FAILED

#define VL53L5CX_STATUS_CRC_CSUM_FAILED   ((uint8_t) 3U)

Definition at line 88 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_ERROR

#define VL53L5CX_STATUS_ERROR   ((uint8_t) 255U)

Definition at line 92 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_INVALID_PARAM

#define VL53L5CX_STATUS_INVALID_PARAM   ((uint8_t) 127U)

Definition at line 91 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_OK

#define VL53L5CX_STATUS_OK   ((uint8_t) 0U)

Macro VL53L5CX_STATUS_OK indicates that VL53L5 sensor has no error.

Macro VL53L5CX_STATUS_ERROR indicates that something is wrong (value, I2C access, ...). Macro VL53L5CX_MCU_ERROR is used to indicate a MCU issue.

Definition at line 85 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_TIMEOUT_ERROR

#define VL53L5CX_STATUS_TIMEOUT_ERROR   ((uint8_t) 1U)

Definition at line 86 of file vl53l5cx_api.h.

◆ VL53L5CX_STATUS_XTALK_FAILED

#define VL53L5CX_STATUS_XTALK_FAILED   ((uint8_t) 4U)

Definition at line 89 of file vl53l5cx_api.h.

◆ VL53L5CX_TARGET_ORDER_CLOSEST

#define VL53L5CX_TARGET_ORDER_CLOSEST   ((uint8_t) 1U)

Macro VL53L5CX_TARGET_ORDER_STRONGEST or VL53L5CX_TARGET_ORDER_CLOSEST are used to select the target order for data output.

Definition at line 56 of file vl53l5cx_api.h.

◆ VL53L5CX_TARGET_ORDER_STRONGEST

#define VL53L5CX_TARGET_ORDER_STRONGEST   ((uint8_t) 2U)

Definition at line 57 of file vl53l5cx_api.h.

◆ VL53L5CX_TARGET_STATUS_BH

#define VL53L5CX_TARGET_STATUS_BH   ((uint32_t)0x6B900401U)

Definition at line 135 of file vl53l5cx_api.h.

◆ VL53L5CX_TARGET_STATUS_IDX

#define VL53L5CX_TARGET_STATUS_IDX   ((uint16_t)0x6B90U)

Definition at line 146 of file vl53l5cx_api.h.

◆ VL53L5CX_TEMPORARY_BUFFER_SIZE

#define VL53L5CX_TEMPORARY_BUFFER_SIZE   ((uint32_t) 1024U)

Macro VL53L5CX_TEMPORARY_BUFFER_SIZE can be used to know the size of the temporary buffer.

The minimum size is 1024, and the maximum depends of the output configuration.

Definition at line 259 of file vl53l5cx_api.h.

◆ VL53L5CX_UI_CMD_END

#define VL53L5CX_UI_CMD_END   ((uint16_t)0x2FFFU)

Definition at line 181 of file vl53l5cx_api.h.

◆ VL53L5CX_UI_CMD_START

#define VL53L5CX_UI_CMD_START   ((uint16_t)0x2C04U)

Definition at line 180 of file vl53l5cx_api.h.

◆ VL53L5CX_UI_CMD_STATUS

#define VL53L5CX_UI_CMD_STATUS   ((uint16_t)0x2C00U)

Definition at line 179 of file vl53l5cx_api.h.

◆ VL53L5CX_XTALK_BUFFER_SIZE

#define VL53L5CX_XTALK_BUFFER_SIZE   ((uint16_t)776U)

Definition at line 158 of file vl53l5cx_api.h.

Function Documentation

◆ vl53l5cx_check_data_ready()

uint8_t vl53l5cx_check_data_ready ( VL53L5CX_Configuration p_dev,
uint8_t p_isReady 
)

This function checks if a new data is ready by polling I2C.

If a new data is ready, a flag will be raised.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*p_isReady : Value of this pointer be updated to 0 if data is not ready, or 1 if a new data is ready.
Returns
(uint8_t) status : 0 if I2C reading is OK

Definition at line 681 of file vl53l5cx_api.c.

References VL53L5CX_Configuration::platform, RdMulti(), status, VL53L5CX_Configuration::streamcount, VL53L5CX_Configuration::temp_buffer, and VL53L5CX_STATUS_OK.

Referenced by thd_lidar_vl53l5cx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_dci_read_data()

uint8_t vl53l5cx_dci_read_data ( VL53L5CX_Configuration p_dev,
uint8_t data,
uint32_t  index,
uint16_t  data_size 
)

This function can be used to read 'extra data' from DCI.

Using a known index, the function fills the casted structure passed in argument.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*data : This field can be a casted structure, or a simple array. Please note that the FW only accept data of 32 bits. So field data can only have a size of 32, 64, 96, 128, bits ....
(uint32_t)index : Index of required value.
(uint16_t)*data_size: This field must be the structure or array size (using sizeof() function).
Returns
(uint8_t) status : 0 if OK

Definition at line 1194 of file vl53l5cx_api.c.

References _vl53l5cx_poll_for_answer(), VL53L5CX_Configuration::platform, RdMulti(), status, SwapBuffer(), VL53L5CX_Configuration::temp_buffer, VL53L5CX_STATUS_ERROR, VL53L5CX_STATUS_OK, VL53L5CX_TEMPORARY_BUFFER_SIZE, VL53L5CX_UI_CMD_END, VL53L5CX_UI_CMD_START, VL53L5CX_UI_CMD_STATUS, and WrMulti().

Referenced by vl53l5cx_dci_replace_data(), vl53l5cx_get_integration_time_ms(), vl53l5cx_get_ranging_frequency_hz(), vl53l5cx_get_ranging_mode(), vl53l5cx_get_resolution(), vl53l5cx_get_sharpener_percent(), vl53l5cx_get_target_order(), vl53l5cx_set_ranging_mode(), vl53l5cx_set_resolution(), and vl53l5cx_start_ranging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_dci_replace_data()

uint8_t vl53l5cx_dci_replace_data ( VL53L5CX_Configuration p_dev,
uint8_t data,
uint32_t  index,
uint16_t  data_size,
uint8_t new_data,
uint16_t  new_data_size,
uint16_t  new_data_pos 
)

This function can be used to replace 'extra data' in DCI.

The data can be simple data, or casted structure.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*data : This field can be a casted structure, or a simple array. Please note that the FW only accept data of 32 bits. So field data can only have a size of 32, 64, 96, 128, bits ..
(uint32_t)index : Index of required value.
(uint16_t)*data_size: This field must be the structure or array size (using sizeof() function).
(uint8_t)*new_data : Contains the new fields.
(uint16_t)new_data_size : New data size.
(uint16_t)new_data_pos : New data position into the buffer.
Returns
(uint8_t) status : 0 if OK

Definition at line 1295 of file vl53l5cx_api.c.

References status, vl53l5cx_dci_read_data(), vl53l5cx_dci_write_data(), and VL53L5CX_STATUS_OK.

Referenced by vl53l5cx_disable_internal_cp(), vl53l5cx_enable_internal_cp(), vl53l5cx_init(), vl53l5cx_set_integration_time_ms(), vl53l5cx_set_ranging_frequency_hz(), vl53l5cx_set_sharpener_percent(), and vl53l5cx_set_target_order().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_dci_write_data()

uint8_t vl53l5cx_dci_write_data ( VL53L5CX_Configuration p_dev,
uint8_t data,
uint32_t  index,
uint16_t  data_size 
)

This function can be used to write 'extra data' to DCI.

The data can be simple data, or casted structure.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*data : This field can be a casted structure, or a simple array. Please note that the FW only accept data of 32 bits. So field data can only have a size of 32, 64, 96, 128, bits ..
(uint32_t)index : Index of required value.
(uint16_t)*data_size: This field must be the structure or array size (using sizeof() function).
Returns
(uint8_t) status : 0 if OK

Definition at line 1240 of file vl53l5cx_api.c.

References _vl53l5cx_poll_for_answer(), VL53L5CX_Configuration::platform, status, SwapBuffer(), VL53L5CX_Configuration::temp_buffer, VL53L5CX_STATUS_ERROR, VL53L5CX_STATUS_OK, VL53L5CX_TEMPORARY_BUFFER_SIZE, VL53L5CX_UI_CMD_END, VL53L5CX_UI_CMD_STATUS, and WrMulti().

Referenced by vl53l5cx_dci_replace_data(), vl53l5cx_init(), vl53l5cx_set_ranging_mode(), vl53l5cx_set_resolution(), and vl53l5cx_start_ranging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_disable_internal_cp()

uint8_t vl53l5cx_disable_internal_cp ( VL53L5CX_Configuration p_dev)

This function is used to disable the VCSEL charge pump This optimizes the power consumption of the device To be used only if AVDD = 3.3V.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.

Definition at line 1176 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_INTERNAL_CP, vl53l5cx_dci_replace_data(), and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_enable_internal_cp()

uint8_t vl53l5cx_enable_internal_cp ( VL53L5CX_Configuration p_dev)

This function is used to disable the VCSEL charge pump This optimizes the power consumption of the device To be used only if AVDD = 3.3V.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.

Definition at line 1158 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_INTERNAL_CP, vl53l5cx_dci_replace_data(), and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_get_integration_time_ms()

uint8_t vl53l5cx_get_integration_time_ms ( VL53L5CX_Configuration p_dev,
uint32_t p_time_ms 
)

This function gets the current integration time in ms.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint32_t)*p_time_ms: Contains integration time in ms.
Returns
(uint8_t) status : 0 if integration time is OK.

Definition at line 989 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_INT_TIME, vl53l5cx_dci_read_data(), and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_get_power_mode()

uint8_t vl53l5cx_get_power_mode ( VL53L5CX_Configuration p_dev,
uint8_t p_power_mode 
)

This function is used to get the current sensor power mode.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*p_power_mode : Current power mode. The value of this pointer is equal to 0 if the sensor is in low power, (VL53L5CX_POWER_MODE_SLEEP), or 1 if sensor is in standard mode (VL53L5CX_POWER_MODE_WAKEUP).
Returns
(uint8_t) status : 0 if power mode is OK

Definition at line 426 of file vl53l5cx_api.c.

References VL53L5CX_Configuration::platform, RdByte(), status, VL53L5CX_POWER_MODE_SLEEP, VL53L5CX_POWER_MODE_WAKEUP, VL53L5CX_STATUS_ERROR, VL53L5CX_STATUS_OK, and WrByte().

Referenced by vl53l5cx_set_power_mode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_get_ranging_data()

uint8_t vl53l5cx_get_ranging_data ( VL53L5CX_Configuration p_dev,
VL53L5CX_ResultsData p_results 
)

◆ vl53l5cx_get_ranging_frequency_hz()

uint8_t vl53l5cx_get_ranging_frequency_hz ( VL53L5CX_Configuration p_dev,
uint8_t p_frequency_hz 
)

This function gets the current ranging frequency in Hz.

Ranging frequency corresponds to the time between each measurement.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*p_frequency_hz: Contains the ranging frequency in Hz.
Returns
(uint8_t) status : 0 if ranging frequency is OK.

Definition at line 963 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_FREQ_HZ, vl53l5cx_dci_read_data(), and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_get_ranging_mode()

uint8_t vl53l5cx_get_ranging_mode ( VL53L5CX_Configuration p_dev,
uint8_t p_ranging_mode 
)

This function is used to get the ranging mode.

Two modes are available using ULD : Continuous and autonomous. The default mode is Autonomous.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*p_ranging_mode : current ranging mode
Returns
(uint8_t) status : 0 if get ranging mode is OK.

Definition at line 1098 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_RANGING_MODE, vl53l5cx_dci_read_data(), VL53L5CX_RANGING_MODE_AUTONOMOUS, VL53L5CX_RANGING_MODE_CONTINUOUS, and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_get_resolution()

uint8_t vl53l5cx_get_resolution ( VL53L5CX_Configuration p_dev,
uint8_t p_resolution 
)

This function gets the current resolution (4x4 or 8x8).

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*p_resolution : Value of this pointer will be equal to 16 for 4x4 mode, and 64 for 8x8 mode.
Returns
(uint8_t) status : 0 if resolution is OK.

Definition at line 883 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, vl53l5cx_dci_read_data(), VL53L5CX_DCI_ZONE_CONFIG, and VL53L5CX_STATUS_OK.

Referenced by vl53l5cx_start_ranging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_get_sharpener_percent()

uint8_t vl53l5cx_get_sharpener_percent ( VL53L5CX_Configuration p_dev,
uint8_t p_sharpener_percent 
)

This function gets the current sharpener in percent.

Sharpener can be changed to blur more or less zones depending of the application.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint32_t)*p_sharpener_percent: Contains the sharpener in percent.
Returns
(uint8_t) status : 0 if get sharpener is OK.

Definition at line 1028 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, vl53l5cx_dci_read_data(), VL53L5CX_DCI_SHARPENER, and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_get_target_order()

uint8_t vl53l5cx_get_target_order ( VL53L5CX_Configuration p_dev,
uint8_t p_target_order 
)

This function gets the current target order (closest or strongest).

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)*p_target_order: Contains the target order.
Returns
(uint8_t) status : 0 if get target order is OK.

Definition at line 1065 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, vl53l5cx_dci_read_data(), VL53L5CX_DCI_TARGET_ORDER, and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_init()

◆ vl53l5cx_is_alive()

uint8_t vl53l5cx_is_alive ( VL53L5CX_Configuration p_dev,
uint8_t p_is_alive 
)

Definition at line 221 of file vl53l5cx_api.c.

References VL53L5CX_Configuration::platform, RdByte(), status, VL53L5CX_STATUS_OK, and WrByte().

Referenced by thd_lidar_vl53l5cx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_set_i2c_address()

uint8_t vl53l5cx_set_i2c_address ( VL53L5CX_Configuration p_dev,
uint16_t  i2c_address 
)

This function is used to change the I2C address of the sensor.

If multiple VL53L5 sensors are connected to the same I2C line, all other LPn pins needs to be set to Low. The default sensor address is 0x52.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint16_t)i2c_address : New I2C address.
Returns
(uint8_t) status : 0 if new address is OK

Definition at line 412 of file vl53l5cx_api.c.

References VL53L5CX_Platform::address, VL53L5CX_Configuration::platform, status, VL53L5CX_STATUS_OK, and WrByte().

+ Here is the call graph for this function:

◆ vl53l5cx_set_integration_time_ms()

uint8_t vl53l5cx_set_integration_time_ms ( VL53L5CX_Configuration p_dev,
uint32_t  integration_time_ms 
)

This function sets a new integration time in ms.

Integration time must be computed to be lower than the ranging period, for a selected resolution. Please note that this function has no impact on ranging mode continous.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint32_t)time_ms : Contains the integration time in ms. For all resolutions and frequency, the minimum value is 2ms, and the maximum is 1000ms.
Returns
(uint8_t) status : 0 if set integration time is OK.

Definition at line 1004 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_INT_TIME, vl53l5cx_dci_replace_data(), VL53L5CX_STATUS_INVALID_PARAM, and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_set_power_mode()

uint8_t vl53l5cx_set_power_mode ( VL53L5CX_Configuration p_dev,
uint8_t  power_mode 
)

This function is used to set the sensor in Low Power mode, for example if the sensor is not used during a long time.

The macro VL53L5CX_POWER_MODE_SLEEP can be used to enable the low power mode. When user want to restart the sensor, he can use macro VL53L5CX_POWER_MODE_WAKEUP. Please ensure that the device is not streaming before calling the function.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)power_mode : Selected power mode (VL53L5CX_POWER_MODE_SLEEP or VL53L5CX_POWER_MODE_WAKEUP)
Returns
(uint8_t) status : 0 if power mode is OK, or 127 if power mode requested by user is not valid.

Definition at line 455 of file vl53l5cx_api.c.

References _vl53l5cx_poll_for_answer(), VL53L5CX_Configuration::platform, status, vl53l5cx_get_power_mode(), VL53L5CX_POWER_MODE_SLEEP, VL53L5CX_POWER_MODE_WAKEUP, VL53L5CX_STATUS_ERROR, VL53L5CX_STATUS_OK, and WrByte().

+ Here is the call graph for this function:

◆ vl53l5cx_set_ranging_frequency_hz()

uint8_t vl53l5cx_set_ranging_frequency_hz ( VL53L5CX_Configuration p_dev,
uint8_t  frequency_hz 
)

This function sets a new ranging frequency in Hz.

Ranging frequency corresponds to the measurements frequency. This setting depends of the resolution, so please select your resolution before using this function.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)frequency_hz : Contains the ranging frequency in Hz.
  • For 4x4, min and max allowed values are : [1;60]
  • For 8x8, min and max allowed values are : [1;15]
Returns
(uint8_t) status : 0 if ranging frequency is OK, or 127 if the value is not correct.

Definition at line 976 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_FREQ_HZ, vl53l5cx_dci_replace_data(), and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_set_ranging_mode()

uint8_t vl53l5cx_set_ranging_mode ( VL53L5CX_Configuration p_dev,
uint8_t  ranging_mode 
)

This function is used to set the ranging mode.

Two modes are available using ULD : Continuous and autonomous. The default mode is Autonomous.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)ranging_mode : Use macros VL53L5CX_RANGING_MODE_CONTINUOUS, VL53L5CX_RANGING_MODE_CONTINUOUS.
Returns
(uint8_t) status : 0 if set ranging mode is OK.

Definition at line 1119 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_RANGING_MODE, vl53l5cx_dci_read_data(), VL53L5CX_DCI_SINGLE_RANGE, vl53l5cx_dci_write_data(), VL53L5CX_RANGING_MODE_AUTONOMOUS, VL53L5CX_RANGING_MODE_CONTINUOUS, VL53L5CX_STATUS_INVALID_PARAM, and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_set_resolution()

uint8_t vl53l5cx_set_resolution ( VL53L5CX_Configuration p_dev,
uint8_t  resolution 
)

This function sets a new resolution (4x4 or 8x8).

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)resolution : Use macro VL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8 to set the resolution.
Returns
(uint8_t) status : 0 if set resolution is OK.

Definition at line 898 of file vl53l5cx_api.c.

References _vl53l5cx_send_offset_data(), _vl53l5cx_send_xtalk_data(), status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_DSS_CONFIG, vl53l5cx_dci_read_data(), vl53l5cx_dci_write_data(), VL53L5CX_DCI_ZONE_CONFIG, VL53L5CX_RESOLUTION_4X4, VL53L5CX_RESOLUTION_8X8, VL53L5CX_STATUS_INVALID_PARAM, and VL53L5CX_STATUS_OK.

Referenced by thd_lidar_vl53l5cx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vl53l5cx_set_sharpener_percent()

uint8_t vl53l5cx_set_sharpener_percent ( VL53L5CX_Configuration p_dev,
uint8_t  sharpener_percent 
)

This function sets a new sharpener value in percent.

Sharpener can be changed to blur more or less zones depending of the application. Min value is 0 (disabled), and max is 99.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint32_t)sharpener_percent : Value between 0 (disabled) and 99%.
Returns
(uint8_t) status : 0 if set sharpener is OK.

Definition at line 1043 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, vl53l5cx_dci_replace_data(), VL53L5CX_DCI_SHARPENER, VL53L5CX_STATUS_INVALID_PARAM, and VL53L5CX_STATUS_OK.

+ Here is the call graph for this function:

◆ vl53l5cx_set_target_order()

uint8_t vl53l5cx_set_target_order ( VL53L5CX_Configuration p_dev,
uint8_t  target_order 
)

This function sets a new target order.

Please use macros VL53L5CX_TARGET_ORDER_STRONGEST and VL53L5CX_TARGET_ORDER_CLOSEST to define the new output order. By default, the sensor is configured with the strongest output.

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
(uint8_t)target_order : Required target order.
Returns
(uint8_t) status : 0 if set target order is OK, or 127 if target order is unknown.

Definition at line 1078 of file vl53l5cx_api.c.

References status, VL53L5CX_Configuration::temp_buffer, vl53l5cx_dci_replace_data(), VL53L5CX_DCI_TARGET_ORDER, VL53L5CX_STATUS_INVALID_PARAM, VL53L5CX_STATUS_OK, VL53L5CX_TARGET_ORDER_CLOSEST, and VL53L5CX_TARGET_ORDER_STRONGEST.

+ Here is the call graph for this function:

◆ vl53l5cx_start_ranging()

◆ vl53l5cx_stop_ranging()

uint8_t vl53l5cx_stop_ranging ( VL53L5CX_Configuration p_dev)

This function stops the ranging session.

It must be used when the sensor streams, after calling vl53l5cx_start_ranging().

Parameters
(VL53L5CX_Configuration)*p_dev : VL53L5CX configuration structure.
Returns
(uint8_t) status : 0 if stop is OK

Definition at line 627 of file vl53l5cx_api.c.

References VL53L5CX_Configuration::is_auto_stop_enabled, VL53L5CX_Configuration::platform, RdByte(), RdMulti(), status, timeout, VL53L5CX_STATUS_OK, WaitMs(), and WrByte().

+ Here is the call graph for this function: