[HAL][I2C] Update I2C_WaitOnFlagUntilTimeout to handle error case
diff --git a/Src/stm32l0xx_hal_i2c.c b/Src/stm32l0xx_hal_i2c.c index bdadf03..093089c 100644 --- a/Src/stm32l0xx_hal_i2c.c +++ b/Src/stm32l0xx_hal_i2c.c
@@ -6969,6 +6969,12 @@ { while (__HAL_I2C_GET_FLAG(hi2c, Flag) == Status) { + /* Check if an error is detected */ + if (I2C_IsErrorOccurred(hi2c, Timeout, Tickstart) != HAL_OK) + { + return HAL_ERROR; + } + /* Check for the Timeout */ if (Timeout != HAL_MAX_DELAY) {