diff options
author | Pavel Župa <pavel.zupa@gmail.com> | 2020-02-01 10:17:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-01 20:17:28 +1100 |
commit | 4e6d1ae0eaafb64d04ae6a5e00d2ef41623248cf (patch) | |
tree | a827d1a76b6b0e6d40036c1e773b15ec7ff8dcfc | |
parent | 1858c3ed117b8c6b446ad28a7a2f0b8de39b1d71 (diff) | |
download | qmk_firmware-4e6d1ae0eaafb64d04ae6a5e00d2ef41623248cf.tar.gz qmk_firmware-4e6d1ae0eaafb64d04ae6a5e00d2ef41623248cf.zip |
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
-rw-r--r-- | tmk_core/common/chibios/timer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tmk_core/common/chibios/timer.c b/tmk_core/common/chibios/timer.c index 1ce9d1d17..66c4a6458 100644 --- a/tmk_core/common/chibios/timer.c +++ b/tmk_core/common/chibios/timer.c | |||
@@ -28,6 +28,10 @@ uint32_t timer_read32(void) { | |||
28 | return current_time_ms; | 28 | return current_time_ms; |
29 | } | 29 | } |
30 | 30 | ||
31 | uint16_t timer_elapsed(uint16_t last) { return timer_read() - last; } | 31 | uint16_t timer_elapsed(uint16_t last) { |
32 | return TIMER_DIFF_16(timer_read(), last); | ||
33 | } | ||
32 | 34 | ||
33 | uint32_t timer_elapsed32(uint32_t last) { return timer_read32() - last; } | 35 | uint32_t timer_elapsed32(uint32_t last) { |
36 | return TIMER_DIFF_32(timer_read32(), last); | ||
37 | } | ||