From b624f32f944acdc59dcb130674c09090c5c404cb Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- tmk_core/common/chibios/timer.c | 46 +++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'tmk_core/common/chibios/timer.c') diff --git a/tmk_core/common/chibios/timer.c b/tmk_core/common/chibios/timer.c index 473e533caa..1ce9d1d17c 100644 --- a/tmk_core/common/chibios/timer.c +++ b/tmk_core/common/chibios/timer.c @@ -2,40 +2,32 @@ #include "timer.h" -static systime_t last_systime = 0; -static systime_t overflow = 0; -static uint32_t current_time_ms = 0; +static systime_t last_systime = 0; +static systime_t overflow = 0; +static uint32_t current_time_ms = 0; -void timer_init(void) { - timer_clear(); -} +void timer_init(void) { timer_clear(); } void timer_clear(void) { - last_systime = chVTGetSystemTime(); - overflow = 0; - current_time_ms = 0; + last_systime = chVTGetSystemTime(); + overflow = 0; + current_time_ms = 0; } -uint16_t timer_read(void) { - return (uint16_t)timer_read32(); -} +uint16_t timer_read(void) { return (uint16_t)timer_read32(); } uint32_t timer_read32(void) { - // Note: We assume that the timer update is called at least once betweeen every wrap around of the system time - systime_t current_systime = chVTGetSystemTime(); - systime_t elapsed = current_systime - last_systime + overflow; - uint32_t elapsed_ms = ST2MS(elapsed); - current_time_ms += elapsed_ms; - overflow = elapsed - MS2ST(elapsed_ms); - last_systime = current_systime; - - return current_time_ms; + // Note: We assume that the timer update is called at least once betweeen every wrap around of the system time + systime_t current_systime = chVTGetSystemTime(); + systime_t elapsed = current_systime - last_systime + overflow; + uint32_t elapsed_ms = ST2MS(elapsed); + current_time_ms += elapsed_ms; + overflow = elapsed - MS2ST(elapsed_ms); + last_systime = current_systime; + + return current_time_ms; } -uint16_t timer_elapsed(uint16_t last) { - return timer_read() - last; -} +uint16_t timer_elapsed(uint16_t last) { return timer_read() - last; } -uint32_t timer_elapsed32(uint32_t last) { - return timer_read32() - last; -} +uint32_t timer_elapsed32(uint32_t last) { return timer_read32() - last; } -- cgit v1.2.3