~ruther/qmk_firmware

4e6d1ae0eaafb64d04ae6a5e00d2ef41623248cf — Pavel Župa 5 years ago 1858c3e
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
1 files changed, 6 insertions(+), 2 deletions(-)

M tmk_core/common/chibios/timer.c
M tmk_core/common/chibios/timer.c => tmk_core/common/chibios/timer.c +6 -2
@@ 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);
}