This commit is contained in:
2026-04-08 12:49:16 +08:00
parent fda081c1f0
commit ff467d26bc
13 changed files with 781 additions and 727 deletions

View File

@@ -42,6 +42,14 @@ extern "C"
{
#endif
#ifndef VL53_USE_FREERTOS_DELAY
#define VL53_USE_FREERTOS_DELAY 1
#endif
#ifndef VL53L1_DEFAULT_ADDR_8BIT
#define VL53L1_DEFAULT_ADDR_8BIT 0x52u
#endif
/**
* @file vl53l1_platform.h
*
@@ -396,8 +404,38 @@ VL53L1_Error VL53L1_GpioInterruptDisable(void);
*/
VL53L1_Error VL53L1_GetTickCount(
VL53L1_Dev_t *pdev,
uint32_t *ptime_ms);
void VL53L1_PlatformAttachBus(
VL53L1_Dev_t *pdev,
I2C_HandleTypeDef *hi2c,
uint8_t i2c_addr_8bit,
uint16_t io_timeout_ms,
void *bus_lock);
void VL53L1_PlatformAttachPins(
VL53L1_Dev_t *pdev,
GPIO_TypeDef *xshut_port,
uint16_t xshut_pin,
GPIO_TypeDef *gpio1_port,
uint16_t gpio1_pin);
VL53L1_Error VL53L1_PlatformSetXShut(
VL53L1_Dev_t *pdev,
GPIO_PinState state);
VL53L1_Error VL53L1_PlatformBootDevice(
VL53L1_Dev_t *pdev,
uint32_t reset_low_ms,
uint32_t boot_wait_ms);
VL53L1_Error VL53L1_PlatformChangeAddress(
VL53L1_Dev_t *pdev,
uint8_t new_addr_8bit);
uint32_t VL53L1_PlatformGetTick(void);
/**
* @brief Register "wait for value" polling routine

View File

@@ -34,6 +34,7 @@
#include <stdlib.h>
#endif
#include "main.h"
#include "vl53l1_def.h"
#ifdef __cplusplus
@@ -56,12 +57,24 @@ typedef struct {
/*!< Low Level Driver data structure */
uint8_t i2c_slave_address;
/*!< i2c device address user specific field */
/*!< ST API expects the 8-bit I2C address, default 0x52 */
uint8_t comms_type;
/*!< Type of comms : VL53L1_I2C or VL53L1_SPI */
uint16_t comms_speed_khz;
/*!< Comms speed [kHz] : typically 400kHz for I2C */
I2C_HandleTypeDef *hi2c;
GPIO_TypeDef *xshut_port;
uint16_t xshut_pin;
GPIO_TypeDef *gpio1_port;
uint16_t gpio1_pin;
void *bus_lock;
const char *name;
uint8_t id;
uint8_t is_present;
uint16_t io_timeout_ms;
uint32_t new_data_ready_poll_duration_ms;
/*!< New data ready poll duration in ms - for debug */
} VL53L1_Dev_t;