diff options
author | tmk <nobody@nowhere> | 2013-03-05 15:45:15 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2013-03-05 15:45:15 +0900 |
commit | 38bbe976e00a9a7bf6f8157016717e80503bf6a9 (patch) | |
tree | 9113cd57c1bff3deef394ee966e2fdac8731a244 /keyboard | |
parent | 1720cf34caa518a2cf85f286d1ca077ebe1a1451 (diff) | |
parent | 5808317b694004c43a6e0f76e9715415cce19a25 (diff) | |
download | qmk_firmware-38bbe976e00a9a7bf6f8157016717e80503bf6a9.tar.gz qmk_firmware-38bbe976e00a9a7bf6f8157016717e80503bf6a9.zip |
Merge branch 'overlays'
Diffstat (limited to 'keyboard')
-rw-r--r-- | keyboard/IIgs/Makefile (renamed from keyboard/IIgs_Standard/Makefile) | 0 | ||||
-rw-r--r-- | keyboard/IIgs/README (renamed from keyboard/IIgs_Standard/README) | 0 | ||||
-rw-r--r-- | keyboard/IIgs/config.h (renamed from keyboard/IIgs_Standard/config.h) | 0 | ||||
-rw-r--r-- | keyboard/IIgs/doc/PIN_BYPASS.jpg (renamed from keyboard/IIgs_Standard/doc/PIN_BYPASS.jpg) | bin | 329437 -> 329437 bytes | |||
-rw-r--r-- | keyboard/IIgs/doc/Teensy++_Mod.jpg (renamed from keyboard/IIgs_Standard/doc/Teensy++_Mod.jpg) | bin | 74137 -> 74137 bytes | |||
-rwxr-xr-x | keyboard/IIgs/hid_listen.mac (renamed from keyboard/IIgs_Standard/hid_listen.mac) | bin | 13524 -> 13524 bytes | |||
-rw-r--r-- | keyboard/IIgs/keymap.c (renamed from keyboard/IIgs_Standard/keymap.c) | 0 | ||||
-rw-r--r-- | keyboard/IIgs/led.c (renamed from keyboard/IIgs_Standard/led.c) | 0 | ||||
-rw-r--r-- | keyboard/IIgs/matrix.c (renamed from keyboard/IIgs_Standard/matrix.c) | 0 | ||||
-rw-r--r-- | keyboard/gh60/Makefile.lufa | 6 | ||||
-rw-r--r-- | keyboard/gh60/Makefile.pjrc | 6 | ||||
-rw-r--r-- | keyboard/gh60/README.md | 7 | ||||
-rw-r--r-- | keyboard/gh60/config.h | 2 | ||||
-rw-r--r-- | keyboard/gh60/keymap.c | 153 | ||||
-rw-r--r-- | keyboard/gh60/keymap_plain.h | 20 | ||||
-rw-r--r-- | keyboard/gh60/keymap_poker.h | 142 | ||||
-rw-r--r-- | keyboard/gh60/keymap_poker_bit.h | 50 | ||||
-rw-r--r-- | keyboard/gh60/keymap_poker_set.h | 81 | ||||
-rw-r--r-- | keyboard/hhkb/config.h | 2 | ||||
-rw-r--r-- | keyboard/hhkb/config_iwrap.h | 2 | ||||
-rw-r--r-- | keyboard/hhkb/keymap.c | 195 |
21 files changed, 429 insertions, 237 deletions
diff --git a/keyboard/IIgs_Standard/Makefile b/keyboard/IIgs/Makefile index c18e9720c7..c18e9720c7 100644 --- a/keyboard/IIgs_Standard/Makefile +++ b/keyboard/IIgs/Makefile diff --git a/keyboard/IIgs_Standard/README b/keyboard/IIgs/README index 4f9cad1ca1..4f9cad1ca1 100644 --- a/keyboard/IIgs_Standard/README +++ b/keyboard/IIgs/README diff --git a/keyboard/IIgs_Standard/config.h b/keyboard/IIgs/config.h index 11acf87c07..11acf87c07 100644 --- a/keyboard/IIgs_Standard/config.h +++ b/keyboard/IIgs/config.h diff --git a/keyboard/IIgs_Standard/doc/PIN_BYPASS.jpg b/keyboard/IIgs/doc/PIN_BYPASS.jpg Binary files differindex 2998f0c3f8..2998f0c3f8 100644 --- a/keyboard/IIgs_Standard/doc/PIN_BYPASS.jpg +++ b/keyboard/IIgs/doc/PIN_BYPASS.jpg diff --git a/keyboard/IIgs_Standard/doc/Teensy++_Mod.jpg b/keyboard/IIgs/doc/Teensy++_Mod.jpg Binary files differindex 146c1ab93c..146c1ab93c 100644 --- a/keyboard/IIgs_Standard/doc/Teensy++_Mod.jpg +++ b/keyboard/IIgs/doc/Teensy++_Mod.jpg diff --git a/keyboard/IIgs_Standard/hid_listen.mac b/keyboard/IIgs/hid_listen.mac Binary files differindex 8758fdf886..8758fdf886 100755 --- a/keyboard/IIgs_Standard/hid_listen.mac +++ b/keyboard/IIgs/hid_listen.mac diff --git a/keyboard/IIgs_Standard/keymap.c b/keyboard/IIgs/keymap.c index cd33e223ac..cd33e223ac 100644 --- a/keyboard/IIgs_Standard/keymap.c +++ b/keyboard/IIgs/keymap.c diff --git a/keyboard/IIgs_Standard/led.c b/keyboard/IIgs/led.c index f76545f0ba..f76545f0ba 100644 --- a/keyboard/IIgs_Standard/led.c +++ b/keyboard/IIgs/led.c diff --git a/keyboard/IIgs_Standard/matrix.c b/keyboard/IIgs/matrix.c index 6ca55b7ea2..6ca55b7ea2 100644 --- a/keyboard/IIgs_Standard/matrix.c +++ b/keyboard/IIgs/matrix.c diff --git a/keyboard/gh60/Makefile.lufa b/keyboard/gh60/Makefile.lufa index c8d3fa4943..7a83032969 100644 --- a/keyboard/gh60/Makefile.lufa +++ b/keyboard/gh60/Makefile.lufa @@ -124,3 +124,9 @@ plain: all poker: OPT_DEFS += -DKEYMAP_POKER poker: all + +poker_set: OPT_DEFS += -DKEYMAP_POKER_SET +poker_set: all + +poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT +poker_bit: all diff --git a/keyboard/gh60/Makefile.pjrc b/keyboard/gh60/Makefile.pjrc index f253704faa..af6ef63ec4 100644 --- a/keyboard/gh60/Makefile.pjrc +++ b/keyboard/gh60/Makefile.pjrc @@ -94,3 +94,9 @@ plain: all poker: OPT_DEFS += -DKEYMAP_POKER poker: all + +poker_set: OPT_DEFS += -DKEYMAP_POKER_SET +poker_set: all + +poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT +poker_bit: all diff --git a/keyboard/gh60/README.md b/keyboard/gh60/README.md index 405ab3dffc..4dc4e5ee2e 100644 --- a/keyboard/gh60/README.md +++ b/keyboard/gh60/README.md @@ -47,9 +47,10 @@ See [keymap_plain.h](keymap_plain.h) for detail. `-----------------------------------------------------------' ### 2 Poker keymap -Poker layer emulation without Esc/grave bug :) -See [keymap_poker.h](keymap_poker.h) for detail. +See [keymap_poker.h](keymap_poker.h) for Poker layer emulation, [keymap_poker_bit.h](keymap_poker_bit.h) and [keymap_poker_set.h](keymap_poker_set.h) for better support of Esc and arrow. + + These keymap supports Colemak, Dvorak and Workmans, use `Magic` + {`1`, `2`, `3`} to switch and `Magic` + `0` to return to Qwerty. #### 2.0 Poker Default Layer ,-----------------------------------------------------------. @@ -108,7 +109,7 @@ See [keymap_poker.h](keymap_poker.h) for detail. ### 3. Funky keymap This is my keymap(default) with HHKB, Vi cursor and Mousekey layer. -See [keymap.h](keymap.h) for detail. +See [keymap.c](keymap.c) for detail. #### 3.0 Funky Default Layer ,-----------------------------------------------------------. diff --git a/keyboard/gh60/config.h b/keyboard/gh60/config.h index a760d5dfb3..ef0c9a1735 100644 --- a/keyboard/gh60/config.h +++ b/keyboard/gh60/config.h @@ -41,6 +41,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Set 0 if need no debouncing */ #define DEBOUNCE 5 +/* To use new keymap framework */ +#define USE_KEYMAP_V2 /* key combination for command */ #define IS_COMMAND() ( \ diff --git a/keyboard/gh60/keymap.c b/keyboard/gh60/keymap.c index a17c11fc3b..1f5344d4c6 100644 --- a/keyboard/gh60/keymap.c +++ b/keyboard/gh60/keymap.c @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "keycode.h" #include "action.h" #include "action_macro.h" +#include "layer_switch.h" #include "report.h" #include "host.h" #include "print.h" @@ -64,12 +65,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "keymap_plain.h" #elif defined(KEYMAP_POKER) #include "keymap_poker.h" +#elif defined(KEYMAP_POKER_SET) + #include "keymap_poker_set.h" +#elif defined(KEYMAP_POKER_BIT) + #include "keymap_poker_bit.h" #else static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* * Funky */ - /* Layer 0: Default Layer + /* Keymap 0: Default Layer * ,-----------------------------------------------------------. * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | * |-----------------------------------------------------------| @@ -85,10 +90,32 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KEYMAP_ANSI( ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ - LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, ENT, \ - LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, \ - LCTL,LGUI,LALT, SPC, RALT,FN4, FN4, FN1), - /* Layer 1: HHKB mode + LCTL,A, S, D, F, G, H, J, K, L, FN2, QUOT, ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, RSFT, \ + LCTL,LGUI,LALT, SPC, RALT,FN3, FN3, FN0), + /* Keymap 1: colemak */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \ + BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \ + LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \ + LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0), + /* Keymap 2: dvorak */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \ + TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \ + CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \ + LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \ + LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0), + /* Keymap 3: workman */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \ + BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \ + LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \ + LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0), + + /* Overlay 4: HHKB mode * ,-----------------------------------------------------------. * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | * |-----------------------------------------------------------| @@ -98,16 +125,16 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------| * |Shift | | | | | | +| -|End|PgD|Dow|Shift | * |-----------------------------------------------------------| - * |Ctrl|Gui |Alt | Space |Alt |Gui |App |Fn0 | + * |Ctrl|Gui |Alt | Space |Alt |Gui |App | | * `-----------------------------------------------------------' */ KEYMAP_ANSI( - PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \ - CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, INS, \ - LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, \ - LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN, RSFT, \ - LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0), - /* Layer 2: Vi mode (Slash) + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,INS, \ + LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, \ + LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN, RSFT, \ + LCTL,LGUI,LALT, SPC, RALT,RGUI,FN4, TRNS), + /* Overlay 5: Vi mode (Slash) * ,-----------------------------------------------------------. * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp | * |-----------------------------------------------------------| @@ -115,79 +142,119 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------| * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return | * |-----------------------------------------------------------| - * |Shift | | | | | |Hom|PgD|PgU|End|Fn0|Shift | + * |Shift | | | | | |Hom|PgD|PgU|End| |Shift | * |-----------------------------------------------------------| * |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl| * `-----------------------------------------------------------' */ KEYMAP_ANSI( GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \ - TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, NO, \ - LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \ - LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN0, RSFT, \ + TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, TRNS,TRNS,TRNS,TRNS, \ + LCTL,TRNS,LEFT,DOWN,RGHT,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS, ENT, \ + LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, TRNS, RSFT, \ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL), - /* Layer 3: Mouse mode (Semicolon/App) + /* Overlay 6: Mouse mode (Semicolon/App) * ,-----------------------------------------------------------. * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp | * |-----------------------------------------------------------| * |Tab | | | | | |MwL|MwD|MwU|MwR| | | | | * |-----------------------------------------------------------| - * |Contro| |Ac0|Ac1|Ac1| |McL|McD|McU|McR|Fn0| |Return | + * |Contro| |Ac0|Ac1|Ac1| |McL|McD|McU|McR| | |Return | * |-----------------------------------------------------------| * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | * |-----------------------------------------------------------| - * |Ctrl|Gui |Alt | Space | |Fn0 |Fn0 | | + * |Ctrl|Gui |Alt | Space | | | | | * `-----------------------------------------------------------' * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel */ KEYMAP_ANSI( GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \ - TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, NO, \ - LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN0, NO, ENT, \ - LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, \ - LCTL,LGUI,LALT, BTN1, NO, FN0, FN0, NO ), + TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,TRNS, \ + LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,TRNS, ENT, \ + LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,TRNS, RSFT, \ + LCTL,LGUI,LALT, BTN1, TRNS,TRNS,TRNS,RCTL), + /* Overlay 7: Layout selector + * ,-----------------------------------------------------------. + * | Lq| Lc| Ld| Lw| | | | | | | | | | | + * |-----------------------------------------------------------| + * | |Lq |Lw | | | | | | | | | | | | + * |-----------------------------------------------------------| + * | | | |Ld | | | | | | | | | | + * |-----------------------------------------------------------| + * | | | |Lc | | | | | | | | | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + * Lq: set Qwerty layout + * Lc: set Colemak layout + * Ld: set Dvorak layout + * Lw: set Workman layout + */ + KEYMAP_ANSI( + FN5, FN6, FN7, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,FN5, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), }; +static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {}; + /* * Fn action definition */ static const uint16_t PROGMEM fn_actions[] = { - ACTION_LAYER_DEFAULT, // FN0 - ACTION_LAYER_SET(1), // FN1 - ACTION_LAYER_SET_TAP_KEY(2, KC_SLASH), // FN2 Layer with Slash - ACTION_LAYER_SET_TAP_KEY(3, KC_SCLN), // FN3 Layer with Semicolon - ACTION_LAYER_SET(3), // FN4 + [0] = ACTION_KEYMAP_MOMENTARY(4), + [1] = ACTION_KEYMAP_TAP_KEY(5, KC_SLASH), + [2] = ACTION_KEYMAP_TAP_KEY(6, KC_SCLN), + [3] = ACTION_KEYMAP_MOMENTARY(6), + [4] = ACTION_KEYMAP_MOMENTARY(7), // to Layout selector + [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout + [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout + [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout + [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout }; #endif +#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0])) +#define OVERLAYS_SIZE (sizeof(overlays) / sizeof(overlays[0])) +#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0])) + /* translates key to keycode */ uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) { - return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); + /* Overlay: 16-31(OVERLAY_BIT(0x10) | overlay_layer) */ + if (layer & OVERLAY_BIT) { + layer &= OVERLAY_MASK; + if (layer < OVERLAYS_SIZE) { + return pgm_read_byte(&overlays[(layer)][(key.row)][(key.col)]); + } else { + debug("key_to_keycode: overlay "); debug_dec(layer); debug(" is invalid.\n"); + return KC_TRANSPARENT; + } + } + /* Keymap: 0-15 */ + else { + if (layer < KEYMAPS_SIZE) { + return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); + } else { + // fall back to layer 0 + debug("key_to_keycode: base "); debug_dec(layer); debug(" is invalid.\n"); + return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]); + } + } } -/* translates Fn index to action */ +/* translates Fn keycode to action */ action_t keymap_fn_to_action(uint8_t keycode) { action_t action; - if (FN_INDEX(keycode) < sizeof(fn_actions) / sizeof(fn_actions[0])) { + if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) { action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); } else { action.code = ACTION_NO; } return action; } - -/* convert key to action */ -action_t action_for_key(uint8_t layer, key_t key) -{ - uint8_t keycode = keymap_key_to_keycode(layer, key); - switch (keycode) { - case KC_FN0 ... KC_FN31: - return keymap_fn_to_action(keycode); - default: - return keymap_keycode_to_action(keycode); - } -} diff --git a/keyboard/gh60/keymap_plain.h b/keyboard/gh60/keymap_plain.h index ad0bc2f269..85331715dc 100644 --- a/keyboard/gh60/keymap_plain.h +++ b/keyboard/gh60/keymap_plain.h @@ -1,24 +1,10 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* - * Plain - */ - /* Layer 0: Default Layer - * ,-----------------------------------------------------------. - * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | - * |-----------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - * |-----------------------------------------------------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - * |-----------------------------------------------------------| - * |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl| - * `-----------------------------------------------------------' - */ + /* Keymap 0: qwerty */ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NO, ENT, \ LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, \ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL), }; - +static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {}; +static const uint16_t PROGMEM fn_actions[] = {}; diff --git a/keyboard/gh60/keymap_poker.h b/keyboard/gh60/keymap_poker.h index 186020b3bd..3e0921ad93 100644 --- a/keyboard/gh60/keymap_poker.h +++ b/keyboard/gh60/keymap_poker.h @@ -1,88 +1,104 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* - * Poker Layer - */ - /* Layer x000: Poker Default Layer - * ,-----------------------------------------------------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | - * |-----------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - * |-----------------------------------------------------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - * |-----------------------------------------------------------| - * |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl| - * `-----------------------------------------------------------' - */ + /* Keymap 0: qwerty */ KEYMAP_ANSI( GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ - LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ + CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \ - LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL), - /* Layer x001: Poker with Arrow */ + LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), + /* Keymap 1: colemak */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \ + BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \ + LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \ + LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), + /* Keymap 2: dvorak */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \ + TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \ + CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \ + LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \ + LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), + /* Keymap: workman */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \ + BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \ + LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \ + LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), +}; +static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = { + /* Overlay 0: Poker with Arrow */ KEYMAP_ANSI( TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ - TRNS,TRNS,TRNS, TRNS, FN2, LEFT,DOWN,RGHT), - /* Layer x010: Poker with Esc */ + TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), + /* Overlay 1: Poker with Esc */ KEYMAP_ANSI( ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ - TRNS,TRNS,TRNS, TRNS, FN2, TRNS,TRNS,TRNS), - /* Layer x011: Poker with Arrow and Esc */ - KEYMAP_ANSI( - ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ - TRNS,TRNS,TRNS, TRNS, FN2, LEFT,DOWN,RGHT), - /* - * Poker Momentary Fn Layer + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), + /* Overlay 2: Poker Fn + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | + * |-----------------------------------------------------------| + * | |FnQ| Up| | | | | | |Cal| |Hom|Ins|FnL | + * |-----------------------------------------------------------| + * | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| | + * |-----------------------------------------------------------| + * | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| | + * |-----------------------------------------------------------| + * | | | | FnS | | | | | + * `-----------------------------------------------------------' + * Fn: to Fn overlay + * FnL: to Layout selector overaly + * FnQ: toggle Esc overlay + * FnS: toggle Arrow overlay */ - /* Layer x100: Poker Default + Fn'd */ KEYMAP_ANSI( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ - TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ + TRNS,FN2, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, FN4, \ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ - TRNS,TRNS,TRNS, FN0, FN2, TRNS,TRNS,TRNS), - /* Layer x101: Poker with Arrow + Fn'd */ - KEYMAP_ANSI( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ - TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ - TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ - TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, UP, \ - TRNS,TRNS,TRNS, FN0, FN2, LEFT,DOWN,RGHT), - /* Layer x110: Poker with Esc + Fn'd */ - KEYMAP_ANSI( - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ - TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ - TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ - TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ - TRNS,TRNS,TRNS, FN0, FN2, TRNS,TRNS,TRNS), - /* Layer x111: Poker with Arrow and Esc + Fn'd */ + TRNS,TRNS,TRNS, FN1, TRNS,TRNS,TRNS,TRNS), + /* Overlay 3: Layout selector + * ,-----------------------------------------------------------. + * | Lq| Lc| Ld| Lw| | | | | | | | | | | + * |-----------------------------------------------------------| + * | |Lq |Lw | | | | | | | | | | | | + * |-----------------------------------------------------------| + * | | | |Ld | | | | | | | | | | + * |-----------------------------------------------------------| + * | | | |Lc | | | | | | | | | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + * Lq: set Qwerty layout + * Lc: set Colemak layout + * Ld: set Dvorak layout + * Lw: set Workman layout + */ KEYMAP_ANSI( - GRV, F9, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ - TRNS,FN1, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ - TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ - TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, UP, \ - TRNS,TRNS,TRNS, FN0, FN2, LEFT,DOWN,RGHT), + FN5, FN6, FN7, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,FN5, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), }; - -/* - * Fn action definition - */ static const uint16_t PROGMEM fn_actions[] = { /* Poker Layout */ - [0] = ACTION_LAYER_BIT_TOGGLE(1), // FN0 Poker Arrow toggle(Space) - [1] = ACTION_LAYER_BIT_TOGGLE(2), // FN1 Poker Esc toggle(Q) - [2] = ACTION_LAYER_BIT(4), // FN2 Poker Fn - [3] = ACTION_RMODS_KEY(MOD_BIT(KC_RCTL)|MOD_BIT(KC_RSFT), KC_ESC), // FN3 Task(RControl,RShift+Esc) + [0] = ACTION_OVERLAY_MOMENTARY(2), // to Fn overlay + [1] = ACTION_OVERLAY_TOGGLE(0), // toggle arrow overlay + [2] = ACTION_OVERLAY_TOGGLE(1), // toggle Esc overlay + [3] = ACTION_RMODS_KEY(MOD_BIT(KC_RCTL)|MOD_BIT(KC_RSFT), KC_ESC), // Task(RControl,RShift+Esc) + [4] = ACTION_OVERLAY_MOMENTARY(3), // to Layout selector + [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout + [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout + [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout + [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout }; - diff --git a/keyboard/gh60/keymap_poker_bit.h b/keyboard/gh60/keymap_poker_bit.h new file mode 100644 index 0000000000..982632d05b --- /dev/null +++ b/keyboard/gh60/keymap_poker_bit.h @@ -0,0 +1,50 @@ +// Poker fix with toggle and bit operation +// Fn + Esc = ` +// Fn + {left, down, up, right} = {home, pgdown, pgup, end} +static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap 0: qwerty */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \ + LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), +}; +static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = { + /* Overlay 0: Poker Default + Fn'd */ + KEYMAP_ANSI( + TRNS,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ + CAPS,FN2, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ + TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN4, END, TRNS, \ + TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ + TRNS,TRNS,TRNS, FN1, TRNS,TRNS,TRNS,TRNS), + /* Overlay 1: Poker with Arrow */ + KEYMAP_ANSI( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, PGUP, \ + TRNS,TRNS,TRNS, TRNS, FN3, HOME,PGDN,END), + /* Overlay 2: Poker with Esc */ + KEYMAP_ANSI( + ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), + /* Overlay 3: Poker with Arrow + Fn'd */ + KEYMAP_ANSI( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ + TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), +}; +static const uint16_t PROGMEM fn_actions[] = { + /* Poker Layout */ + [0] = ACTION_OVERLAY_INV4(0b0101, 0), // Poker Fn(with fix for Esc) + [1] = ACTION_OVERLAY_TOGGLE(1), // Poker Arrow toggle + [2] = ACTION_OVERLAY_TOGGLE(2), // Poker Esc toggle + [3] = ACTION_OVERLAY_INV4(0b1101, 0), // Poker Fn(with fix for Arrow) + [4] = ACTION_RMODS_KEY(MOD_BIT(KC_RCTL)|MOD_BIT(KC_RSFT), KC_ESC), // FN3 Task(RControl,RShift+Esc) +}; diff --git a/keyboard/gh60/keymap_poker_set.h b/keyboard/gh60/keymap_poker_set.h new file mode 100644 index 0000000000..eaaf3159db --- /dev/null +++ b/keyboard/gh60/keymap_poker_set.h @@ -0,0 +1,81 @@ +// Poker fix with set(state transition) +// Fn + Esc = ` +// Fn + {left, down, up, right} = {home, pgdown, pgup, end} +static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap 0: qwerty */ + KEYMAP_ANSI( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \ + LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), +}; +static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = { + /* Overlay 0: Poker with Arrow */ + KEYMAP_ANSI( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ + TRNS,TRNS,TRNS, TRNS, FN1, LEFT,DOWN,RGHT), + /* Overlay 1: Poker with Esc */ + KEYMAP_ANSI( + ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS, TRNS, FN2, TRNS,TRNS,TRNS), + /* Overlay 2: Poker with Arrow and Esc */ + KEYMAP_ANSI( + ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ + TRNS,TRNS,TRNS, TRNS, FN3, LEFT,DOWN,RGHT), + /* Overlay 3: Poker Fn'd */ + KEYMAP_ANSI( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ + TRNS,FN6, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ + TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \ + TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ + TRNS,TRNS,TRNS, FN5, FN4, TRNS,TRNS,TRNS), + /* Overlay 4: Poker Fn'd arrow */ + KEYMAP_ANSI( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ + TRNS,FN7, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ + TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \ + TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, PGUP, \ + TRNS,TRNS,TRNS, FN4, FN5, HOME,PGDN,END), + /* Overlay 5: Poker Fn'd Esc */ + KEYMAP_ANSI( + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ + TRNS,FN4, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ + TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \ + TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \ + TRNS,TRNS,TRNS, FN7, FN6, TRNS,TRNS,TRNS), + /* Overlay 6: Poker Fn'd Arrow + Esc */ + KEYMAP_ANSI( + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ + TRNS,FN5, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \ + TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \ + TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, PGUP, \ + TRNS,TRNS,TRNS, FN6, FN7, HOME,PGDN,END), +}; + +/* + * Fn action definition + */ +static const uint16_t PROGMEM fn_actions[] = { + /* Poker Layout */ + [0] = ACTION_OVERLAY_SET(3, ON_PRESS), // FN0 move to Fn'd when press + [1] = ACTION_OVERLAY_SET(4, ON_PRESS), // FN1 move to Fn'd arrow when press + [2] = ACTION_OVERLAY_SET(5, ON_PRESS), // FN2 move to Fn'd Esc when press + [3] = ACTION_OVERLAY_SET(6, ON_PRESS), // FN3 move to Fn'd arrow + Esc when press + + [4] = ACTION_OVERLAY_CLEAR(ON_RELEASE), // FN4 clear overlay when release + [5] = ACTION_OVERLAY_SET(0, ON_RELEASE), // FN5 move to arrow when release + [6] = ACTION_OVERLAY_SET(1, ON_RELEASE), // FN6 move to Esc when release + [7] = ACTION_OVERLAY_SET(2, ON_RELEASE), // FN7 move to arrow + Esc when release + + [8] = ACTION_RMODS_KEY(MOD_BIT(KC_RCTL)|MOD_BIT(KC_RSFT), KC_ESC), // FN8 Task(RControl,RShift+Esc) +}; diff --git a/keyboard/hhkb/config.h b/keyboard/hhkb/config.h index 5fcec95eb2..72e4d26e92 100644 --- a/keyboard/hhkb/config.h +++ b/keyboard/hhkb/config.h @@ -36,6 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_ROWS 8 #define MATRIX_COLS 8 +/* To use new keymap framework */ +#define USE_KEYMAP_V2 /* * Boot magic keys diff --git a/keyboard/hhkb/config_iwrap.h b/keyboard/hhkb/config_iwrap.h index 734d669774..d50b704d72 100644 --- a/keyboard/hhkb/config_iwrap.h +++ b/keyboard/hhkb/config_iwrap.h @@ -31,6 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_ROWS 8 #define MATRIX_COLS 8 +/* To use new keymap framework */ +#define USE_KEYMAP_V2 /* key combination for command */ #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) diff --git a/keyboard/hhkb/keymap.c b/keyboard/hhkb/keymap.c index ef21282ff1..094d33af11 100644 --- a/keyboard/hhkb/keymap.c +++ b/keyboard/hhkb/keymap.c @@ -56,18 +56,18 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------| * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| * |-----------------------------------------------------------| - * |Fn6 | A| S| D| F| G| H| J| K| L|Fn3| '|Return | + * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Fn4 | * |-----------------------------------------------------------| - * |Fn8 | Z| X| C| V| B| N| M| ,| .|Fn2|Fn12 |Fn1| + * |Fn5 | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |Fn1| * `-----------------------------------------------------------' - * |Gui|Alt | Fn5 |Alt |Fn4| + * |Gui|Alt | Fn6 |Alt |Fn7| * `-------------------------------------------' */ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ - FN6, A, S, D, F, G, H, J, K, L, FN3, QUOT,FN7, \ - FN8, Z, X, C, V, B, N, M, COMM,DOT, FN2, FN12,FN9, \ - LGUI,LALT, FN5, FN13,FN4), + LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN4, \ + FN5,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \ + LGUI,LALT, FN6, RALT,FN7), /* Layer 1: HHKB mode (HHKB Fn) * ,-----------------------------------------------------------. @@ -77,15 +77,15 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------| * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | * |-----------------------------------------------------------| - * |Shift | | | | | | +| -|End|PgD|Dow|Shift |Fn0| + * |Shift | | | | | | +| -|End|PgD|Dow|Shift | | * `-----------------------------------------------------------' * |Gui|Alt | Space |Alt |Gui| * `-------------------------------------------' */ - KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \ - LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,FN0, \ + LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \ LGUI,LALT, SPC, RALT,RGUI), /* Layer 2: Vi mode (Slash) @@ -101,10 +101,10 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Gui|Alt | Space |Alt |Gui| * `-------------------------------------------' */ - KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \ - LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN0, RSFT,NO, \ + LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,RSFT,NO, \ LGUI,LALT, SPC, RALT,RGUI), /* Layer 3: Mouse mode (Semicolon) @@ -121,13 +121,13 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------' * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel */ - KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC, \ - LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN0, QUOT,ENT, \ + LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,NO, \ - LGUI,LALT, BTN1, RALT,FN0), + LGUI,LALT, BTN1, RALT,TRNS), - /* Layer 4: Matias half keyboard style (Space) + /* Layer 4: Matias half-qwerty keyboard style (Space) * ,-----------------------------------------------------------. * | -| 0| 9| 8| 7| 6| 5| 4| 3| 2| 1| | | |Esc| * |-----------------------------------------------------------| @@ -144,7 +144,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { BSPC,P, O, I, U, Y, T, R, E, W, Q, NO, NO, TAB, \ LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \ LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT,NO, \ - LGUI,LALT, FN0, RALT,RGUI), + LGUI,LALT, TRNS, RALT,RGUI), /* Layer5: another Mouse mode (Space) * ,-----------------------------------------------------------. @@ -164,7 +164,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC, \ LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,NO, NO, ENT, \ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT,NO, \ - LGUI,LALT, FN0, RALT,RGUI), + LGUI,LALT, TRNS, RALT,RGUI), }; @@ -173,56 +173,72 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { enum function_id { LSHIFT_LPAREN, RSHIFT_RPAREN, - MACRO = 0xff +}; + +enum macro_id { + LSHIFT_PAREN, + RSHIFT_PAREN, + HELLO, }; /* * Fn action definition */ -// TODO: use [1] = KEYMAP(...) to prevent from changing index of element? static const uint16_t PROGMEM fn_actions[] = { - ACTION_LAYER_DEFAULT, // FN0 - ACTION_LAYER_SET(1), // FN1 - ACTION_LAYER_SET_TAP_KEY(2, KC_SLASH), // FN2 Layer with Slash - ACTION_LAYER_SET_TAP_KEY(3, KC_SCLN), // FN3 Layer with Semicolon + [0] = ACTION_DEFAULT_LAYER, // Default layer(not used) +// [1] = ACTION_KEYMAP(1), // HHKB layer + [1] = ACTION_KEYMAP_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps) + [2] = ACTION_KEYMAP_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash* + [3] = ACTION_KEYMAP_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon* + [4] = ACTION_RMOD_TAP_KEY(KC_RCTL, KC_ENT), // RControl with tap Enter* + [5] = ACTION_LMOD_ONESHOT(KC_LSFT), // Oneshot Shift* +// [6] = ACTION_KEYMAP_TAP_KEY(4, KC_SPC), // Half-qwerty layer with Space + [6] = ACTION_KEYMAP_TAP_KEY(5, KC_SPC), // Mousekey layer with Space +// [7] = ACTION_KEYMAP(3), // Mousekey layer + [7] = ACTION_KEYMAP_TOGGLE(3), // Mousekey layer(toggle) - ACTION_LAYER_SET(3), // FN4 -// ACTION_LAYER_SET_TOGGLE(3), // FN4 -// ACTION_FUNCTION(MACRO, 0), // FN4 - ACTION_LAYER_SET_TAP_KEY(5, KC_SPC), // FN5 -// ACTION_LMOD_TAP_KEY(KC_LCTL, KC_BSPC), // FN6 Control with tap Backspace - ACTION_LMOD_TAP_KEY(KC_LCTL, KC_ESC), // FN6 Control with tap Backspace - ACTION_RMOD_TAP_KEY(KC_RCTL, KC_ENT), // FN7 Control with tap Enter - ACTION_LMOD_ONESHOT(KC_LSFT), // FN8 Oneshot Shift - ACTION_LAYER_SET_TAP_TOGGLE(1), // FN9 - ACTION_LAYER_BIT_TAP_KEY(1, KC_GRV), // FN10 Layer with Grave - //ACTION_LAYER_BIT(1), // FN10 - //ACTION_LAYER_BIT_TAP_TOGGLE(1), // FN10 - ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // FN11 Function: LShift with tap '(' - ACTION_FUNCTION_TAP(RSHIFT_RPAREN), // FN12 Function: RShift with tap ')' - ACTION_FUNCTION(MACRO, 1), // FN13 Macro: +// [8] = ACTION_LMOD_TAP_KEY(KC_LCTL, KC_BSPC), // LControl with tap Backspace +// [9] = ACTION_LMOD_TAP_KEY(KC_LCTL, KC_ESC), // LControl with tap Esc +// [11] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // Function: LShift with tap '(' +// [12] = ACTION_FUNCTION_TAP(RSHIFT_RPAREN), // Function: RShift with tap ')' +// [13] = ACTION_MACRO_TAP(LSHIFT_PAREN), // Macro: LShift with tap '(' +// [14] = ACTION_MACRO_TAP(RSHIFT_PAREN), // Macro: RShift with tap ')' +// [15] = ACTION_MACRO(HELLO), // Macro: say hello }; /* * Macro definition */ -#define MACRO(...) ({ static prog_macro_t _m[] PROGMEM = { __VA_ARGS__ }; _m; }) -#define MACRO_NONE 0 -static const prog_macro_t *get_macro(uint8_t id, bool pressed) +const prog_macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + keyevent_t event = record->event; + tap_t tap = record->tap; + switch (id) { - case 0: - return (pressed ? - MACRO( MD(LSHIFT), D(D), END ) : - MACRO( U(D), MU(LSHIFT), END ) ); - case 1: - return (pressed ? - MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ) : + case LSHIFT_PAREN: + if (tap.count > 0 && !tap.interrupted) { + return (event.pressed ? + MACRO( MD(LSHIFT), D(9), U(9), MU(LSHIFT), END ) : MACRO_NONE); + } else { + return (event.pressed ? + MACRO( MD(LSHIFT), END ) : MACRO( MU(LSHIFT), END ) ); + } + case RSHIFT_PAREN: + if (tap.count > 0 && !tap.interrupted) { + return (event.pressed ? + MACRO( MD(RSHIFT), D(0), U(0), MU(RSHIFT), END ) : MACRO_NONE); + } else { + return (event.pressed ? + MACRO( MD(RSHIFT), END ) : MACRO( MU(RSHIFT), END ) ); + } + case HELLO: + return (event.pressed ? + MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) : MACRO_NONE ); } - return 0; + return MACRO_NONE; } @@ -230,82 +246,51 @@ static const prog_macro_t *get_macro(uint8_t id, bool pressed) /* * user defined action function */ -void keymap_call_function(keyrecord_t *record, uint8_t id, uint8_t opt) +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { keyevent_t event = record->event; - uint8_t tap_count = record->tap_count; - - debug("action_call_function: "); - if (event.pressed) debug("pressed"); else debug("released"); - debug(" id: "); debug_hex(id); - debug(" tap_count: "); debug_dec(tap_count); - debug("\n"); + tap_t tap = record->tap; switch (id) { case LSHIFT_LPAREN: // LShft + tap '(' + // NOTE: cant use register_code to avoid conflicting with magic key bind if (event.pressed) { - if (tap_count == 0) { + if (tap.count == 0 || tap.interrupted) { add_mods(MOD_BIT(KC_LSHIFT)); } else { - if (waiting_buffer_has_anykey_pressed()) { - // ad hoc: set 0 to cancel tap - record->tap_count = 0; - add_mods(MOD_BIT(KC_LSHIFT)); - } else { - // NOTE to avoid conflicting command key bind(LShift+RShift) - //register_code(KC_LSHIFT); - //register_code(KC_9); - host_add_mods(MOD_BIT(KC_LSHIFT)); - host_add_key(KC_9); - host_send_keyboard_report(); - } - } - } else { - if (tap_count == 0) { - del_mods(MOD_BIT(KC_LSHIFT)); - } else { - //unregister_code(KC_9); - //unregister_code(KC_LSHIFT); + host_add_mods(MOD_BIT(KC_LSHIFT)); + host_add_key(KC_9); + host_send_keyboard_report(); host_del_mods(MOD_BIT(KC_LSHIFT)); host_del_key(KC_9); host_send_keyboard_report(); } + } else { + if (tap.count == 0 || tap.interrupted) { + del_mods(MOD_BIT(KC_LSHIFT)); + } } break; case RSHIFT_RPAREN: // RShift + tap ')' if (event.pressed) { - if (tap_count == 0) { + if (tap.count == 0 || tap.interrupted) { add_mods(MOD_BIT(KC_RSHIFT)); } else { - if (waiting_buffer_has_anykey_pressed()) { - // ad hoc: set 0 to cancel tap - record->tap_count = 0; - add_mods(MOD_BIT(KC_RSHIFT)); - } else { - //register_code(KC_RSHIFT); - //register_code(KC_0); - host_add_mods(MOD_BIT(KC_RSHIFT)); - host_add_key(KC_0); - host_send_keyboard_report(); - } - } - } else { - if (tap_count == 0) { - del_mods(MOD_BIT(KC_RSHIFT)); - } else { - //unregister_code(KC_0); - //unregister_code(KC_RSHIFT); + host_add_mods(MOD_BIT(KC_RSHIFT)); + host_add_key(KC_0); + host_send_keyboard_report(); host_del_mods(MOD_BIT(KC_RSHIFT)); host_del_key(KC_0); host_send_keyboard_report(); } + } else { + if (tap.count == 0 || tap.interrupted) { + del_mods(MOD_BIT(KC_RSHIFT)); + } } break; - case MACRO: - action_macro_play(get_macro(opt, event.pressed)); - break; } } @@ -328,15 +313,3 @@ action_t keymap_fn_to_action(uint8_t keycode) } return action; } - -/* convert key to action */ -action_t action_for_key(uint8_t layer, key_t key) -{ - uint8_t keycode = keymap_key_to_keycode(layer, key); - switch (keycode) { - case KC_FN0 ... KC_FN31: - return keymap_fn_to_action(keycode); - default: - return keymap_keycode_to_action(keycode); - } -} |