12#include "vl53l5cx_api.h"
14#define VL53L5CX_SENSOR_FOV 45.0F
26 _dev.platform.address = VL53L5CX_DEFAULT_I2C_ADDRESS;
27 _dev.platform.dev_i2c = i2c;
45 uint8_t status = VL53L5CX_STATUS_OK;
48 if (addr != _dev.platform.address) {
50 if (status != VL53L5CX_STATUS_OK) {
51 return VL53L5CX_STATUS_ERROR;
56 if (!isAlive || status != VL53L5CX_STATUS_OK) {
57 return VL53L5CX_STATUS_ERROR;
62 if (status != VL53L5CX_STATUS_OK) {
63 return VL53L5CX_STATUS_ERROR;
97 uint16_t i2c_address);
109 uint8_t *p_power_mode);
171 uint8_t *p_resolution);
191 uint8_t *p_frequency_hz);
205 uint8_t frequency_hz);
214 uint32_t *p_time_ms);
227 uint32_t integration_time_ms);
237 uint8_t *p_sharpener_percent);
248 uint8_t sharpener_percent);
257 uint8_t *p_target_order);
270 uint8_t target_order);
281 uint8_t *p_ranging_mode);
293 uint8_t ranging_mode);
355 uint16_t new_data_size,
356 uint16_t new_data_pos);
363 uint8_t get_stream_count(
void)
365 return _dev.streamcount;
369 VL53L5CX_Configuration _dev;
370 VL53L5CX_Configuration *p_dev;
384 uint8_t expected_value);
386 uint8_t _vl53l5cx_poll_for_mcu_boot();
409 uint8_t expected_value);
429 uint16_t RegisterAddress,
443 uint16_t RegisterAddress,
458 uint16_t RegisterAddress,
474 uint16_t RegisterAddress,
491 uint8_t vl53l5cx_set_VHV_repeat_count(
492 uint32_t repeat_count);
494 uint8_t vl53l5cx_get_VHV_repeat_count(
495 uint32_t *p_repeat_count);
497 uint8_t vl53l5cx_disable_internal_cp();
499 uint8_t vl53l5cx_enable_internal_cp();
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 gathere...
Definition vl53l5cx_api.cpp:92
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 bet...
Definition vl53l5cx_api.cpp:946
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 VL5...
Definition vl53l5cx_api.cpp:25
uint8_t _vl53l5cx_program_output_config()
Inner function, not available outside this file. This function is used to program the output using th...
uint8_t RdMulti(VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t *p_values, uint32_t size)
Mandatory function used to read multiples bytes.
Definition platform.cpp:83
uint8_t vl53l5cx_get_power_mode(uint8_t *p_power_mode)
This function is used to get the current sensor power mode.
Definition vl53l5cx_api.cpp:417
uint8_t vl53l5cx_get_ranging_data(VL53L5CX_ResultsData *p_results)
This function gets the ranging data, using the selected output and the resolution.
Definition vl53l5cx_api.cpp:698
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 t...
Definition vl53l5cx_api.cpp:984
uint8_t vl53l5cx_get_target_order(uint8_t *p_target_order)
This function gets the current target order (closest or strongest).
Definition vl53l5cx_api.cpp:1042
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,...
Definition vl53l5cx_api.cpp:668
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 zo...
Definition vl53l5cx_api.cpp:1021
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 VL5...
uint8_t vl53l5cx_init()
Mandatory function used to initialize the sensor. This function must be called after a power on,...
Definition vl53l5cx_api.cpp:238
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,...
Definition vl53l5cx_api.cpp:1233
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)
Definition vl53l5cx_api.cpp:1287
uint8_t vl53l5cx_get_resolution(uint8_t *p_resolution)
This function gets the current resolution (4x4 or 8x8).
Definition vl53l5cx_api.cpp:868
int init_sensor(uint8_t addr=VL53L5CX_DEFAULT_I2C_ADDRESS)
Initialize the sensor.
Definition VL53L5CX.h:43
uint8_t WrMulti(VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t *p_values, uint32_t size)
Mandatory function used to write multiples bytes.
Definition platform.cpp:45
uint8_t vl53l5cx_stop_ranging()
This function stops the ranging session. It must be used when the sensor streams, after calling vl53l...
Definition vl53l5cx_api.cpp:615
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 aut...
Definition vl53l5cx_api.cpp:1072
virtual ~VL53L5CX()
Definition VL53L5CX.h:34
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 aut...
Definition vl53l5cx_api.cpp:1092
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 connect...
Definition vl53l5cx_api.cpp:404
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...
Definition vl53l5cx_api.cpp:1053
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 AP...
Definition platform.cpp:122
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 ...
Definition vl53l5cx_api.cpp:1188
VL53L5CX(i2c_t *i2c)
Definition VL53L5CX.h:23
uint8_t vl53l5cx_set_resolution(uint8_t resolution)
This function sets a new resolution (4x4 or 8x8).
Definition vl53l5cx_api.cpp:882
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 zo...
Definition vl53l5cx_api.cpp:1007
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 gen...
Definition vl53l5cx_api.cpp:161
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 duri...
Definition vl53l5cx_api.cpp:445
uint8_t vl53l5cx_is_alive(uint8_t *p_is_alive)
This function is used to check if the sensor is alive.
Definition vl53l5cx_api.cpp:215
uint8_t vl53l5cx_get_integration_time_ms(uint32_t *p_time_ms)
This function gets the current integration time in ms.
Definition vl53l5cx_api.cpp:970
uint8_t WrByte(VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t value)
Mandatory function used to write one single byte.
Definition platform.cpp:36
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 f...
Definition vl53l5cx_api.cpp:958
uint8_t vl53l5cx_start_ranging()
This function starts a ranging session. When the sensor streams, host cannot change settings 'on-the-...
Definition vl53l5cx_api.cpp:479
uint8_t RdByte(VL53L5CX_Platform *p_platform, uint16_t RegisterAddress, uint8_t *p_value)
Definition platform.cpp:27
Structure VL53L5CX_Configuration contains the sensor configuration. User MUST not manually change the...
Definition vl53l5cx_api.h:268
Structure VL53L5CX_ResultsData contains the ranging results of VL53L5CX. If user wants more than 1 ta...
Definition vl53l5cx_api.h:302