From 61d83c9e8d0804a1999f717663976ff23015a721 Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Thu, 12 Mar 2015 17:01:55 -0500 Subject: [PATCH 1/8] added my keymap --- keyboard/planck/keymap_charlie.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 keyboard/planck/keymap_charlie.c diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c new file mode 100644 index 000000000000..ab60925a3ef2 --- /dev/null +++ b/keyboard/planck/keymap_charlie.c @@ -0,0 +1,23 @@ +#include "keymap_common.h" + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = KEYMAP( /* Charlie workman */ + ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSLS, + LCTL, A, S, H, T, G, Y, N, E, O, QUOT, BSPC, + LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, ENT, + RSFT, LALT, LGUI, RCTL, FN2, SPC, FN1, LEFT, DOWN, UP, RGHT), +[1] = KEYMAP( /* Charlie RAISE */ + TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, + TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, BSLS, + TRNS, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN1, MNXT, VOLD, VOLU, MPLY), +[2] = KEYMAP( /* Charlie LOWER */ + GRV, FN10, FN11, FN12, FN13, FN14, FN15, FN16, FN17, FN18, FN19, BSPC, + TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, FN20, FN21, FN23, FN24, FN28, + TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, + TRNS, TRNS, TRNS, TRNS, FN2, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), +}; +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay + [2] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay +}; From 84760b098e8cb916f4516d165a0b1fa351188e1b Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Fri, 13 Mar 2015 10:07:51 -0500 Subject: [PATCH 2/8] added my keymap --- keyboard/planck/keymap_charlie.c | 6 +++--- keyboard/planck/keymap_common.h | 2 +- keyboard/planck/matrix.c | 34 ++++++++++++++++---------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index ab60925a3ef2..95b57198df9b 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -3,9 +3,9 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( /* Charlie workman */ ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSLS, - LCTL, A, S, H, T, G, Y, N, E, O, QUOT, BSPC, + LCTL, A, S, H, T, G, Y, N, E, O, I, BSPC, LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, ENT, - RSFT, LALT, LGUI, RCTL, FN2, SPC, FN1, LEFT, DOWN, UP, RGHT), + RSFT, LALT, LGUI, RCTL, FN2, SPC, FN1, LEFT, DOWN, UP, RGHT), [1] = KEYMAP( /* Charlie RAISE */ TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, BSLS, @@ -13,7 +13,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN1, MNXT, VOLD, VOLU, MPLY), [2] = KEYMAP( /* Charlie LOWER */ GRV, FN10, FN11, FN12, FN13, FN14, FN15, FN16, FN17, FN18, FN19, BSPC, - TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, FN20, FN21, FN23, FN24, FN28, + TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, FN20, FN21, FN23, QUOT, FN28, TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, TRNS, TRNS, TRNS, TRNS, FN2, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), }; diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h index 8a55fd9ee0dd..dbc7063346f0 100644 --- a/keyboard/planck/keymap_common.h +++ b/keyboard/planck/keymap_common.h @@ -44,7 +44,7 @@ extern const uint16_t fn_actions[]; { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_NO, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ } // Grid Layout diff --git a/keyboard/planck/matrix.c b/keyboard/planck/matrix.c index 38d35e3e07d5..fad754c44d42 100644 --- a/keyboard/planck/matrix.c +++ b/keyboard/planck/matrix.c @@ -136,10 +136,10 @@ uint8_t matrix_key_count(void) static void init_cols(void) { - DDRB &= ~(1<<6 | 1<<5 | 1<<4); - PORTB |= (1<<6 | 1<<5 | 1<<4); - DDRD &= ~(1<<7 | 1<<6 | 1<<4); - PORTD |= (1<<7 | 1<<6 | 1<<4); + DDRB &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4); + PORTB |= (1<<7 | 1<<6 | 1<<5 | 1<<4); + DDRD &= ~(1<<7 | 1<<0); + PORTD |= (1<<7 | 1<<0); DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); @@ -147,18 +147,18 @@ static void init_cols(void) static matrix_row_t read_cols(void) { - return (PIND&(1<<4) ? 0 : (1<<0)) | - (PIND&(1<<6) ? 0 : (1<<1)) | - (PIND&(1<<7) ? 0 : (1<<2)) | - (PINB&(1<<4) ? 0 : (1<<3)) | - (PINB&(1<<5) ? 0 : (1<<4)) | - (PINB&(1<<6) ? 0 : (1<<5)) | - (PINF&(1<<7) ? 0 : (1<<6)) | - (PINF&(1<<6) ? 0 : (1<<7)) | - (PINF&(1<<5) ? 0 : (1<<8)) | - (PINF&(1<<4) ? 0 : (1<<9)) | - (PINF&(1<<1) ? 0 : (1<<10)) | - (PINF&(1<<0) ? 0 : (1<<11)); + return (PIND&(1<<0) ? 0 : (1<<0)) | + (PINB&(1<<7) ? 0 : (1<<1)) | + (PINF&(1<<0) ? 0 : (1<<2)) | + (PINF&(1<<1) ? 0 : (1<<3)) | + (PINF&(1<<4) ? 0 : (1<<4)) | + (PINF&(1<<5) ? 0 : (1<<5)) | + (PINF&(1<<6) ? 0 : (1<<6)) | + (PINF&(1<<7) ? 0 : (1<<7)) | + (PINB&(1<<6) ? 0 : (1<<8)) | + (PINB&(1<<5) ? 0 : (1<<9)) | + (PINB&(1<<4) ? 0 : (1<<10)) | + (PIND&(1<<7) ? 0 : (1<<11)); } @@ -190,4 +190,4 @@ static void select_row(uint8_t row) break; } -} \ No newline at end of file +} From 29bf47a2f6214d0fe5c70e5e852ef950aaf8d946 Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Sat, 14 Mar 2015 11:31:05 -0500 Subject: [PATCH 3/8] updated my keymap --- keyboard/planck/keymap_charlie.c | 47 ++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index 95b57198df9b..28491c29311e 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -1,23 +1,42 @@ #include "keymap_common.h" const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = KEYMAP( /* Charlie workman */ - ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSLS, - LCTL, A, S, H, T, G, Y, N, E, O, I, BSPC, - LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, ENT, - RSFT, LALT, LGUI, RCTL, FN2, SPC, FN1, LEFT, DOWN, UP, RGHT), -[1] = KEYMAP( /* Charlie RAISE */ - TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, - TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, BSLS, - TRNS, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TRNS, +[0] = KEYMAP( /* Charlie querty */ + ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, + LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, + LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, + FN3, LCTL, LGUI, LALT, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), +[1] = KEYMAP( /* Charlie workman */ + ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, + LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, + LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, + FN3, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), +[2] = KEYMAP( /* Charlie RAISE */ + TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, + TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS, + TRNS, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN1, MNXT, VOLD, VOLU, MPLY), -[2] = KEYMAP( /* Charlie LOWER */ - GRV, FN10, FN11, FN12, FN13, FN14, FN15, FN16, FN17, FN18, FN19, BSPC, - TRNS, FN3, FN4, PAUSE, TRNS, TRNS, TRNS, FN20, FN21, FN23, QUOT, FN28, +[3] = KEYMAP( /* Charlie LOWER */ + GRV, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, BSLS, + TRNS, FN14, FN15, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, QUOT, TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, TRNS, TRNS, TRNS, TRNS, FN2, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay - [2] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay + [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay + [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay + + [3] = ACTION_MODS_KEY(MOD_LGUI, KC_TAB), // switch windows + [4] = ACTION_MODS_KEY(MOD_LSFT, KC_1), // ! + [5] = ACTION_MODS_KEY(MOD_LSFT, KC_2), // @ + [6] = ACTION_MODS_KEY(MOD_LSFT, KC_3), // # + [7] = ACTION_MODS_KEY(MOD_LSFT, KC_4), // $ + [8] = ACTION_MODS_KEY(MOD_LSFT, KC_5), // % + [9] = ACTION_MODS_KEY(MOD_LSFT, KC_6), // ^ + [10] = ACTION_MODS_KEY(MOD_LSFT, KC_7), // & + [11] = ACTION_MODS_KEY(MOD_LSFT, KC_8), // * + [12] = ACTION_MODS_KEY(MOD_LSFT, KC_9), // ( + [13] = ACTION_MODS_KEY(MOD_LSFT, KC_0), // ) + [14] = ACTION_DEFAULT_LAYER_SET(1), // change to workman + [15] = ACTION_DEFAULT_LAYER_SET(0), // change to querty }; From 9d0c2b1de5540d20c1791c5a917aa88e582f47f1 Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Sun, 19 Jul 2015 20:28:34 -0500 Subject: [PATCH 4/8] Add mouse func and make workman primary --- keyboard/planck/keymap_charlie.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index 28491c29311e..559e74ae01ec 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -1,26 +1,32 @@ #include "keymap_common.h" const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = KEYMAP( /* Charlie querty */ - ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, - LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, - LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LGUI, LALT, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), -[1] = KEYMAP( /* Charlie workman */ + +[0] = KEYMAP( /* Charlie workman */ ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, FN3, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), +[1] = KEYMAP( /* Charlie querty */ + ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, + LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, + LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, + FN3, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), [2] = KEYMAP( /* Charlie RAISE */ TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS, - TRNS, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TRNS, - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN1, MNXT, VOLD, VOLU, MPLY), + TRNS, F11, F12, F13, F14, F15, F16, F17, TRNS, TRNS, TRNS, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, MNXT, VOLD, VOLU, MPLY), [3] = KEYMAP( /* Charlie LOWER */ GRV, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, BSLS, TRNS, FN14, FN15, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, QUOT, TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, - TRNS, TRNS, TRNS, TRNS, FN2, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), + TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), +[4] = KEYMAP( /* Charlie MOUSE */ + GRV, FN15, TRNS, TRNS, TRNS, TRNS, TRNS, MS_BTN1, MS_BTN2, MS_BTN3, TRNS, BSLS, + TRNS, FN14, MS_ACCEL0, MS_ACCEL1, MS_ACCEL2, TRNS, TRNS, MS_LEFT, MS_DOWN, MS_UP, MS_RIGHT, QUOT, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MS_WH_LEFT, MS_WH_DOWN, MS_WH_UP, MS_WH_RIGHT, TRNS, + TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), }; const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay @@ -37,6 +43,7 @@ const uint16_t PROGMEM fn_actions[] = { [11] = ACTION_MODS_KEY(MOD_LSFT, KC_8), // * [12] = ACTION_MODS_KEY(MOD_LSFT, KC_9), // ( [13] = ACTION_MODS_KEY(MOD_LSFT, KC_0), // ) - [14] = ACTION_DEFAULT_LAYER_SET(1), // change to workman - [15] = ACTION_DEFAULT_LAYER_SET(0), // change to querty + [14] = ACTION_DEFAULT_LAYER_SET(1), // change to qwerty + [15] = ACTION_DEFAULT_LAYER_SET(0), // change to workman + [16] = ACTION_LAYER_MOMENTARY(4), // change to mouse }; From 54bf6e2a8b74784b6a95cbd1a33d2fe9119c4198 Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Thu, 10 Sep 2015 20:53:49 -0500 Subject: [PATCH 5/8] Add keymap swap --- keyboard/planck/keymap_charlie.c | 55 ++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index 559e74ae01ec..836d0f663e35 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -1,33 +1,72 @@ #include "keymap_common.h" +#include "action_layer.h" +#include "action.h" +#include "action_util.h" const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = KEYMAP( /* Charlie workman */ +[0] = KEYMAP_AND_SWAP( /* Charlie workman */ ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), -[1] = KEYMAP( /* Charlie querty */ + FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, LEFT, DOWN, UP, RGHT), +[2] = KEYMAP_AND_SWAP( /* Charlie querty */ ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), -[2] = KEYMAP( /* Charlie RAISE */ + FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, LEFT, DOWN, UP, RGHT), +[4] = KEYMAP_AND_SWAP( /* Charlie RAISE */ TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS, TRNS, F11, F12, F13, F14, F15, F16, F17, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, MNXT, VOLD, VOLU, MPLY), -[3] = KEYMAP( /* Charlie LOWER */ +[6] = KEYMAP_AND_SWAP( /* Charlie LOWER */ GRV, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, BSLS, TRNS, FN14, FN15, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, QUOT, TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), -[4] = KEYMAP( /* Charlie MOUSE */ +[8] = KEYMAP_AND_SWAP( /* Charlie MOUSE */ GRV, FN15, TRNS, TRNS, TRNS, TRNS, TRNS, MS_BTN1, MS_BTN2, MS_BTN3, TRNS, BSLS, TRNS, FN14, MS_ACCEL0, MS_ACCEL1, MS_ACCEL2, TRNS, TRNS, MS_LEFT, MS_DOWN, MS_UP, MS_RIGHT, QUOT, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MS_WH_LEFT, MS_WH_DOWN, MS_WH_UP, MS_WH_RIGHT, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), }; + + +enum function_id { + SPACE_FN, +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch (id) { + case SPACE_FN: + if (record->event.pressed) { + // Change the keyboard maps. + // Whatever even layer's are on, turn on the odd one's too. + for (uint8_t i = 0; i < 9; i += 2) { + if (layer_state & (1UL << i)) + layer_on(i + 1); + } + layer_on(1); + } else { + // turn off all the even layers. + for (uint8_t i = 0; i < 9; i += 2) + layer_off(i + 1); + + if (record->tap.count != 0) { + // Space was tapped rather than used like a modifier. + // So send a space up and down event. + add_key(KC_SPC); + send_keyboard_report(); + del_key(KC_SPC); + send_keyboard_report(); + } + } + break; + } +} + const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay @@ -46,4 +85,6 @@ const uint16_t PROGMEM fn_actions[] = { [14] = ACTION_DEFAULT_LAYER_SET(1), // change to qwerty [15] = ACTION_DEFAULT_LAYER_SET(0), // change to workman [16] = ACTION_LAYER_MOMENTARY(4), // change to mouse + + [17] = ACTION_FUNCTION_TAP(SPACE_FN), }; From b2b94cd8497a8d24789137e189878cafd9a597dd Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Sat, 26 Sep 2015 13:32:42 -0500 Subject: [PATCH 6/8] Use reverse instead of swap and don't reverse bottom --- keyboard/planck/keymap_charlie.c | 24 ++++++++--------- keyboard/planck/keymap_common.h | 45 +++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index 836d0f663e35..cc5f0bc787d3 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -5,27 +5,27 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = KEYMAP_AND_SWAP( /* Charlie workman */ - ESC, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, +[0] = KEYMAP_AND_REVERSE( /* Charlie workman */ + TAB, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, LEFT, DOWN, UP, RGHT), -[2] = KEYMAP_AND_SWAP( /* Charlie querty */ - ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, + FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, RGUI, RALT, RCTL, FN3), +[2] = KEYMAP_AND_REVERSE( /* Charlie querty */ + TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC, LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, LEFT, DOWN, UP, RGHT), -[4] = KEYMAP_AND_SWAP( /* Charlie RAISE */ - TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, + FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, RGUI, RALT, RCTL, FN3), +[4] = KEYMAP_AND_REVERSE( /* Charlie RAISE */ + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS, TRNS, F11, F12, F13, F14, F15, F16, F17, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, MNXT, VOLD, VOLU, MPLY), -[6] = KEYMAP_AND_SWAP( /* Charlie LOWER */ +[6] = KEYMAP_AND_REVERSE( /* Charlie LOWER */ GRV, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, BSLS, TRNS, FN14, FN15, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, QUOT, TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), -[8] = KEYMAP_AND_SWAP( /* Charlie MOUSE */ +[8] = KEYMAP_AND_REVERSE( /* Charlie MOUSE */ GRV, FN15, TRNS, TRNS, TRNS, TRNS, TRNS, MS_BTN1, MS_BTN2, MS_BTN3, TRNS, BSLS, TRNS, FN14, MS_ACCEL0, MS_ACCEL1, MS_ACCEL2, TRNS, TRNS, MS_LEFT, MS_DOWN, MS_UP, MS_RIGHT, QUOT, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MS_WH_LEFT, MS_WH_DOWN, MS_WH_UP, MS_WH_RIGHT, TRNS, @@ -68,8 +68,8 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) } const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay - [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay + [1] = ACTION_LAYER_MOMENTARY(4), // to Fn overlay + [2] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay [3] = ACTION_MODS_KEY(MOD_LGUI, KC_TAB), // switch windows [4] = ACTION_MODS_KEY(MOD_LSFT, KC_1), // ! diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h index dbc7063346f0..11ecef15fc54 100644 --- a/keyboard/planck/keymap_common.h +++ b/keyboard/planck/keymap_common.h @@ -34,21 +34,54 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; -// MIT Layout +/* GH60 keymap definition macro + * K2C, K31 and K3C are extra keys for ISO + */ #define KEYMAP( \ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ + K30, K31, K32, K33, K34, K36, K37, K38, K39, K3A, K3B \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \ } -// Grid Layout -#define KEYMAP_GRID( \ +/* We don't want to reverse the bottom row */ +#define KEYMAP_REVERSE( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K36, K37, K38, K39, K3A, K3B \ + ) { \ + { KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \ + { KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \ + { KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \ + } + +#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args) + +#define KEYMAP_SWAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K36, K37, K38, K39, K3A, K3B \ + ) { \ + { KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \ + { KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \ + { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \ + { KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_##K36, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \ +} + +#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args) + +/* + Keymap for the Planck 48 key variant. + */ +#define KEYMAP_48( \ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ @@ -57,7 +90,7 @@ extern const uint16_t fn_actions[]; { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \ } From ea9da95732712c09b403392a7fb17cad48c7c07c Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Sun, 27 Sep 2015 17:59:56 -0500 Subject: [PATCH 7/8] Remove mouse functions --- keyboard/planck/keymap_charlie.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index cc5f0bc787d3..69edd00a35bb 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -9,27 +9,22 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TAB, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, RGUI, RALT, RCTL, FN3), + FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3), [2] = KEYMAP_AND_REVERSE( /* Charlie querty */ TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC, LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, FN17, FN2, RGUI, RALT, RCTL, FN3), + FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3), [4] = KEYMAP_AND_REVERSE( /* Charlie RAISE */ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS, TRNS, F11, F12, F13, F14, F15, F16, F17, TRNS, TRNS, TRNS, TRNS, - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN16, MNXT, VOLD, VOLU, MPLY), + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), [6] = KEYMAP_AND_REVERSE( /* Charlie LOWER */ GRV, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, BSLS, TRNS, FN14, FN15, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, QUOT, TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, - TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), -[8] = KEYMAP_AND_REVERSE( /* Charlie MOUSE */ - GRV, FN15, TRNS, TRNS, TRNS, TRNS, TRNS, MS_BTN1, MS_BTN2, MS_BTN3, TRNS, BSLS, - TRNS, FN14, MS_ACCEL0, MS_ACCEL1, MS_ACCEL2, TRNS, TRNS, MS_LEFT, MS_DOWN, MS_UP, MS_RIGHT, QUOT, - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MS_WH_LEFT, MS_WH_DOWN, MS_WH_UP, MS_WH_RIGHT, TRNS, - TRNS, TRNS, TRNS, TRNS, FN16, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY), }; @@ -70,7 +65,6 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_MOMENTARY(4), // to Fn overlay [2] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay - [3] = ACTION_MODS_KEY(MOD_LGUI, KC_TAB), // switch windows [4] = ACTION_MODS_KEY(MOD_LSFT, KC_1), // ! [5] = ACTION_MODS_KEY(MOD_LSFT, KC_2), // @ @@ -84,7 +78,5 @@ const uint16_t PROGMEM fn_actions[] = { [13] = ACTION_MODS_KEY(MOD_LSFT, KC_0), // ) [14] = ACTION_DEFAULT_LAYER_SET(1), // change to qwerty [15] = ACTION_DEFAULT_LAYER_SET(0), // change to workman - [16] = ACTION_LAYER_MOMENTARY(4), // change to mouse - - [17] = ACTION_FUNCTION_TAP(SPACE_FN), + [16] = ACTION_FUNCTION_TAP(SPACE_FN), // space reverse }; From e3531dacd77ce9346a31ede0cd522a6b6fac62dd Mon Sep 17 00:00:00 2001 From: Charlie Andrews Date: Sun, 27 Sep 2015 18:09:41 -0500 Subject: [PATCH 8/8] Made querty the default layout this is so I can leave my machine on workman and have my keyboard be the same --- keyboard/planck/keymap_charlie.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/keyboard/planck/keymap_charlie.c b/keyboard/planck/keymap_charlie.c index 69edd00a35bb..23f51163b0a7 100644 --- a/keyboard/planck/keymap_charlie.c +++ b/keyboard/planck/keymap_charlie.c @@ -4,17 +4,16 @@ #include "action_util.h" const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[0] = KEYMAP_AND_REVERSE( /* Charlie workman */ - TAB, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, - LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, - LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, - FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3), -[2] = KEYMAP_AND_REVERSE( /* Charlie querty */ +[0] = KEYMAP_AND_REVERSE( /* Charlie querty */ TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC, LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT, LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3), +[2] = KEYMAP_AND_REVERSE( /* Charlie workman */ + TAB, Q, D, R, W, B, J, F, U, P, SCLN, BSPC, + LCTL, A, S, H, T, G, Y, N, E, O, I, ENT, + LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT, + FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3), [4] = KEYMAP_AND_REVERSE( /* Charlie RAISE */ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS,