Skip to content

Commit

Permalink
Don't consider a prior I2C NACK to indicate the bus to be busy (betaf…
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans authored Sep 22, 2024
1 parent a6d70be commit c0c24d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/drivers/mcu/at32/bus_i2c_atbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ bool i2cBusy(I2CDevice device, bool *error)
*error = pHandle->error_code;
}

if (pHandle->error_code == I2C_OK) {
// I2C_ERR_ACKFAIL indicates that the last access wasn't acknowledged, but doesn't mean the bus is busy
if ((pHandle->error_code == I2C_OK) || (pHandle->error_code == I2C_ERR_ACKFAIL)) {
if (i2c_flag_get(pHandle->i2cx, I2C_BUSYF_FLAG) == SET) {
return true;
}
Expand Down

0 comments on commit c0c24d7

Please sign in to comment.