From 668c3811b881a316288e8ab07b2d28ab4120662a Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Thu, 15 Dec 2016 01:41:54 +0200 Subject: [PATCH] Wire: wait while bus is busy if ack failed --- cores/esp32/esp32-hal-i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index a501f40e..fd42db5a 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -219,6 +219,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat //Transmission did not finish and ACK_ERR is set if(i2c->dev->int_raw.ack_err) { //log_w("Ack Error! Addr: %x", address >> 1); + while(i2c->dev->status_reg.bus_busy); I2C_MUTEX_UNLOCK(); return I2C_ERROR_ACK; }