Contains Ayoub's Ranging and Custom interfaces for the VL53L3CX
Diff: 53l3a2.c
- Revision:
- 1:dae4cb24beec
- Parent:
- 0:c1910e04fc6c
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****/