-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential rollover edgecase in SysTick extended mode (#13)
Previously it was possible for us to have read a SYSTICK value just before overflow, have the rollover happen & exception fire, incrementing ROLLOVER_COUNT, resulting in a count off by a full 2**24. Now, we do two reads of the systick counter with ROLLOVER_COUNT read between them. We can now check if a rollover happened sometime between the two reads. If it has, we know to use the second reading and re-read ROLLOVER_COUNT to make sure we have the incremented value. If we didn't see any rollover, we're happy and use the first readings of the SYSTICK and ROLLOVER_COUNT.
- Loading branch information
Showing
1 changed file
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters