37 #ifndef LIDAR_VL53L5CX_I2C_ADDR
38 #define LIDAR_VL53L5CX_I2C_ADDR 0x29
41 #define SUBTYPE_DISTANCE 0
52 "VL53L5CX_NOT_DETECTED",
53 "VL53L5CX_ULD_LOADING_FAILED",
54 "VL53L5CX_SET_RESOLUTION_FAILED",
55 "VL53L5CX_RUNTIME_ERROR",
61 vl53l5cx_dev.platform.i2cdev = &LIDAR_VL53L5CX_I2C_DEV;
63 vl53l5cx_dev.platform.user_data = NULL;
67 vl53l5cx_dev.platform.user_data = chThdCreateStatic(wa_thd_lidar_vl53l5cx,
sizeof(wa_thd_lidar_vl53l5cx),
74 if (vl53l5cx_dev.platform.user_data != NULL) {
75 thread_t* thread_handle = (thread_t*) vl53l5cx_dev.platform.user_data;
77 if (thread_handle->state == CH_STATE_FINAL) {
78 vl53l5cx_dev.platform.error_code = (
enum VL53L5CX_ERRORS) chThdWait(thread_handle);
79 vl53l5cx_dev.platform.user_data = NULL;
92 if (vl53l5cx_dev.platform.data_available) {
96 (
uint8_t *)vl53l5cx_dev.platform.distances_mm);
98 vl53l5cx_dev.platform.data_available =
false;
108 chRegSetThreadName(
"vl53l5cx");
114 chThdSleepMilliseconds(2000);
138 memcpy(
dev->platform.distances_mm, vl53l5cx_results.distance_mm, 64 *
sizeof(vl53l5cx_results.distance_mm[0]));
139 dev->platform.data_available =
true;
143 chThdSleepMilliseconds(100);
Main include for ABI (AirBorneInterface).
#define LIDAR_DATA_VL53L5CX_ID
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Common code for AP and FBW telemetry.
if(GpsFixValid() &&e_identification_started)
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
#define LIDAR_VL53L5CX_I2C_ADDR
static IN_DMA_SECTION(VL53L5CX_Configuration vl53l5cx_dev)
static void thd_lidar_vl53l5cx(void *arg)
void lidar_vl53l5cx_init(void)
char * VL53L5CX_ERROR_MSGS[]
void lidar_vl53l5cx_periodic(void)
static THD_WORKING_AREA(wa_thd_lidar_vl53l5cx, 1024)
Specific RAM section for DMA usage on F7.
static const struct usb_device_descriptor dev
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
uint8_t vl53l5cx_is_alive(VL53L5CX_Configuration *p_dev, uint8_t *p_is_alive)
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.
uint8_t vl53l5cx_init(VL53L5CX_Configuration *p_dev)
Mandatory function used to initialize the sensor.
uint8_t vl53l5cx_start_ranging(VL53L5CX_Configuration *p_dev)
This function starts a ranging session.
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.
uint8_t vl53l5cx_set_resolution(VL53L5CX_Configuration *p_dev, uint8_t resolution)
This function sets a new resolution (4x4 or 8x8).
#define VL53L5CX_RESOLUTION_4X4
Macro VL53L5CX_RESOLUTION_4X4 or VL53L5CX_RESOLUTION_8X8 allows setting sensor in 4x4 mode or 8x8 mod...
Structure VL53L5CX_Configuration contains the sensor configuration.
Structure VL53L5CX_ResultsData contains the ranging results of VL53L5CX.