Contains Ayoub's Ranging and Custom interfaces for the VL53L3CX
Revision 1:dae4cb24beec, committed 2021-07-21
- Comitter:
- charlesmn
- Date:
- Wed Jul 21 14:47:53 2021 +0000
- Parent:
- 0:c1910e04fc6c
- Commit message:
- strip out commented out code
Changed in this revision
diff -r c1910e04fc6c -r dae4cb24beec 53l3a2.c --- a/53l3a2.c Wed Jul 21 14:19:31 2021 +0000 +++ b/53l3a2.c Wed Jul 21 14:47:53 2021 +0000 @@ -198,9 +198,7 @@ * @} */ -/** @defgroup XNUCLEO_53L3A2_COMMON_Private_Variables Private Variables - * @{ - */ + static uint32_t InitCounter = 0; /* cache the full set of expanded GPIO values to avoid i2c reading */ @@ -209,9 +207,7 @@ uint8_t bytes[4]; /*!< 4 bytes array i/o view */ uint32_t u32; /*!< single dword i/o view */ } CurIOVal; /* cache the extended IO values */ -/** - * @} - */ + /** @defgroup XNUCLEO_53L3A2_COMMON_Private_Functions_Prototypes Private Functions Prototypes * @{ @@ -220,9 +216,7 @@ static int32_t _ExpanderRd(uint32_t I2cExpAddr, uint32_t index, uint8_t *data, uint32_t n_data); static int32_t _ExpanderWR(uint32_t I2cExpAddr, uint32_t index, uint8_t *data, uint32_t n_data); static int32_t _ExpandersSetAllIO(void); -/** - * @} - */ + /** * @brief Initialize X-NUCLEO-53L3A2 STM32 expansion board @@ -236,27 +230,6 @@ if (InitCounter++ == 0U) { -// _I2cFailRecover(); - -//// VL53L3A2_I2C_Init(); - -//// status = _ExpanderRd(I2C_EXPANDER_ADDR0, 0, ExpanderData, 2); - -// if ((status != 0) || (ExpanderData[0] != 0x00U) || (ExpanderData[1] != 0x16U)) -// { - // VL53L3A2_ErrLog("I2C Expander @0x%02X not detected", (int)I2C_EXPANDER_ADDR0); - // goto done_err; -// } - -// status = _ExpanderRd(I2C_EXPANDER_ADDR1, 0, ExpanderData, 2); - -// if ((status != 0) || (ExpanderData[0] != 0x00U) || (ExpanderData[1] != 0x16U)) -// { -// printf("ExpanderData %d %d %d\n",status,ExpanderData[0],ExpanderData[1]); -// VL53L3A2_ErrLog("I2C Expander @0x%02X not detected", (int)I2C_EXPANDER_ADDR1); -// goto done_err; -// } - CurIOVal.u32 = 0x0U; // setup expander i/o direction all output but exp1 bit 14 @@ -325,8 +298,8 @@ * @return 0 on success */ - // VL53L3A2_DEV_LEFT = 0, /* !< left satellite device P21 header */ - // VL53L3A2_DEV_CENTER = 1, /* !< center (built-in) device */ +// VL53L3A2_DEV_LEFT = 0, /* !< left satellite device P21 header */ +// VL53L3A2_DEV_CENTER = 1, /* !< center (built-in) device */ // VL53L3A2_DEV_RIGHT = 2 /* !< Right satellite device P22 header */ int32_t VL53L3A2_ResetId(uint8_t DevNo, uint8_t state) { @@ -518,27 +491,8 @@ uint8_t RegAddr; RegAddr = index; - // VL53L3A2_GetI2cBus(); - // printf("_ExpanderRd %d %d %d %d\n",I2cExpAddr,index,RegAddr,status); - // status = v53l1x_i2c_write_if(data,I2cExpAddr, index,n_data); - - - status = v53l1x_i2c_read_if(RegAddr,I2cExpAddr, index,2); - - - //// do - //// { - //// status = HAL_I2C_Master_Transmit(&VL53L3A2_hi2c, I2cExpAddr, &RegAddr, 1, 100); - //// if (status) - //// { - //// break; - //// } - - //// status = HAL_I2C_Master_Receive(&VL53L3A2_hi2c, I2cExpAddr, data, n_data, n_data * 100); - //// } while (0); - - // VL53L3A2_PutI2cBus(); + status = v53l1x_i2c_read_if(data,I2cExpAddr, index,2); return status; } @@ -585,21 +539,5 @@ } -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - - /** - * @} - */ - /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff -r c1910e04fc6c -r dae4cb24beec 53l3a2.h --- a/53l3a2.h Wed Jul 21 14:19:31 2021 +0000 +++ b/53l3a2.h Wed Jul 21 14:47:53 2021 +0000 @@ -53,21 +53,7 @@ int32_t VL53L3A2_DeInit(void); int32_t VL53L3A2_ResetId(uint8_t DevNo, uint8_t state); int32_t VL53L3A2_SetDisplayString(const char *str); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - - /** - * @} - */ #endif /* XNUCLEO_53L3A2_H */
diff -r c1910e04fc6c -r dae4cb24beec 53l3a2_conf.h --- a/53l3a2_conf.h Wed Jul 21 14:19:31 2021 +0000 +++ b/53l3a2_conf.h Wed Jul 21 14:47:53 2021 +0000 @@ -23,10 +23,6 @@ #ifndef VL53L3A2_CONF_H #define VL53L3A2_CONF_H -//#include "stm32l4xx_hal.h" -//#include "stm32l4xx_nucleo_bus.h" -//#include "stm32l4xx_nucleo_errno.h" - #ifdef __cplusplus extern "C" { #endif @@ -42,19 +38,6 @@ */ #define RANGING_SENSOR_INSTANCES_NBR (3U) -////#define VL53L3A2_hi2c (hi2c1) - -////#define VL53L3A2_I2C_SCL_GPIO_PORT BUS_I2C1_SCL_GPIO_PORT -////#define VL53L3A2_I2C_SCL_GPIO_PIN BUS_I2C1_SCL_GPIO_PIN -////#define VL53L3A2_I2C_SDA_GPIO_PORT BUS_I2C1_SDA_GPIO_PORT -////#define VL53L3A2_I2C_SDA_GPIO_PIN BUS_I2C1_SDA_GPIO_PIN - -////#define VL53L3A2_I2C_Init BSP_I2C1_Init -////#define VL53L3A2_I2C_DeInit BSP_I2C1_DeInit -////#define VL53L3A2_I2C_WriteReg BSP_I2C1_Send -////#define VL53L3A2_I2C_ReadReg BSP_I2C1_Recv -// #define VL53L3A2_GetTick BSP_GetTick - #ifdef __cplusplus } #endif
diff -r c1910e04fc6c -r dae4cb24beec vl53l3cx.c --- a/vl53l3cx.c Wed Jul 21 14:19:31 2021 +0000 +++ b/vl53l3cx.c Wed Jul 21 14:47:53 2021 +0000 @@ -42,7 +42,6 @@ */ #define V53L3CX_POLL_TIMEOUT (0xFFFFU) -#define UNUSED(x) (void)(x) /** * @} @@ -100,21 +99,8 @@ } else { - // pObj->IO.Init = pIO->Init; - // pObj->IO.DeInit = pIO->DeInit; pObj->IO.Address = pIO->Address; - // pObj->IO.WriteReg = pIO->WriteReg; - // pObj->IO.ReadReg = pIO->ReadReg; pObj->IO.GetTick = pIO->GetTick; - -// if (pObj->IO.Init != NULL) - // { - // ret = pObj->IO.Init(); -// } -// else -// { -// ret = VL53L3CX_ERROR; - // } }