We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm beginning to suspect that the Arduino::micros function (which is pretty much the original) isn't behaving vey well.
Simplified:
static uint32_t micros() { uint32_t m; uint16_t t; uint8_t oldSREG = SREG; cli(); t = TCNT0; if ((TIFR & _BV(TOV0)) && (t == 0)) t = 256; m = timer0_overflow_count; SREG = oldSREG; return ((m << 8) + t) * (64 / (F_CPU / 1000000L)); }
Once m reaches 2**24, the value wraps around to t * 4 (assuming a 16MHz clock).
And timer0_overflow_count itself wraps around at 2^32, so the function resets twice over its value range.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm beginning to suspect that the Arduino::micros function (which is pretty much the original) isn't behaving vey well.
Simplified:
Once m reaches 2**24, the value wraps around to t * 4 (assuming a 16MHz clock).
And timer0_overflow_count itself wraps around at 2^32, so the function resets twice over its value range.
The text was updated successfully, but these errors were encountered: