We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8c03ff commit 68fe5f1Copy full SHA for 68fe5f1
libraries/Wire/src/utility/twi.c
@@ -394,10 +394,9 @@ void twi_stop(void)
394
395
// wait for stop condition to be exectued on bus
396
// TWINT is not set after a stop condition!
397
- uint32_t counter = 0;
+ unit32_t startMicros = micros();
398
while(TWCR & _BV(TWSTO)){
399
- counter++;
400
- if((twi_timeout_us > 0ul) && (counter >= 25000)) {
+ if((twi_timeout_us > 0ul) && (micros() - startMicros > twi_timeout_us)) {
401
twi_handleTimeout();
402
return;
403
}
0 commit comments