Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "lidar/vl53l5cx_platform.h"
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.__unnamed354__ |
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... | |
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.
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] |
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 :
Definition at line 304 of file vl53l5cx_api.h.
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)] |
union Block_header |
Definition at line 371 of file vl53l5cx_api.h.
Data Fields | ||
---|---|---|
struct Block_header | __unnamed__ | |
uint32_t | bytes |
struct VL53L5CX_ResultsData.motion_indicator |
struct Block_header.__unnamed354__ |
Definition at line 373 of file vl53l5cx_api.h.
Data Fields | ||
---|---|---|
uint32_t | idx: 16 | |
uint32_t | size: 12 | |
uint32_t | type: 4 |
#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.
#define L5CX_DIST_SIZE ((128U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U) |
Definition at line 218 of file vl53l5cx_api.h.
#define L5CX_MOT_SIZE 144U |
Definition at line 236 of file vl53l5cx_api.h.
#define L5CX_NTAR_SIZE 68U |
Definition at line 200 of file vl53l5cx_api.h.
#define L5CX_RFLEST_SIZE ((64U *VL53L5CX_NB_TARGET_PER_ZONE) + 4U) |
Definition at line 224 of file vl53l5cx_api.h.
#define L5CX_SIGR_SIZE ((128U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U) |
Definition at line 212 of file vl53l5cx_api.h.
#define L5CX_SPAD_SIZE 260U |
Definition at line 194 of file vl53l5cx_api.h.
#define L5CX_SPS_SIZE ((256U * VL53L5CX_NB_TARGET_PER_ZONE) + 4U) |
Definition at line 206 of file vl53l5cx_api.h.
#define L5CX_STA_SIZE ((64U *VL53L5CX_NB_TARGET_PER_ZONE) + 4U) |
Definition at line 230 of file vl53l5cx_api.h.
#define VL53L5CX_AMBIENT_RATE_BH ((uint32_t)0x54D00104U) |
Definition at line 128 of file vl53l5cx_api.h.
#define VL53L5CX_AMBIENT_RATE_IDX ((uint16_t)0x54D0U) |
Definition at line 140 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_COMMONDATA_BH ((uint32_t)0x54C00040U) |
Definition at line 127 of file vl53l5cx_api.h.
#define VL53L5CX_CONFIGURATION_SIZE ((uint16_t)972U) |
Definition at line 156 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_DSS_CONFIG ((uint16_t)0xAD38U) |
Definition at line 165 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_FREQ_HZ ((uint16_t)0x5458U) |
Definition at line 161 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_FW_NB_TARGET ((uint16_t)0x5478) |
Definition at line 163 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_INT_TIME ((uint16_t)0x545CU) |
Definition at line 162 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_INTERNAL_CP ((uint16_t)0xB39CU) |
Definition at line 168 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_MOTION_DETECTOR_CFG ((uint16_t)0xBFACU) |
Definition at line 170 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_OUTPUT_CONFIG ((uint16_t)0xD968U) |
Definition at line 172 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_OUTPUT_ENABLES ((uint16_t)0xD970U) |
Definition at line 173 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_OUTPUT_LIST ((uint16_t)0xD980U) |
Definition at line 174 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_PIPE_CONTROL ((uint16_t)0xDB80U) |
Definition at line 175 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_RANGING_MODE ((uint16_t)0xAD30U) |
Definition at line 164 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_SHARPENER ((uint16_t)0xAED8U) |
Definition at line 167 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_SINGLE_RANGE ((uint16_t)0xD964U) |
Definition at line 171 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_SYNC_PIN ((uint16_t)0xB5F0U) |
Definition at line 169 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_TARGET_ORDER ((uint16_t)0xAE64U) |
Definition at line 166 of file vl53l5cx_api.h.
#define VL53L5CX_DCI_ZONE_CONFIG ((uint16_t)0x5450U) |
Definition at line 160 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_DISTANCE_BH ((uint32_t)0x66900402U) |
Definition at line 133 of file vl53l5cx_api.h.
#define VL53L5CX_DISTANCE_IDX ((uint16_t)0x6690U) |
Definition at line 144 of file vl53l5cx_api.h.
#define VL53L5CX_GLARE_FILTER ((uint16_t)0xE108U) |
Definition at line 176 of file vl53l5cx_api.h.
#define VL53L5CX_MAX_RESULTS_SIZE |
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.
#define VL53L5CX_MCU_ERROR ((uint8_t) 66U) |
Definition at line 90 of file vl53l5cx_api.h.
#define VL53L5CX_METADATA_BH ((uint32_t)0x54B400C0U) |
Definition at line 126 of file vl53l5cx_api.h.
#define VL53L5CX_METADATA_IDX ((uint16_t)0x54B4U) |
Definition at line 138 of file vl53l5cx_api.h.
#define VL53L5CX_MOTION_DETEC_IDX ((uint16_t)0xCC50U) |
Definition at line 147 of file vl53l5cx_api.h.
#define VL53L5CX_MOTION_DETECT_BH ((uint32_t)0xCC5008C0U) |
Definition at line 136 of file vl53l5cx_api.h.
#define VL53L5CX_NB_TARGET_DETECTED_BH ((uint32_t)0x57D00401U) |
Definition at line 129 of file vl53l5cx_api.h.
#define VL53L5CX_NB_TARGET_DETECTED_IDX ((uint16_t)0x57D0U) |
Definition at line 141 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_OFFSET_BUFFER_SIZE ((uint16_t)488U) |
Definition at line 157 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_POWER_MODE_WAKEUP ((uint8_t) 1U) |
Definition at line 77 of file vl53l5cx_api.h.
#define VL53L5CX_RANGE_SIGMA_MM_BH ((uint32_t)0x64900402U) |
Definition at line 132 of file vl53l5cx_api.h.
#define VL53L5CX_RANGE_SIGMA_MM_IDX ((uint16_t)0x6490U) |
Definition at line 143 of file vl53l5cx_api.h.
#define VL53L5CX_RANGING_MODE_AUTONOMOUS ((uint8_t) 3U) |
Definition at line 67 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_REFLECTANCE_BH ((uint32_t)0x6A900401U) |
Definition at line 134 of file vl53l5cx_api.h.
#define VL53L5CX_REFLECTANCE_EST_PC_IDX ((uint16_t)0x6A90U) |
Definition at line 145 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_RESOLUTION_8X8 ((uint8_t) 64U) |
Definition at line 48 of file vl53l5cx_api.h.
#define VL53L5CX_SIGNAL_RATE_BH ((uint32_t)0x58900404U) |
Definition at line 131 of file vl53l5cx_api.h.
#define VL53L5CX_SIGNAL_RATE_IDX ((uint16_t)0x5890U) |
Definition at line 142 of file vl53l5cx_api.h.
#define VL53L5CX_SPAD_COUNT_BH ((uint32_t)0x55D00404U) |
Definition at line 130 of file vl53l5cx_api.h.
#define VL53L5CX_SPAD_COUNT_IDX ((uint16_t)0x55D0U) |
Definition at line 139 of file vl53l5cx_api.h.
#define VL53L5CX_START_BH ((uint32_t)0x0000000DU) |
Definitions for Range results block headers.
Definition at line 125 of file vl53l5cx_api.h.
#define VL53L5CX_STATUS_CORRUPTED_FRAME ((uint8_t) 2U) |
Definition at line 87 of file vl53l5cx_api.h.
#define VL53L5CX_STATUS_CRC_CSUM_FAILED ((uint8_t) 3U) |
Definition at line 88 of file vl53l5cx_api.h.
#define VL53L5CX_STATUS_ERROR ((uint8_t) 255U) |
Definition at line 92 of file vl53l5cx_api.h.
#define VL53L5CX_STATUS_INVALID_PARAM ((uint8_t) 127U) |
Definition at line 91 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_STATUS_TIMEOUT_ERROR ((uint8_t) 1U) |
Definition at line 86 of file vl53l5cx_api.h.
#define VL53L5CX_STATUS_XTALK_FAILED ((uint8_t) 4U) |
Definition at line 89 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_TARGET_ORDER_STRONGEST ((uint8_t) 2U) |
Definition at line 57 of file vl53l5cx_api.h.
#define VL53L5CX_TARGET_STATUS_BH ((uint32_t)0x6B900401U) |
Definition at line 135 of file vl53l5cx_api.h.
#define VL53L5CX_TARGET_STATUS_IDX ((uint16_t)0x6B90U) |
Definition at line 146 of file vl53l5cx_api.h.
#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.
#define VL53L5CX_UI_CMD_END ((uint16_t)0x2FFFU) |
Definition at line 181 of file vl53l5cx_api.h.
#define VL53L5CX_UI_CMD_START ((uint16_t)0x2C04U) |
Definition at line 180 of file vl53l5cx_api.h.
#define VL53L5CX_UI_CMD_STATUS ((uint16_t)0x2C00U) |
Definition at line 179 of file vl53l5cx_api.h.
#define VL53L5CX_XTALK_BUFFER_SIZE ((uint16_t)776U) |
Definition at line 158 of file vl53l5cx_api.h.
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.
(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. |
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().
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.
(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). |
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().
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.
(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. |
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().
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.
(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). |
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().
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.
(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.
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.
(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.
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint32_t) | *p_time_ms: Contains integration time in ms. |
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.
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.
(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). |
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().
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(VL53L5CX_ResultsData) | *p_results : VL53L5 results structure. |
Definition at line 712 of file vl53l5cx_api.c.
References VL53L5CX_ResultsData::ambient_per_spad, VL53L5CX_Configuration::data_read_size, VL53L5CX_ResultsData::distance_mm, VL53L5CX_ResultsData::motion_indicator, VL53L5CX_ResultsData::nb_spads_enabled, VL53L5CX_ResultsData::nb_target_detected, VL53L5CX_Configuration::platform, VL53L5CX_ResultsData::range_sigma_mm, RdMulti(), VL53L5CX_ResultsData::reflectance, VL53L5CX_ResultsData::signal_per_spad, VL53L5CX_ResultsData::silicon_temp_degc, status, VL53L5CX_Configuration::streamcount, SwapBuffer(), VL53L5CX_ResultsData::target_status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_AMBIENT_RATE_IDX, VL53L5CX_DISTANCE_IDX, VL53L5CX_METADATA_IDX, VL53L5CX_MOTION_DETEC_IDX, VL53L5CX_NB_TARGET_DETECTED_IDX, VL53L5CX_NB_TARGET_PER_ZONE, VL53L5CX_RANGE_SIGMA_MM_IDX, VL53L5CX_REFLECTANCE_EST_PC_IDX, VL53L5CX_RESOLUTION_8X8, VL53L5CX_SIGNAL_RATE_IDX, VL53L5CX_SPAD_COUNT_IDX, VL53L5CX_STATUS_CORRUPTED_FRAME, VL53L5CX_STATUS_OK, and VL53L5CX_TARGET_STATUS_IDX.
Referenced by thd_lidar_vl53l5cx().
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | *p_frequency_hz: Contains the ranging frequency in Hz. |
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.
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | *p_ranging_mode : current ranging mode |
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.
uint8_t vl53l5cx_get_resolution | ( | VL53L5CX_Configuration * | p_dev, |
uint8_t * | p_resolution | ||
) |
This function gets the current resolution (4x4 or 8x8).
(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. |
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().
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint32_t) | *p_sharpener_percent: Contains the sharpener in percent. |
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.
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).
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | *p_target_order: Contains the target order. |
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.
uint8_t vl53l5cx_init | ( | VL53L5CX_Configuration * | p_dev | ) |
Mandatory function used to initialize the sensor.
This function must be called after a power on, to load the firmware into the VL53L5CX. It takes a few hundred milliseconds.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
Definition at line 245 of file vl53l5cx_api.c.
References _vl53l5cx_poll_for_answer(), _vl53l5cx_poll_for_mcu_boot(), _vl53l5cx_send_offset_data(), _vl53l5cx_send_xtalk_data(), VL53L5CX_Configuration::default_configuration, VL53L5CX_Configuration::default_xtalk, VL53L5CX_Configuration::is_auto_stop_enabled, VL53L5CX_Configuration::offset_data, VL53L5CX_Configuration::platform, RdByte(), RdMulti(), status, VL53L5CX_Configuration::temp_buffer, VL53L5CX_DCI_FW_NB_TARGET, VL53L5CX_DCI_PIPE_CONTROL, vl53l5cx_dci_replace_data(), VL53L5CX_DCI_SINGLE_RANGE, vl53l5cx_dci_write_data(), VL53L5CX_DEFAULT_CONFIGURATION, VL53L5CX_DEFAULT_XTALK, VL53L5CX_FIRMWARE, VL53L5CX_GET_NVM_CMD, VL53L5CX_GLARE_FILTER, VL53L5CX_NB_TARGET_PER_ZONE, VL53L5CX_NVM_DATA_SIZE, VL53L5CX_OFFSET_BUFFER_SIZE, VL53L5CX_RESOLUTION_4X4, VL53L5CX_STATUS_OK, VL53L5CX_UI_CMD_START, VL53L5CX_UI_CMD_STATUS, VL53L5CX_XTALK_BUFFER_SIZE, WaitMs(), WrByte(), WrMulti(), and VL53L5CX_Configuration::xtalk_data.
Referenced by thd_lidar_vl53l5cx().
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().
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint16_t) | i2c_address : New I2C address. |
Definition at line 412 of file vl53l5cx_api.c.
References VL53L5CX_Platform::address, VL53L5CX_Configuration::platform, status, VL53L5CX_STATUS_OK, and WrByte().
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.
(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. |
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.
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | power_mode : Selected power mode (VL53L5CX_POWER_MODE_SLEEP or VL53L5CX_POWER_MODE_WAKEUP) |
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().
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | frequency_hz : Contains the ranging frequency in Hz.
|
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.
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | ranging_mode : Use macros VL53L5CX_RANGING_MODE_CONTINUOUS, VL53L5CX_RANGING_MODE_CONTINUOUS. |
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.
uint8_t vl53l5cx_set_resolution | ( | VL53L5CX_Configuration * | p_dev, |
uint8_t | resolution | ||
) |
This function sets a new resolution (4x4 or 8x8).
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | resolution : Use macro VL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8 to set the resolution. |
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().
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint32_t) | sharpener_percent : Value between 0 (disabled) and 99%. |
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.
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.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
(uint8_t) | target_order : Required target order. |
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.
uint8_t vl53l5cx_start_ranging | ( | VL53L5CX_Configuration * | p_dev | ) |
This function starts a ranging session.
When the sensor streams, host cannot change settings 'on-the-fly'.
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
Definition at line 490 of file vl53l5cx_api.c.
References _vl53l5cx_poll_for_answer(), VL53L5CX_Configuration::data_read_size, VL53L5CX_Configuration::platform, status, VL53L5CX_Configuration::streamcount, VL53L5CX_Configuration::temp_buffer, VL53L5CX_AMBIENT_RATE_BH, VL53L5CX_COMMONDATA_BH, VL53L5CX_DCI_OUTPUT_CONFIG, VL53L5CX_DCI_OUTPUT_ENABLES, VL53L5CX_DCI_OUTPUT_LIST, vl53l5cx_dci_read_data(), vl53l5cx_dci_write_data(), VL53L5CX_DISTANCE_BH, vl53l5cx_get_resolution(), VL53L5CX_METADATA_BH, VL53L5CX_MOTION_DETECT_BH, VL53L5CX_NB_TARGET_DETECTED_BH, VL53L5CX_NB_TARGET_PER_ZONE, VL53L5CX_RANGE_SIGMA_MM_BH, VL53L5CX_REFLECTANCE_BH, VL53L5CX_SIGNAL_RATE_BH, VL53L5CX_SPAD_COUNT_BH, VL53L5CX_START_BH, VL53L5CX_STATUS_ERROR, VL53L5CX_STATUS_OK, VL53L5CX_TARGET_STATUS_BH, VL53L5CX_UI_CMD_END, VL53L5CX_UI_CMD_STATUS, WrByte(), and WrMulti().
Referenced by thd_lidar_vl53l5cx().
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().
(VL53L5CX_Configuration) | *p_dev : VL53L5CX configuration structure. |
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().