diff options
author | skullY <skullydazed@gmail.com> | 2019-08-30 11:19:03 -0700 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-08-30 15:01:52 -0700 |
commit | b624f32f944acdc59dcb130674c09090c5c404cb (patch) | |
tree | bc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /quantum/process_keycode/process_leader.c | |
parent | 61af76a10d00aba185b8338604171de490a13e3b (diff) | |
download | qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip |
clang-format changes
Diffstat (limited to 'quantum/process_keycode/process_leader.c')
-rw-r--r-- | quantum/process_keycode/process_leader.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c index f787e6b017..58a615d85a 100644 --- a/quantum/process_keycode/process_leader.c +++ b/quantum/process_keycode/process_leader.c @@ -16,64 +16,64 @@ #ifdef LEADER_ENABLE -#include "process_leader.h" -#include <string.h> +# include "process_leader.h" +# include <string.h> -#ifndef LEADER_TIMEOUT - #define LEADER_TIMEOUT 300 -#endif +# ifndef LEADER_TIMEOUT +# define LEADER_TIMEOUT 300 +# endif -__attribute__ ((weak)) -void leader_start(void) {} +__attribute__((weak)) void leader_start(void) {} -__attribute__ ((weak)) -void leader_end(void) {} +__attribute__((weak)) void leader_end(void) {} // Leader key stuff -bool leading = false; +bool leading = false; uint16_t leader_time = 0; -uint16_t leader_sequence[5] = {0, 0, 0, 0, 0}; -uint8_t leader_sequence_size = 0; +uint16_t leader_sequence[5] = {0, 0, 0, 0, 0}; +uint8_t leader_sequence_size = 0; void qk_leader_start(void) { - if (leading) { return; } - leader_start(); - leading = true; - leader_time = timer_read(); - leader_sequence_size = 0; - memset(leader_sequence, 0, sizeof(leader_sequence)); + if (leading) { + return; + } + leader_start(); + leading = true; + leader_time = timer_read(); + leader_sequence_size = 0; + memset(leader_sequence, 0, sizeof(leader_sequence)); } bool process_leader(uint16_t keycode, keyrecord_t *record) { - // Leader key set-up - if (record->event.pressed) { - if (leading) { - if (timer_elapsed(leader_time) < LEADER_TIMEOUT) { -#ifndef LEADER_KEY_STRICT_KEY_PROCESSING - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { - keycode = keycode & 0xFF; - } -#endif // LEADER_KEY_STRICT_KEY_PROCESSING - if ( leader_sequence_size < ( sizeof(leader_sequence) / sizeof(leader_sequence[0]) ) ) { - leader_sequence[leader_sequence_size] = keycode; - leader_sequence_size++; + // Leader key set-up + if (record->event.pressed) { + if (leading) { + if (timer_elapsed(leader_time) < LEADER_TIMEOUT) { +# ifndef LEADER_KEY_STRICT_KEY_PROCESSING + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { + keycode = keycode & 0xFF; + } +# endif // LEADER_KEY_STRICT_KEY_PROCESSING + if (leader_sequence_size < (sizeof(leader_sequence) / sizeof(leader_sequence[0]))) { + leader_sequence[leader_sequence_size] = keycode; + leader_sequence_size++; + } else { + leading = false; + leader_end(); + } +# ifdef LEADER_PER_KEY_TIMING + leader_time = timer_read(); +# endif + return false; + } } else { - leading = false; - leader_end(); + if (keycode == KC_LEAD) { + qk_leader_start(); + } } -#ifdef LEADER_PER_KEY_TIMING - leader_time = timer_read(); -#endif - return false; - } - } else { - if (keycode == KC_LEAD) { - qk_leader_start(); - } } - } - return true; + return true; } #endif |