From 863d59474be4d3e8d76e1af3a743788b35de908e Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Mon, 31 Dec 2018 13:30:53 +0100 Subject: [PATCH] Add function layer and small clean-up --- keyboards/planck/keymaps/sijmen/keymap.c | 59 +++++++++++++++++------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/keyboards/planck/keymaps/sijmen/keymap.c b/keyboards/planck/keymaps/sijmen/keymap.c index b7cffbd77..5373fb1bb 100644 --- a/keyboards/planck/keymaps/sijmen/keymap.c +++ b/keyboards/planck/keymaps/sijmen/keymap.c @@ -10,13 +10,25 @@ #define _______ KC_TRNS #define XXXXXXX KC_NO -#define O_CTL_ALT OSM(MOD_LCTL | MOD_LALT) #define O_SFT OSM(MOD_LSFT) -#define O_SFT_ALT OSM(MOD_LSFT | MOD_LALT) -#define O_CTL_GUI OSM(MOD_LCTL | MOD_LGUI) #define O_SFT_CTL OSM(MOD_LSFT | MOD_LCTL) #define O_SFT_GUI OSM(MOD_LSFT | MOD_LGUI) +enum { + _DEFAULT, + _SYMBOL, + _LSHIFT, + _RSHIFT, + _NUMBER, + _FUNCTION, +}; + +#define LT_SYM_LEFT LT(_SYMBOL, KC_LEFT) +#define LT_LSFT_SPC LT(_LSHIFT, KC_SPC) +#define LT_RSFT_BSPC LT(_RSHIFT, KC_BSPC) +#define LT_LNUM_ESC LT(_NUMBER, KC_ESC) +#define LT_TAB_FUNC LT(_FUNCTION, KC_TAB) + enum { TD_QUOT = 0, }; @@ -25,11 +37,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, S(KC_QUOT)), }; -#define LT_SYM_LEFT LT(1, KC_LEFT) -#define LT_LSFT_SPC LT(2, KC_SPC) -#define LT_RSFT_BSPC LT(3, KC_BSPC) -#define LT_LNUM_ESC LT(4, KC_ESC) - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Default @@ -43,11 +50,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | LCTL | LALT | LGUI | ESC | SPC | TAB | BSPC | BSPC | LEFT | DOWN | UP | RGHT | * `-----------------------------------------------------------------------------------' */ -[0] = { - {KC_Q, KC_D, KC_R, KC_W, KC_B, O_CTL_ALT, O_CTL_GUI, KC_J, KC_F, KC_U, KC_P, KC_SCLN }, - {KC_A, KC_S, KC_H, KC_T, KC_G, O_SFT, O_SFT, KC_Y, KC_N, KC_E, KC_O, KC_I }, - {KC_Z, KC_X, KC_M, KC_C, KC_V, KC_ENT, KC_ENT, KC_K, KC_L, KC_COMM, KC_DOT, TD(TD_QUOT)}, - {KC_LCTL, KC_LALT, KC_LGUI, LT_LNUM_ESC, LT_LSFT_SPC, KC_TAB, KC_BSPC, LT_RSFT_BSPC, LT_SYM_LEFT, KC_DOWN, KC_UP, KC_RGHT }, +[_DEFAULT] = { + {KC_Q, KC_D, KC_R, KC_W, KC_B, O_SFT_CTL, O_SFT_GUI, KC_J, KC_F, KC_U, KC_P, KC_SCLN }, + {KC_A, KC_S, KC_H, KC_T, KC_G, O_SFT, O_SFT, KC_Y, KC_N, KC_E, KC_O, KC_I }, + {KC_Z, KC_X, KC_M, KC_C, KC_V, KC_ENT, KC_ENT, KC_K, KC_L, KC_COMM, KC_DOT, TD(TD_QUOT)}, + {KC_LCTL, KC_LALT, KC_LGUI, LT_LNUM_ESC, LT_LSFT_SPC, LT_TAB_FUNC, KC_BSPC, LT_RSFT_BSPC, LT_SYM_LEFT, KC_DOWN, KC_UP, KC_RGHT }, }, /* Symbol @@ -61,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | LCTL | LALT | LGUI | ESC | SPC | TAB | BSPC | BSPC |[ SYM]| DOWN | UP | RGHT | * `-----------------------------------------------------------------------------------' */ -[1] = { +[_SYMBOL] = { {KC_LCBR, KC_DOT, KC_ASTR, KC_AMPR, KC_RCBR, _______, _______, S(KC_EQL), KC_HOME, KC_UP, KC_END, _______}, {KC_LPRN, KC_CIRC, KC_PERC, KC_DLR, KC_RPRN, _______, _______, KC_EQL, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX}, {KC_LBRC, KC_HASH, KC_AT, KC_EXLM, KC_RBRC, _______, _______, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, _______}, @@ -79,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | LCTL | LALT | LGUI | ESC |[LSFT]| TAB | BSPC | - | LEFT | DOWN | UP | RGHT | * `-----------------------------------------------------------------------------------' */ -[2] = { +[_LSHIFT] = { {S(KC_Q), S(KC_D), S(KC_R), S(KC_W), S(KC_B), _______, _______, S(KC_J), S(KC_F), S(KC_U), S(KC_P), S(KC_SCLN)}, {S(KC_A), S(KC_S), S(KC_H), S(KC_T), S(KC_G), _______, _______, S(KC_Y), S(KC_N), S(KC_E), S(KC_O), S(KC_I) }, {S(KC_Z), S(KC_X), S(KC_M), S(KC_C), S(KC_V), _______, _______, S(KC_K), S(KC_L), KC_SLSH, S(KC_SLSH), S(TD_QUOT)}, @@ -97,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | LCTL | LALT | LGUI | ESC | _ | TAB | BSPC |[RSFT]| LEFT | DOWN | UP | RGHT | * `-----------------------------------------------------------------------------------' */ -[3] = { +[_RSHIFT] = { {S(KC_Q), S(KC_D), S(KC_R), S(KC_W), S(KC_B), _______, _______, S(KC_J), S(KC_F), S(KC_U), S(KC_P), S(KC_SCLN)}, {S(KC_A), S(KC_S), S(KC_H), S(KC_T), S(KC_G), _______, _______, S(KC_Y), S(KC_N), S(KC_E), S(KC_O), S(KC_I) }, {S(KC_Z), S(KC_X), S(KC_M), S(KC_C), S(KC_V), _______, _______, S(KC_K), S(KC_L), KC_GRV, S(KC_GRV), S(TD_QUOT)}, @@ -115,12 +122,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | LCTL | LALT | LGUI | ESC | LSFT | TAB | BSPC | RSFT | 0 | . | u | i | * `-----------------------------------------------------------------------------------' */ -[4] = { +[_NUMBER] = { {XXXXXXX, XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, _______, _______, KC_E, KC_7, KC_8, KC_9, KC_F}, {XXXXXXX, S(KC_COMM), S(KC_DOT), KC_LPRN, KC_RPRN, _______, _______, KC_C, KC_4, KC_5, KC_6, KC_D}, {XXXXXXX, KC_X, KC_B, KC_LBRC, KC_RBRC, _______, _______, KC_A, KC_1, KC_2, KC_3, KC_B}, {_______, _______, _______, _______, KC_LSFT, _______, _______, KC_RSFT, KC_0, KC_DOT, KC_U, KC_I}, }, + +/* Function + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | LSFT | LSFT | | F5 | F6 | F7 | F8 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | ENT | ENT | | F1 | F2 | F3 | F4 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | LCTL | LALT | LGUI | ESC | LSFT | TAB | BSPC | RSFT | LEFT | DOWN | UP | RGHT | + * `-----------------------------------------------------------------------------------' + */ +[_FUNCTION] = { + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12 }, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8 }, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4 }, + {_______, _______, _______, _______, KC_LSFT, _______, _______, KC_RSFT, KC_LEFT, _______, _______, _______}, +}, }; const uint16_t PROGMEM fn_actions[] = {