1
0
Fork 0

Fix timer_elapsed() overflow issue for STM32F103 and other ChibiOS boards (#7595)

* fixed strange space cadet timer owerflow on STM32F103

* Moved elapsed time fix to timer.c
This commit is contained in:
Pavel Župa 2020-02-01 10:17:28 +01:00 committed by GitHub
parent 1858c3ed11
commit 4e6d1ae0ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,10 @@ uint32_t timer_read32(void) {
return current_time_ms;
}
uint16_t timer_elapsed(uint16_t last) { return timer_read() - last; }
uint16_t timer_elapsed(uint16_t last) {
return TIMER_DIFF_16(timer_read(), last);
}
uint32_t timer_elapsed32(uint32_t last) { return timer_read32() - last; }
uint32_t timer_elapsed32(uint32_t last) {
return TIMER_DIFF_32(timer_read32(), last);
}