diff options
author | Xyverz <xyverz@gmail.com> | 2016-08-19 22:50:55 -0700 |
---|---|---|
committer | Xyverz <xyverz@gmail.com> | 2016-08-19 22:50:55 -0700 |
commit | 70d4ea7904ef6063b83b34985294a9b9e578be62 (patch) | |
tree | b183763c85a581c7213cd2c247a9f30a75ee0576 /quantum/quantum.c | |
parent | e4984f65decbd005d147d29b56d7a0c7d7a8dafd (diff) | |
parent | a3a312f8f4f4d836de494fe3502ea3175ba2a22c (diff) | |
download | qmk_firmware-70d4ea7904ef6063b83b34985294a9b9e578be62.tar.gz qmk_firmware-70d4ea7904ef6063b83b34985294a9b9e578be62.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r-- | quantum/quantum.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index cb1ba04ffb..e3a20f43e0 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -1,5 +1,42 @@ #include "quantum.h" +static void do_code16 (uint16_t code, void (*f) (uint8_t)) { + switch (code) { + case QK_MODS ... QK_MODS_MAX: + break; + default: + return; + } + + if (code & QK_LCTL) + f(KC_LCTL); + if (code & QK_LSFT) + f(KC_LSFT); + if (code & QK_LALT) + f(KC_LALT); + if (code & QK_LGUI) + f(KC_LGUI); + + if (code & QK_RCTL) + f(KC_RCTL); + if (code & QK_RSFT) + f(KC_RSFT); + if (code & QK_RALT) + f(KC_RALT); + if (code & QK_RGUI) + f(KC_RGUI); +} + +void register_code16 (uint16_t code) { + do_code16 (code, register_code); + register_code (code); +} + +void unregister_code16 (uint16_t code) { + unregister_code (code); + do_code16 (code, unregister_code); +} + __attribute__ ((weak)) bool process_action_kb(keyrecord_t *record) { return true; |