[HAL][I2C] Update I2C_IsErrorOccurred to return error if timeout is detected
diff --git a/Src/stm32f4xx_hal_fmpi2c.c b/Src/stm32f4xx_hal_fmpi2c.c
index 6f83e87..621377c 100644
--- a/Src/stm32f4xx_hal_fmpi2c.c
+++ b/Src/stm32f4xx_hal_fmpi2c.c
@@ -6893,14 +6893,11 @@
/* Check for the Timeout */
if ((HAL_GetTick() - tickstart) > FMPI2C_TIMEOUT_STOPF)
{
- hfmpi2c->ErrorCode |= HAL_FMPI2C_ERROR_TIMEOUT;
- hfmpi2c->State = HAL_FMPI2C_STATE_READY;
- hfmpi2c->Mode = HAL_FMPI2C_MODE_NONE;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hfmpi2c);
+ error_code |=HAL_FMPI2C_ERROR_TIMEOUT;
status = HAL_ERROR;
+
+ break;
}
}
}