summaryrefslogtreecommitdiff
path: root/keyboard/planck/extended_keymap_common.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-03-21 01:01:09 -0400
committerJack Humbert <jack.humb@gmail.com>2015-03-21 01:01:09 -0400
commit3d286a813e6a8ad77cf947978b7898b167ac0024 (patch)
tree2602a6e5862e15b3a00048805219aebb3b043caa /keyboard/planck/extended_keymap_common.c
parent5c45ba947c760cbb28e67d6eabb887fb56cdb170 (diff)
colemak shortcuts
Diffstat (limited to 'keyboard/planck/extended_keymap_common.c')
-rw-r--r--keyboard/planck/extended_keymap_common.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c
index 387ad43d35..d9f79ac041 100644
--- a/keyboard/planck/extended_keymap_common.c
+++ b/keyboard/planck/extended_keymap_common.c
@@ -30,14 +30,17 @@ static action_t keycode_to_action(uint16_t keycode);
/* converts key to action */
action_t action_for_key(uint8_t layer, keypos_t key)
{
+ // 16bit keycodes - important
uint16_t keycode = keymap_key_to_keycode(layer, key);
- // Handle mods in keymap
if (keycode > 0x00FF && 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) {
+ // Is a shortcut for function layer, pull last 12bits
return keymap_func_to_action(keycode & 0xFFF);
}
@@ -160,9 +163,7 @@ static action_t keycode_to_action(uint16_t keycode)
/* translates key to keycode */
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
- // return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
- // This limits it to a byte
-
+ // Read entire word (16bits)
return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
}
@@ -175,5 +176,6 @@ action_t keymap_fn_to_action(uint16_t 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