drivers/vl53l5cx: Add shutdown function.

This commit is contained in:
iabdalkader 2025-02-13 08:22:55 +01:00
parent 2fec88070f
commit c743cab6a3
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,7 @@ typedef struct {
} VL53L5CX_Platform;
void vl53l5cx_reset(VL53L5CX_Platform *platform);
void vl53l5cx_shutdown(VL53L5CX_Platform *platform);
void vl53l5cx_swap(uint8_t *buf, uint16_t size);
uint8_t vl53l5cx_read(VL53L5CX_Platform *platform, uint16_t addr, uint8_t *buf, uint32_t size);
uint8_t vl53l5cx_write(VL53L5CX_Platform *platform, uint16_t addr, uint8_t *buf, uint32_t size);

View File

@ -47,6 +47,13 @@ void vl53l5cx_reset(VL53L5CX_Platform *platform) {
#endif
}
void vl53l5cx_shutdown(VL53L5CX_Platform *platform) {
#if defined(OMV_TOF_POWER_PIN)
omv_gpio_config(OMV_TOF_POWER_PIN, OMV_GPIO_MODE_OUTPUT, OMV_GPIO_PULL_NONE, OMV_GPIO_SPEED_LOW, -1);
omv_gpio_write(OMV_TOF_POWER_PIN, 0);
#endif
}
void vl53l5cx_swap(uint8_t *buf, uint16_t size) {
for (size_t i=0; i<size; i++) {
((uint32_t *) buf)[i] = __REV(((uint32_t *) buf)[i]);