From 45dc970aef8f6d9aa6c516800adb9e99dc701d2d Mon Sep 17 00:00:00 2001 From: jean-marc Date: Fri, 9 May 2025 09:05:44 +0200 Subject: [PATCH] fix issue when instantiating 2 differents ToF --- src/platform.h | 6 +----- src/vl53l8cx_api.h | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/platform.h b/src/platform.h index 29b3729..9204303 100644 --- a/src/platform.h +++ b/src/platform.h @@ -52,16 +52,12 @@ extern "C" { #define VL53L8CX_COMMS_CHUNK_SIZE 4096 #define SPI_WRITE_MASK(x) (uint16_t)(x | 0x8000) #define SPI_READ_MASK(x) (uint16_t)(x & ~0x8000) -#ifndef DEFAULT_I2C_BUFFER_LEN - - - typedef uint8_t (*VL53L8CX_wait_Func)(void *, uint32_t); typedef uint8_t (*VL53L8CX_write_Func)(void *, uint16_t, uint8_t *, uint32_t); typedef uint8_t (*VL53L8CX_read_Func)(void *, uint16_t, uint8_t *, uint32_t); - +#ifndef DEFAULT_I2C_BUFFER_LEN #ifdef ARDUINO_SAM_DUE /* FIXME: It seems that an I2C buffer of BUFFER_LENGTH does not work on Arduino DUE. So, we need to decrease the size */ #define DEFAULT_I2C_BUFFER_LEN (BUFFER_LENGTH - 2) diff --git a/src/vl53l8cx_api.h b/src/vl53l8cx_api.h index db173c3..28ed61d 100644 --- a/src/vl53l8cx_api.h +++ b/src/vl53l8cx_api.h @@ -370,7 +370,8 @@ typedef struct { } VL53L8CX_ResultsData; - +#ifndef BLOCK_HEADER +#define BLOCK_HEADER union Block_header { uint32_t bytes; struct { @@ -379,6 +380,7 @@ union Block_header { uint32_t idx : 16; }; }; +#endif uint8_t vl53l8cx_is_alive( VL53L8CX_Configuration *p_dev,