Skip to content

Commit

Permalink
Fix timer_elapsed() overflow issue for STM32F103 and other ChibiOS bo…
Browse files Browse the repository at this point in the history
…ards (qmk#7595)

* fixed strange space cadet timer owerflow on STM32F103

* Moved elapsed time fix to timer.c
  • Loading branch information
dworki authored and fdidron committed Feb 14, 2020
1 parent 8998ae6 commit 2de3ecc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tmk_core/common/chibios/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 2de3ecc

Please sign in to comment.