summaryrefslogtreecommitdiffstats
path: root/keyboard
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-03-20 22:49:32 -0400
committerJack Humbert <jack.humb@gmail.com>2015-03-20 22:49:32 -0400
commit5c45ba947c760cbb28e67d6eabb887fb56cdb170 (patch)
treeaaa96543fa1b2e2364ba1b7205ed251ec3f7d08a /keyboard
parenta94beded1a36057a2afc3d321b4c3f7dd6afa251 (diff)
function stuff too
Diffstat (limited to 'keyboard')
-rw-r--r--keyboard/planck/extended_keymap_common.c10
-rw-r--r--keyboard/planck/extended_keymap_common.h6
-rw-r--r--keyboard/planck/extended_keymap_jack.c6
3 files changed, 18 insertions, 4 deletions
diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c
index 895c7418be..387ad43d35 100644
--- a/keyboard/planck/extended_keymap_common.c
+++ b/keyboard/planck/extended_keymap_common.c
@@ -33,10 +33,12 @@ action_t action_for_key(uint8_t layer, keypos_t key)
uint16_t keycode = keymap_key_to_keycode(layer, key);
// Handle mods in keymap
- if (keycode > 0x00FF) {
+ if (keycode > 0x00FF && keycode < 0x2000) {
action_t action;
action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF);
return action;
+ } else if (keycode > 0x1FFF && keycode < 0x3000) {
+ return keymap_func_to_action(keycode & 0xFFF);
}
switch (keycode) {
@@ -169,3 +171,9 @@ 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)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
+} \ No newline at end of file
diff --git a/keyboard/planck/extended_keymap_common.h b/keyboard/planck/extended_keymap_common.h
index 773b1c5151..fdce9df970 100644
--- a/keyboard/planck/extended_keymap_common.h
+++ b/keyboard/planck/extended_keymap_common.h
@@ -54,6 +54,9 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
/* translates Fn keycode to action */
action_t keymap_fn_to_action(uint16_t keycode);
+/* translates Fn keycode to action */
+action_t keymap_func_to_action(uint16_t keycode);
+
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];
@@ -67,6 +70,9 @@ extern const uint16_t fn_actions[];
#define RALT(kc) kc | 0x1400
#define RGUI(kc) kc | 0x1800
+#define FUNC(kc) kc | 0x2000
+
#define S(kc) LSFT(kc)
+#define F(kc) FUNC(kc)
#endif
diff --git a/keyboard/planck/extended_keymap_jack.c b/keyboard/planck/extended_keymap_jack.c
index b5fea732b8..3f620afbb1 100644
--- a/keyboard/planck/extended_keymap_jack.c
+++ b/keyboard/planck/extended_keymap_jack.c
@@ -5,7 +5,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
- {KC_RSFT, KC_LCTL, KC_LALT, KC_LGUI, KC_FN2, KC_SPC, KC_NO, KC_FN1, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+ {KC_RSFT, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_NO, KC_FN1, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[1] = { /* Jack colemak */
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
@@ -21,7 +21,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
},
[3] = { /* Jack LOWER */
{S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
- {KC_TRNS, KC_FN3, KC_FN4, KC_PAUSE, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
+ {KC_TRNS, FUNC(3), KC_FN4, LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_FN2, KC_TRNS, KC_NO, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}
@@ -33,4 +33,4 @@ const uint16_t PROGMEM fn_actions[] = {
[3] = ACTION_DEFAULT_LAYER_SET(0),
[4] = ACTION_DEFAULT_LAYER_SET(1),
-}; \ No newline at end of file
+};