From 28be506ce33c1230ad6a0af0dbc43a56e32c2391 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Fri, 29 Sep 2017 21:24:06 +0800 Subject: [PATCH] uncomment I2C debug so it can be used --- cores/esp32/esp32-hal-i2c.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index 1bba266f..355e7b2f 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -157,7 +157,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat if (i2c->dev->status_reg.bus_busy == 1) { - //log_w( "Busy Timeout! Addr: %x", address >> 1 ); + log_e( "Busy Timeout! Addr: %x", address >> 1 ); I2C_MUTEX_UNLOCK(); return I2C_ERROR_BUSY; } @@ -207,28 +207,28 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat while(1) { //have been looping for too long if((millis() - startAt)>50){ - //log_e("Timeout! Addr: %x", address >> 1); + log_e("Timeout! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_BUS; } //Bus failed (maybe check for this while waiting? if(i2c->dev->int_raw.arbitration_lost) { - //log_e("Bus Fail! Addr: %x", address >> 1); + log_e("Bus Fail! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_BUS; } //Bus timeout if(i2c->dev->int_raw.time_out) { - //log_e("Bus Timeout! Addr: %x", address >> 1); + log_e("Bus Timeout! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_TIMEOUT; } //Transmission did not finish and ACK_ERR is set if(i2c->dev->int_raw.ack_err) { - //log_w("Ack Error! Addr: %x", address >> 1); + log_w("Ack Error! Addr: %x", address >> 1); while((i2c->dev->status_reg.bus_busy) && ((millis() - startAt)>50)); I2C_MUTEX_UNLOCK(); return I2C_ERROR_ACK; @@ -260,7 +260,7 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data if (i2c->dev->status_reg.bus_busy == 1) { - //log_w( "Busy Timeout! Addr: %x", address >> 1 ); + log_w( "Busy Timeout! Addr: %x", address >> 1 ); I2C_MUTEX_UNLOCK(); return I2C_ERROR_BUSY; } @@ -310,28 +310,28 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data while(1) { //have been looping for too long if((millis() - startAt)>50){ - //log_e("Timeout! Addr: %x", address >> 1); + log_e("Timeout! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_BUS; } //Bus failed (maybe check for this while waiting? if(i2c->dev->int_raw.arbitration_lost) { - //log_e("Bus Fail! Addr: %x", address >> 1); + log_e("Bus Fail! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_BUS; } //Bus timeout if(i2c->dev->int_raw.time_out) { - //log_e("Bus Timeout! Addr: %x", address >> 1); + log_e("Bus Timeout! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_TIMEOUT; } //Transmission did not finish and ACK_ERR is set if(i2c->dev->int_raw.ack_err) { - //log_w("Ack Error! Addr: %x", address >> 1); + log_w("Ack Error! Addr: %x", address >> 1); I2C_MUTEX_UNLOCK(); return I2C_ERROR_ACK; } @@ -462,7 +462,7 @@ void i2cInitFix(i2c_t * i2c){ i2cSetCmd(i2c, 2, I2C_CMD_STOP, 0, false, false, false); if (i2c->dev->status_reg.bus_busy) // If this condition is true, the while loop will timeout as done will not be set { - //log_e("Busy at initialization!"); + log_e("Busy at initialization!"); } i2c->dev->ctr.trans_start = 1; uint16_t count = 50000;