Merge pull request #302 from cjbrigato/patch-1

Off by one in GetTickCountDelta (FIXes #301)
This commit is contained in:
Iceman 2019-08-01 06:46:39 +02:00 committed by GitHub
commit da815d7416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,7 @@ uint32_t RAMFUNC GetTickCount(void) {
uint32_t RAMFUNC GetTickCountDelta(uint32_t start_ticks) {
uint32_t stop_ticks = AT91C_BASE_RTTC->RTTC_RTVR;
if (stop_ticks > start_ticks)
if (stop_ticks >= start_ticks)
return stop_ticks - start_ticks;
return (UINT32_MAX - start_ticks) + stop_ticks;
}