Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
vl53l5cx_api.c File Reference
#include <stdlib.h>
#include <string.h>
#include "vl53l5cx_api.h"
#include "vl53l5cx_buffers.h"
+ Include dependency graph for vl53l5cx_api.c:

Go to the source code of this file.

Functions

static uint8_t _vl53l5cx_poll_for_answer (VL53L5CX_Configuration *p_dev, uint8_t size, uint8_t pos, uint16_t address, uint8_t mask, uint8_t expected_value)
 Copyright (c) 2021 STMicroelectronics. More...
 
static uint8_t _vl53l5cx_poll_for_mcu_boot (VL53L5CX_Configuration *p_dev)
 
static uint8_t _vl53l5cx_send_offset_data (VL53L5CX_Configuration *p_dev, uint8_t resolution)
 Inner function, not available outside this file. More...
 
static uint8_t _vl53l5cx_send_xtalk_data (VL53L5CX_Configuration *p_dev, uint8_t resolution)
 Inner function, not available outside this file. More...
 
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...
 

Function Documentation

◆ _vl53l5cx_poll_for_answer()

static uint8_t _vl53l5cx_poll_for_answer ( VL53L5CX_Configuration p_dev,
uint8_t  size,
uint8_t  pos,
uint16_t  address,
uint8_t  mask,
uint8_t  expected_value 
)
static

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

Inner function, not available outside this file. This function is used to wait for an answer from VL53L5CX sensor.

Definition at line 27 of file vl53l5cx_api.c.

References VL53L5CX_Configuration::platform, RdMulti(), status, VL53L5CX_Configuration::temp_buffer, timeout, VL53L5CX_MCU_ERROR, VL53L5CX_STATUS_OK, VL53L5CX_STATUS_TIMEOUT_ERROR, and WaitMs().

Referenced by _vl53l5cx_send_offset_data(), _vl53l5cx_send_xtalk_data(), vl53l5cx_dci_read_data(), vl53l5cx_dci_write_data(), vl53l5cx_init(), vl53l5cx_set_power_mode(), and vl53l5cx_start_ranging().

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

◆ _vl53l5cx_poll_for_mcu_boot()

static uint8_t _vl53l5cx_poll_for_mcu_boot ( VL53L5CX_Configuration p_dev)
static

Definition at line 66 of file vl53l5cx_api.c.

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

Referenced by vl53l5cx_init().

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

◆ _vl53l5cx_send_offset_data()

static uint8_t _vl53l5cx_send_offset_data ( VL53L5CX_Configuration p_dev,
uint8_t  resolution 
)
static

Inner function, not available outside this file.

This function is used to set the offset data gathered from NVM.

Definition at line 96 of file vl53l5cx_api.c.

References _vl53l5cx_poll_for_answer(), VL53L5CX_Configuration::offset_data, VL53L5CX_Configuration::platform, status, SwapBuffer(), VL53L5CX_Configuration::temp_buffer, VL53L5CX_OFFSET_BUFFER_SIZE, VL53L5CX_RESOLUTION_4X4, VL53L5CX_STATUS_OK, VL53L5CX_UI_CMD_STATUS, and WrMulti().

Referenced by vl53l5cx_init(), and vl53l5cx_set_resolution().

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

◆ _vl53l5cx_send_xtalk_data()

static uint8_t _vl53l5cx_send_xtalk_data ( VL53L5CX_Configuration p_dev,
uint8_t  resolution 
)
static

Inner function, not available outside this file.

This function is used to set the Xtalk data from generic configuration, or user's calibration.

Definition at line 166 of file vl53l5cx_api.c.

References _vl53l5cx_poll_for_answer(), VL53L5CX_Configuration::platform, status, SwapBuffer(), VL53L5CX_Configuration::temp_buffer, VL53L5CX_RESOLUTION_4X4, VL53L5CX_STATUS_OK, VL53L5CX_UI_CMD_STATUS, VL53L5CX_XTALK_BUFFER_SIZE, WrMulti(), and VL53L5CX_Configuration::xtalk_data.

Referenced by vl53l5cx_init(), and vl53l5cx_set_resolution().

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

◆ 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: