From b624f32f944acdc59dcb130674c09090c5c404cb Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- quantum/velocikey.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'quantum/velocikey.c') diff --git a/quantum/velocikey.c b/quantum/velocikey.c index 550c3b70a6..6b7f82d950 100644 --- a/quantum/velocikey.c +++ b/quantum/velocikey.c @@ -4,23 +4,21 @@ #include "eeprom.h" #ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif #ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif #define TYPING_SPEED_MAX_VALUE 200 uint8_t typing_speed = 0; -bool velocikey_enabled(void) { - return eeprom_read_byte(EECONFIG_VELOCIKEY) == 1; -} +bool velocikey_enabled(void) { return eeprom_read_byte(EECONFIG_VELOCIKEY) == 1; } void velocikey_toggle(void) { - if (velocikey_enabled()) + if (velocikey_enabled()) eeprom_update_byte(EECONFIG_VELOCIKEY, 0); - else + else eeprom_update_byte(EECONFIG_VELOCIKEY, 1); } @@ -29,18 +27,16 @@ void velocikey_accelerate(void) { } void velocikey_decelerate(void) { - static uint16_t decay_timer = 0; - - if (timer_elapsed(decay_timer) > 500 || decay_timer == 0) { - if (typing_speed > 0) typing_speed -= 1; - //Decay a little faster at half of max speed - if (typing_speed > TYPING_SPEED_MAX_VALUE / 2) typing_speed -= 1; - //Decay even faster at 3/4 of max speed - if (typing_speed > TYPING_SPEED_MAX_VALUE / 4 * 3) typing_speed -= 2; - decay_timer = timer_read(); - } + static uint16_t decay_timer = 0; + + if (timer_elapsed(decay_timer) > 500 || decay_timer == 0) { + if (typing_speed > 0) typing_speed -= 1; + // Decay a little faster at half of max speed + if (typing_speed > TYPING_SPEED_MAX_VALUE / 2) typing_speed -= 1; + // Decay even faster at 3/4 of max speed + if (typing_speed > TYPING_SPEED_MAX_VALUE / 4 * 3) typing_speed -= 2; + decay_timer = timer_read(); + } } -uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { - return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE)); -} +uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE)); } -- cgit v1.2.3