diff options
author | Jack Humbert <jack.humb@gmail.com> | 2015-03-23 05:33:54 +0100 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2015-03-23 05:33:54 +0100 |
commit | 4454ded0af219362604cda0e3f5eb6001b90dc6d (patch) | |
tree | d69716bd55f3bd9035c9d5baf8d43247f337dba0 /keyboard/planck/extended_keymap_common.c | |
parent | 9514ee8df71350076b668fddee32c1c143c65372 (diff) | |
download | qmk_firmware-4454ded0af219362604cda0e3f5eb6001b90dc6d.tar.gz qmk_firmware-4454ded0af219362604cda0e3f5eb6001b90dc6d.tar.xz |
macros
Diffstat (limited to 'keyboard/planck/extended_keymap_common.c')
-rw-r--r-- | keyboard/planck/extended_keymap_common.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c index d9f79ac04..f8fc3209f 100644 --- a/keyboard/planck/extended_keymap_common.c +++ b/keyboard/planck/extended_keymap_common.c @@ -33,15 +33,19 @@ action_t action_for_key(uint8_t layer, keypos_t key) // 16bit keycodes - important uint16_t keycode = keymap_key_to_keycode(layer, key); - if (keycode > 0x00FF && keycode < 0x2000) { + if (keycode >= 0x0100 && keycode < 0x2000) { // Has a modifier action_t action; // Split it up action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); return action; - } else if (keycode > 0x1FFF && keycode < 0x3000) { + } else if (keycode >= 0x2000 && keycode < 0x3000) { // Is a shortcut for function layer, pull last 12bits return keymap_func_to_action(keycode & 0xFFF); + } else if (keycode >= 0x3000 && keycode < 0x4000) { + action_t action; + action.code = ACTION_MACRO(keycode & 0xFF); + return action; } switch (keycode) { @@ -173,9 +177,8 @@ action_t keymap_fn_to_action(uint16_t keycode) return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; } -/* translates Fn keycode to action */ action_t keymap_func_to_action(uint16_t keycode) { // For FUNC without 8bit limit return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; -}
\ No newline at end of file +} |