Skip to content

Commit 28be506

Browse files
committed
uncomment I2C debug so it can be used
1 parent 0cd6285 commit 28be506

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cores/esp32/esp32-hal-i2c.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
157157

158158
if (i2c->dev->status_reg.bus_busy == 1)
159159
{
160-
//log_w( "Busy Timeout! Addr: %x", address >> 1 );
160+
log_e( "Busy Timeout! Addr: %x", address >> 1 );
161161
I2C_MUTEX_UNLOCK();
162162
return I2C_ERROR_BUSY;
163163
}
@@ -207,28 +207,28 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
207207
while(1) {
208208
//have been looping for too long
209209
if((millis() - startAt)>50){
210-
//log_e("Timeout! Addr: %x", address >> 1);
210+
log_e("Timeout! Addr: %x", address >> 1);
211211
I2C_MUTEX_UNLOCK();
212212
return I2C_ERROR_BUS;
213213
}
214214

215215
//Bus failed (maybe check for this while waiting?
216216
if(i2c->dev->int_raw.arbitration_lost) {
217-
//log_e("Bus Fail! Addr: %x", address >> 1);
217+
log_e("Bus Fail! Addr: %x", address >> 1);
218218
I2C_MUTEX_UNLOCK();
219219
return I2C_ERROR_BUS;
220220
}
221221

222222
//Bus timeout
223223
if(i2c->dev->int_raw.time_out) {
224-
//log_e("Bus Timeout! Addr: %x", address >> 1);
224+
log_e("Bus Timeout! Addr: %x", address >> 1);
225225
I2C_MUTEX_UNLOCK();
226226
return I2C_ERROR_TIMEOUT;
227227
}
228228

229229
//Transmission did not finish and ACK_ERR is set
230230
if(i2c->dev->int_raw.ack_err) {
231-
//log_w("Ack Error! Addr: %x", address >> 1);
231+
log_w("Ack Error! Addr: %x", address >> 1);
232232
while((i2c->dev->status_reg.bus_busy) && ((millis() - startAt)>50));
233233
I2C_MUTEX_UNLOCK();
234234
return I2C_ERROR_ACK;
@@ -260,7 +260,7 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
260260

261261
if (i2c->dev->status_reg.bus_busy == 1)
262262
{
263-
//log_w( "Busy Timeout! Addr: %x", address >> 1 );
263+
log_w( "Busy Timeout! Addr: %x", address >> 1 );
264264
I2C_MUTEX_UNLOCK();
265265
return I2C_ERROR_BUSY;
266266
}
@@ -310,28 +310,28 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
310310
while(1) {
311311
//have been looping for too long
312312
if((millis() - startAt)>50){
313-
//log_e("Timeout! Addr: %x", address >> 1);
313+
log_e("Timeout! Addr: %x", address >> 1);
314314
I2C_MUTEX_UNLOCK();
315315
return I2C_ERROR_BUS;
316316
}
317317

318318
//Bus failed (maybe check for this while waiting?
319319
if(i2c->dev->int_raw.arbitration_lost) {
320-
//log_e("Bus Fail! Addr: %x", address >> 1);
320+
log_e("Bus Fail! Addr: %x", address >> 1);
321321
I2C_MUTEX_UNLOCK();
322322
return I2C_ERROR_BUS;
323323
}
324324

325325
//Bus timeout
326326
if(i2c->dev->int_raw.time_out) {
327-
//log_e("Bus Timeout! Addr: %x", address >> 1);
327+
log_e("Bus Timeout! Addr: %x", address >> 1);
328328
I2C_MUTEX_UNLOCK();
329329
return I2C_ERROR_TIMEOUT;
330330
}
331331

332332
//Transmission did not finish and ACK_ERR is set
333333
if(i2c->dev->int_raw.ack_err) {
334-
//log_w("Ack Error! Addr: %x", address >> 1);
334+
log_w("Ack Error! Addr: %x", address >> 1);
335335
I2C_MUTEX_UNLOCK();
336336
return I2C_ERROR_ACK;
337337
}
@@ -462,7 +462,7 @@ void i2cInitFix(i2c_t * i2c){
462462
i2cSetCmd(i2c, 2, I2C_CMD_STOP, 0, false, false, false);
463463
if (i2c->dev->status_reg.bus_busy) // If this condition is true, the while loop will timeout as done will not be set
464464
{
465-
//log_e("Busy at initialization!");
465+
log_e("Busy at initialization!");
466466
}
467467
i2c->dev->ctr.trans_start = 1;
468468
uint16_t count = 50000;

0 commit comments

Comments
 (0)