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_key_lock.c | |
parent | 61af76a10d00aba185b8338604171de490a13e3b (diff) | |
download | qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz |
clang-format changes
Diffstat (limited to 'quantum/process_keycode/process_key_lock.c')
-rw-r--r-- | quantum/process_keycode/process_key_lock.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/quantum/process_keycode/process_key_lock.c b/quantum/process_keycode/process_key_lock.c index 50cc0a5cc..602127a74 100644 --- a/quantum/process_keycode/process_key_lock.c +++ b/quantum/process_keycode/process_key_lock.c @@ -19,36 +19,33 @@ #include "process_key_lock.h" #define BV_64(shift) (((uint64_t)1) << (shift)) -#define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : \ - ((code) < 0x80) ? key_state[1] : \ - ((code) < 0xC0) ? key_state[2] : key_state[3]) -#define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : \ - ((code) < 0x80) ? (code) - 0x40 : \ - ((code) < 0xC0) ? (code) - 0x80 : (code) - 0xC0) -#define KEY_STATE(code) (GET_KEY_ARRAY(code) & BV_64(GET_CODE_INDEX(code))) == BV_64(GET_CODE_INDEX(code)) -#define SET_KEY_ARRAY_STATE(code, val) do { \ - switch (code) { \ - case 0x00 ... 0x3F: \ - key_state[0] = (val); \ - break; \ - case 0x40 ... 0x7F: \ - key_state[1] = (val); \ - break; \ - case 0x80 ... 0xBF: \ - key_state[2] = (val); \ - break; \ - case 0xC0 ... 0xFF: \ - key_state[3] = (val); \ - break; \ - } \ -} while(0) +#define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : ((code) < 0x80) ? key_state[1] : ((code) < 0xC0) ? key_state[2] : key_state[3]) +#define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : ((code) < 0x80) ? (code)-0x40 : ((code) < 0xC0) ? (code)-0x80 : (code)-0xC0) +#define KEY_STATE(code) (GET_KEY_ARRAY(code) & BV_64(GET_CODE_INDEX(code))) == BV_64(GET_CODE_INDEX(code)) +#define SET_KEY_ARRAY_STATE(code, val) \ + do { \ + switch (code) { \ + case 0x00 ... 0x3F: \ + key_state[0] = (val); \ + break; \ + case 0x40 ... 0x7F: \ + key_state[1] = (val); \ + break; \ + case 0x80 ... 0xBF: \ + key_state[2] = (val); \ + break; \ + case 0xC0 ... 0xFF: \ + key_state[3] = (val); \ + break; \ + } \ + } while (0) #define SET_KEY_STATE(code) SET_KEY_ARRAY_STATE(code, (GET_KEY_ARRAY(code) | BV_64(GET_CODE_INDEX(code)))) #define UNSET_KEY_STATE(code) SET_KEY_ARRAY_STATE(code, (GET_KEY_ARRAY(code)) & ~(BV_64(GET_CODE_INDEX(code)))) #define IS_STANDARD_KEYCODE(code) ((code) <= 0xFF) // Locked key state. This is an array of 256 bits, one for each of the standard keys supported qmk. -uint64_t key_state[4] = { 0x0, 0x0, 0x0, 0x0 }; -bool watching = false; +uint64_t key_state[4] = {0x0, 0x0, 0x0, 0x0}; +bool watching = false; // Translate any OSM keycodes back to their unmasked versions. static inline uint16_t translate_keycode(uint16_t keycode) { @@ -135,4 +132,3 @@ bool process_key_lock(uint16_t *keycode, keyrecord_t *record) { return !(IS_STANDARD_KEYCODE(translated_keycode) && KEY_STATE(translated_keycode)); } } - |