Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Src/stm32l4xx_hal_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -7209,7 +7209,7 @@ static HAL_StatusTypeDef I2C_IsErrorOccurred(I2C_HandleTypeDef *hi2c, uint32_t T
uint32_t error_code = 0;
uint32_t tickstart = Tickstart;
uint32_t tmp1;
HAL_I2C_ModeTypeDef tmp2;
HAL_I2C_ModeTypeDef tmp2 = hi2c->Mode;

if (HAL_IS_BIT_SET(itflag, I2C_FLAG_AF))
{
Expand All @@ -7226,7 +7226,6 @@ static HAL_StatusTypeDef I2C_IsErrorOccurred(I2C_HandleTypeDef *hi2c, uint32_t T
if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
{
tmp1 = (uint32_t)(hi2c->Instance->CR2 & I2C_CR2_STOP);
tmp2 = hi2c->Mode;

/* In case of I2C still busy, try to regenerate a STOP manually */
if ((__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET) && \
Expand Down Expand Up @@ -7275,7 +7274,7 @@ static HAL_StatusTypeDef I2C_IsErrorOccurred(I2C_HandleTypeDef *hi2c, uint32_t T
/* Check if a Bus error occurred */
if (HAL_IS_BIT_SET(itflag, I2C_FLAG_BERR))
{
error_code |= HAL_I2C_ERROR_BERR;
error_code |= tmp2 == HAL_I2C_MODE_MASTER ? RESET : HAL_I2C_ERROR_BERR;

/* Clear BERR flag */
__HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_BERR);
Expand Down