@@ -372,7 +372,7 @@ uint8_t AS726X::virtualReadRegister(uint8_t virtualAddr)
372
372
if (status == 0xFF ) return status;
373
373
if ((status & AS72XX_SLAVE_TX_VALID) == 0 ) break ; // If TX bit is clear, it is ok to write
374
374
delay (POLLING_DELAY);
375
- if (retries++ > retries ) return 0xFF ;
375
+ if (retries++ > MAX_RETRIES ) return 0xFF ;
376
376
}
377
377
378
378
// Send the virtual register address (bit 7 should be 0 to indicate we are reading a register).
@@ -387,7 +387,7 @@ uint8_t AS726X::virtualReadRegister(uint8_t virtualAddr)
387
387
if (status == 0xFF ) return status;
388
388
if ((status & AS72XX_SLAVE_RX_VALID) != 0 ) break ; // Read data is ready.
389
389
delay (POLLING_DELAY);
390
- if (retries++ > retries ) return 0xFF ;
390
+ if (retries++ > MAX_RETRIES ) return 0xFF ;
391
391
}
392
392
393
393
uint8_t incoming = readRegister (AS72XX_SLAVE_READ_REG);
@@ -407,7 +407,7 @@ int AS726X::virtualWriteRegister(uint8_t virtualAddr, uint8_t dataToWrite)
407
407
if (status == 0xFF ) return -1 ;
408
408
if ((status & AS72XX_SLAVE_TX_VALID) == 0 ) break ; // No inbound TX pending at slave. Okay to write now.
409
409
delay (POLLING_DELAY);
410
- if (retries++ > retries ) return -1 ;
410
+ if (retries++ > MAX_RETRIES ) return -1 ;
411
411
}
412
412
413
413
// Send the virtual register address (setting bit 7 to indicate we are writing to a register).
@@ -422,7 +422,7 @@ int AS726X::virtualWriteRegister(uint8_t virtualAddr, uint8_t dataToWrite)
422
422
if (status == 0xFF ) return -1 ;
423
423
if ((status & AS72XX_SLAVE_TX_VALID) == 0 ) break ; // No inbound TX pending at slave. Okay to write now.
424
424
delay (POLLING_DELAY);
425
- if (retries++ > retries ) return -1 ;
425
+ if (retries++ > MAX_RETRIES ) return -1 ;
426
426
}
427
427
428
428
// Send the data to complete the operation.
0 commit comments