Skip to content

Commit 7eff707

Browse files
stickbreakerme-no-dev
authored andcommitted
Fix Early return when Address NAK is received (espressif#750)
The i2cWrite() function was returning to the app before the i2c transaction had completed. This caused the next Wire() call to return a I2C_ERROR_BUSY.
1 parent 81f225a commit 7eff707

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp32/esp32-hal-i2c.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
229229
//Transmission did not finish and ACK_ERR is set
230230
if(i2c->dev->int_raw.ack_err) {
231231
log_w("Ack Error! Addr: %x", address >> 1);
232-
while((i2c->dev->status_reg.bus_busy) && ((millis() - startAt)>50));
232+
while((i2c->dev->status_reg.bus_busy) && ((millis() - startAt)<50));
233233
I2C_MUTEX_UNLOCK();
234234
return I2C_ERROR_ACK;
235235
}

0 commit comments

Comments
 (0)