@@ -157,7 +157,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
157
157
158
158
if (i2c -> dev -> status_reg .bus_busy == 1 )
159
159
{
160
- //log_w ( "Busy Timeout! Addr: %x", address >> 1 );
160
+ log_e ( "Busy Timeout! Addr: %x" , address >> 1 );
161
161
I2C_MUTEX_UNLOCK ();
162
162
return I2C_ERROR_BUSY ;
163
163
}
@@ -207,28 +207,28 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
207
207
while (1 ) {
208
208
//have been looping for too long
209
209
if ((millis () - startAt )> 50 ){
210
- // log_e("Timeout! Addr: %x", address >> 1);
210
+ log_e ("Timeout! Addr: %x" , address >> 1 );
211
211
I2C_MUTEX_UNLOCK ();
212
212
return I2C_ERROR_BUS ;
213
213
}
214
214
215
215
//Bus failed (maybe check for this while waiting?
216
216
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 );
218
218
I2C_MUTEX_UNLOCK ();
219
219
return I2C_ERROR_BUS ;
220
220
}
221
221
222
222
//Bus timeout
223
223
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 );
225
225
I2C_MUTEX_UNLOCK ();
226
226
return I2C_ERROR_TIMEOUT ;
227
227
}
228
228
229
229
//Transmission did not finish and ACK_ERR is set
230
230
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 );
232
232
while ((i2c -> dev -> status_reg .bus_busy ) && ((millis () - startAt )> 50 ));
233
233
I2C_MUTEX_UNLOCK ();
234
234
return I2C_ERROR_ACK ;
@@ -260,7 +260,7 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
260
260
261
261
if (i2c -> dev -> status_reg .bus_busy == 1 )
262
262
{
263
- // log_w( "Busy Timeout! Addr: %x", address >> 1 );
263
+ log_w ( "Busy Timeout! Addr: %x" , address >> 1 );
264
264
I2C_MUTEX_UNLOCK ();
265
265
return I2C_ERROR_BUSY ;
266
266
}
@@ -310,28 +310,28 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
310
310
while (1 ) {
311
311
//have been looping for too long
312
312
if ((millis () - startAt )> 50 ){
313
- // log_e("Timeout! Addr: %x", address >> 1);
313
+ log_e ("Timeout! Addr: %x" , address >> 1 );
314
314
I2C_MUTEX_UNLOCK ();
315
315
return I2C_ERROR_BUS ;
316
316
}
317
317
318
318
//Bus failed (maybe check for this while waiting?
319
319
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 );
321
321
I2C_MUTEX_UNLOCK ();
322
322
return I2C_ERROR_BUS ;
323
323
}
324
324
325
325
//Bus timeout
326
326
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 );
328
328
I2C_MUTEX_UNLOCK ();
329
329
return I2C_ERROR_TIMEOUT ;
330
330
}
331
331
332
332
//Transmission did not finish and ACK_ERR is set
333
333
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 );
335
335
I2C_MUTEX_UNLOCK ();
336
336
return I2C_ERROR_ACK ;
337
337
}
@@ -462,7 +462,7 @@ void i2cInitFix(i2c_t * i2c){
462
462
i2cSetCmd (i2c , 2 , I2C_CMD_STOP , 0 , false, false, false);
463
463
if (i2c -> dev -> status_reg .bus_busy ) // If this condition is true, the while loop will timeout as done will not be set
464
464
{
465
- // log_e("Busy at initialization!");
465
+ log_e ("Busy at initialization!" );
466
466
}
467
467
i2c -> dev -> ctr .trans_start = 1 ;
468
468
uint16_t count = 50000 ;
0 commit comments