|
CRINSA-team2025 V1
Documentation du Club Robot INSA Rennes 2025
|

Fonctions membres publiques | |
| VL53L5CX (i2c_t *i2c) | |
| virtual | ~VL53L5CX () |
| int | init_sensor (uint8_t addr=VL53L5CX_DEFAULT_I2C_ADDRESS) |
| Initialize the sensor. | |
| uint8_t | vl53l5cx_is_alive (uint8_t *p_is_alive) |
| This function is used to check if the sensor is alive. | |
| uint8_t | vl53l5cx_init () |
| 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. | |
| uint8_t | vl53l5cx_set_i2c_address (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. | |
| uint8_t | vl53l5cx_get_power_mode (uint8_t *p_power_mode) |
| This function is used to get the current sensor power mode. | |
| uint8_t | vl53l5cx_set_power_mode (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. | |
| uint8_t | vl53l5cx_start_ranging () |
| This function starts a ranging session. When the sensor streams, host cannot change settings 'on-the-fly'. | |
| uint8_t | vl53l5cx_stop_ranging () |
| This function stops the ranging session. It must be used when the sensor streams, after calling vl53l5cx_start_ranging(). | |
| uint8_t | vl53l5cx_check_data_ready (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. | |
| uint8_t | vl53l5cx_get_ranging_data (VL53L5CX_ResultsData *p_results) |
| This function gets the ranging data, using the selected output and the resolution. | |
| uint8_t | vl53l5cx_get_resolution (uint8_t *p_resolution) |
| This function gets the current resolution (4x4 or 8x8). | |
| uint8_t | vl53l5cx_set_resolution (uint8_t resolution) |
| This function sets a new resolution (4x4 or 8x8). | |
| uint8_t | vl53l5cx_get_ranging_frequency_hz (uint8_t *p_frequency_hz) |
| This function gets the current ranging frequency in Hz. Ranging frequency corresponds to the time between each measurement. | |
| uint8_t | vl53l5cx_set_ranging_frequency_hz (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. | |
| uint8_t | vl53l5cx_get_integration_time_ms (uint32_t *p_time_ms) |
| This function gets the current integration time in ms. | |
| uint8_t | vl53l5cx_set_integration_time_ms (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 continuous. | |
| uint8_t | vl53l5cx_get_sharpener_percent (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. | |
| uint8_t | vl53l5cx_set_sharpener_percent (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. | |
| uint8_t | vl53l5cx_get_target_order (uint8_t *p_target_order) |
| This function gets the current target order (closest or strongest). | |
| uint8_t | vl53l5cx_set_target_order (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. | |
| uint8_t | vl53l5cx_get_ranging_mode (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. | |
| uint8_t | vl53l5cx_set_ranging_mode (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. | |
| uint8_t | vl53l5cx_dci_read_data (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. | |
| uint8_t | vl53l5cx_dci_write_data (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. | |
| uint8_t | vl53l5cx_dci_replace_data (uint8_t *data, uint32_t index, uint16_t data_size, uint8_t *new_data, uint16_t new_data_size, uint16_t new_data_pos) |
| void | SwapBuffer (uint8_t *buffer, uint16_t size) |
| uint8_t | get_stream_count (void) |
Attributs publics | |
| VL53L5CX_Configuration | _dev |
| VL53L5CX_Configuration * | p_dev |
Fonctions membres protégées | |
| uint8_t | _vl53l5cx_poll_for_answer (uint8_t size, uint8_t pos, uint16_t address, uint8_t mask, uint8_t expected_value) |
| Inner function, not available outside this file. This function is used to wait for an answer from VL53L5CX sensor. | |
| uint8_t | _vl53l5cx_poll_for_mcu_boot () |
| uint8_t | _vl53l5cx_send_offset_data (uint8_t resolution) |
| Inner function, not available outside this file. This function is used to set the offset data gathered from NVM. | |
| uint8_t | _vl53l5cx_send_xtalk_data (uint8_t resolution) |
| Inner function, not available outside this file. This function is used to set the Xtalk data from generic configuration, or user's calibration. | |
| uint8_t | _vl53l5cx_poll_for_answer_xtalk (uint16_t address, uint8_t expected_value) |
| Inner function, not available outside this file. This function is used to wait for an answer from VL53L5 sensor. | |
| uint8_t | _vl53l5cx_program_output_config () |
| Inner function, not available outside this file. This function is used to program the output using the macro defined into the 'platform.h' file. | |
| uint8_t | RdByte (VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t *p_value) |
| uint8_t | WrByte (VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t value) |
| Mandatory function used to write one single byte. | |
| uint8_t | RdMulti (VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t *p_values, uint32_t size) |
| Mandatory function used to read multiples bytes. | |
| uint8_t | WrMulti (VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t *p_values, uint32_t size) |
| Mandatory function used to write multiples bytes. | |
| uint8_t | WaitMs (VL53L5CX_Platform *p_platform, uint32_t TimeMs) |
| Mandatory function, used to wait during an amount of time. It must be filled as it's used into the API. | |
| uint8_t | vl53l5cx_set_VHV_repeat_count (uint32_t repeat_count) |
| uint8_t | vl53l5cx_get_VHV_repeat_count (uint32_t *p_repeat_count) |
| uint8_t | vl53l5cx_disable_internal_cp () |
| uint8_t | vl53l5cx_enable_internal_cp () |
|
inline |
Constructor
| [in] | i2c | device I2C to be used for communication |
| [in] | lpn_pin | pin to be used as component LPn |
| [in] | i2c_rst_pin | pin to be used as component I2C_RST |
|
inlinevirtual |
Destructor
|
protected |
Inner function, not available outside this file. This function is used to wait for an answer from VL53L5CX sensor.
Copyright (c) 2021 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.


|
inline |
Initialize the sensor.
| (uint8_t) | addr : New I2C address. |

|
protected |
| (VL53L5CX_Platform*) | p_platform : Pointer of VL53L5CX platform structure. |
| (uint16_t) | Address : I2C location of value to read. |
| (uint8_t) | *p_values : Pointer of value to read. |


|
protected |
Mandatory function used to read multiples bytes.
| (VL53L5CX_Platform*) | p_platform : Pointer of VL53L5CX platform structure. |
| (uint16_t) | Address : I2C location of values to read. |
| (uint8_t) | *p_values : Buffer of bytes to read. |
| (uint32_t) | size : Size of *p_values buffer. |

| uint8_t VL53L5CX::vl53l5cx_check_data_ready | ( | 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.
| (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. |

| uint8_t VL53L5CX::vl53l5cx_dci_read_data | ( | 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.
| (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 VL53L5CX::vl53l5cx_dci_replace_data | ( | uint8_t * | data, |
| uint32_t | index, | ||
| uint16_t | data_size, | ||
| uint8_t * | new_data, | ||
| uint16_t | new_data_size, | ||
| uint16_t | new_data_pos ) |
@brief This function can be used to replace 'extra data' in DCI. The data can be simple data, or casted structure. @param (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 .. @param (uint32_t) index : Index of required value. @param (uint16_t)*data_size : This field must be the structure or array size (using sizeof() function). @param (uint8_t) *new_data : Contains the new fields. @param (uint16_t) new is
_po r_m ion tin st rt__data_size : New data size.
| (uint16_t) | new_data_pos : New data position into the buffer. |


| uint8_t VL53L5CX::vl53l5cx_dci_write_data | ( | 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.
| (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 VL53L5CX::vl53l5cx_get_integration_time_ms | ( | uint32_t * | p_time_ms | ) |
This function gets the current integration time in ms.
| (uint32_t) | *p_time_ms: Contains integration time in ms. |

| uint8_t VL53L5CX::vl53l5cx_get_power_mode | ( | uint8_t * | p_power_mode | ) |
This function is used to get the current sensor power mode.
| (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). |


| uint8_t VL53L5CX::vl53l5cx_get_ranging_data | ( | VL53L5CX_ResultsData * | p_results | ) |
This function gets the ranging data, using the selected output and the resolution.
| (VL53L5CX_ResultsData) | *p_results : VL53L5 results structure. |

| uint8_t VL53L5CX::vl53l5cx_get_ranging_frequency_hz | ( | uint8_t * | p_frequency_hz | ) |
This function gets the current ranging frequency in Hz. Ranging frequency corresponds to the time between each measurement.
| (uint8_t) | *p_frequency_hz: Contains the ranging frequency in Hz. |

| uint8_t VL53L5CX::vl53l5cx_get_ranging_mode | ( | 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.
| (uint8_t) | *p_ranging_mode : current ranging mode |

| uint8_t VL53L5CX::vl53l5cx_get_resolution | ( | uint8_t * | p_resolution | ) |
This function gets the current resolution (4x4 or 8x8).
| (uint8_t) | *p_resolution : Value of this pointer will be equal to 16 for 4x4 mode, and 64 for 8x8 mode. |


| uint8_t VL53L5CX::vl53l5cx_get_sharpener_percent | ( | 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.
| (uint32_t) | *p_sharpener_percent: Contains the sharpener in percent. |

| uint8_t VL53L5CX::vl53l5cx_get_target_order | ( | uint8_t * | p_target_order | ) |
This function gets the current target order (closest or strongest).
| (uint8_t) | *p_target_order: Contains the target order. |

| uint8_t VL53L5CX::vl53l5cx_init | ( | ) |
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.


| uint8_t VL53L5CX::vl53l5cx_is_alive | ( | uint8_t * | p_is_alive | ) |
This function is used to check if the sensor is alive.
| (uint8_t) | *p_is_alive : 1 if the sensor is alive, 0 in case of error. |


| uint8_t VL53L5CX::vl53l5cx_set_i2c_address | ( | 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.
| (uint16_t) | i2c_address : New I2C address. |


| uint8_t VL53L5CX::vl53l5cx_set_integration_time_ms | ( | 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 continuous.
| (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. |

| uint8_t VL53L5CX::vl53l5cx_set_power_mode | ( | 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.
| (uint8_t) | power_mode : Selected power mode (VL53L5CX_POWER_MODE_SLEEP or VL53L5CX_POWER_MODE_WAKEUP) |

| uint8_t VL53L5CX::vl53l5cx_set_ranging_frequency_hz | ( | 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.
| (uint8_t) | frequency_hz : Contains the ranging frequency in Hz.
|

| uint8_t VL53L5CX::vl53l5cx_set_ranging_mode | ( | 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.
| (uint8_t) | ranging_mode : Use macros VL53L5CX_RANGING_MODE_CONTINUOUS, VL53L5CX_RANGING_MODE_CONTINUOUS. |

| uint8_t VL53L5CX::vl53l5cx_set_resolution | ( | uint8_t | resolution | ) |
This function sets a new resolution (4x4 or 8x8).
| (uint8_t) | resolution : Use macro VL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8 to set the resolution. |

| uint8_t VL53L5CX::vl53l5cx_set_sharpener_percent | ( | 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.
| (uint32_t) | sharpener_percent : Value between 0 (disabled) and 99%. |

| uint8_t VL53L5CX::vl53l5cx_set_target_order | ( | 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.
| (uint8_t) | target_order : Required target order. |

| uint8_t VL53L5CX::vl53l5cx_start_ranging | ( | ) |
This function starts a ranging session. When the sensor streams, host cannot change settings 'on-the-fly'.

| uint8_t VL53L5CX::vl53l5cx_stop_ranging | ( | ) |
This function stops the ranging session. It must be used when the sensor streams, after calling vl53l5cx_start_ranging().

|
protected |
Mandatory function, used to wait during an amount of time. It must be filled as it's used into the API.
| (VL53L5CX_Platform*) | p_platform : Pointer of VL53L5CX platform structure. |
| (uint32_t) | TimeMs : Time to wait in ms. |

|
protected |
Mandatory function used to write one single byte.
| (VL53L5CX_Platform*) | p_platform : Pointer of VL53L5CX platform structure. |
| (uint16_t) | Address : I2C location of value to read. |
| (uint8_t) | value : Pointer of value to write. |


|
protected |
Mandatory function used to write multiples bytes.
| (VL53L5CX_Platform*) | p_platform : Pointer of VL53L5CX platform structure. |
| (uint16_t) | Address : I2C location of values to write. |
| (uint8_t) | *p_values : Buffer of bytes to write. |
| (uint32_t) | size : Size of *p_values buffer. |
