diff options
author | Kenny Hung <kennysubs+github@outlook.com> | 2018-08-02 22:47:06 +0200 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-08-02 22:47:06 +0200 |
commit | 6c20c6219cfcb061235d4bee2b8e0641b0026162 (patch) | |
tree | 83b085e821d2ad8bfe1d0f93a8717e476cf1c5b7 /keyboards | |
parent | f0f1a363d2d0c3277fcddc7b7b30d341fb7c329b (diff) | |
download | qmk_firmware-6c20c6219cfcb061235d4bee2b8e0641b0026162.tar.gz qmk_firmware-6c20c6219cfcb061235d4bee2b8e0641b0026162.tar.xz |
Keymap: Refactor symbols layer with layer tap workaround (#3520)
* Squash layout to fit on Planck
* Replace AST with PAST keycode so that it works with layer tap
* Review markups
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/xd75/keymaps/skewwhiffy/keymap.c | 259 |
1 files changed, 168 insertions, 91 deletions
diff --git a/keyboards/xd75/keymaps/skewwhiffy/keymap.c b/keyboards/xd75/keymaps/skewwhiffy/keymap.c index 9c3e755f6..11fa2f0e6 100644 --- a/keyboards/xd75/keymaps/skewwhiffy/keymap.c +++ b/keyboards/xd75/keymaps/skewwhiffy/keymap.c @@ -20,20 +20,29 @@ // Layer shorthand #define _CM 0 // Colemak -#define _NB 1 // Numbers -#define _SYL 2 // Symbols left -#define _SYR 3 // Symbols right -#define _NAV 4 // Navigation +#define _DV 1 // Dvorak +#define _QW 2 // QWERTY +#define _NB 3 // Numbers +#define _SY 4 // Symbols +#define _NAV 5 // Navigation // Layer buttons #define _Z_SFT SFT_T(UK_Z) +#define _SCLSH SFT_T(UK_SCLN) #define _SLSH SFT_T(UK_SLSH) #define _X_NB LT(_NB, UK_X) +#define _Q_NB LT(_NB, UK_Q) #define _DOT_NB LT(_NB, UK_DOT) -#define _C_SY LT(_SYL, UK_C) -#define _COM_SY LT(_SYR, UK_COMM) +#define _V_NB LT(_NB, UK_V) +#define _C_SY LT(_SY, UK_C) +#define _J_SY LT(_SY, UK_J) +#define _W_SY LT(_SY, UK_W) +#define _COM_SY LT(_SY, UK_COMM) +#define _AST_SY LT(_SY, UK_PAST) #define _B_NAV LT(_NAV, UK_B) +#define _X_NAV LT(_NAV, UK_X) #define _K_NAV LT(_NAV, UK_K) +#define _N_NAV LT(_NAV, UK_N) #define _F1_NB LT(_NB, UK_F1) #define _3_NB LT(_NB, UK_3) @@ -45,98 +54,142 @@ #define _A_LEFT LALT(UK_LEFT) #define _A_RGHT LALT(UK_RGHT) +enum custom_keycodes { + L_NEXT = SAFE_RANGE, + L_SB +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Colemak _CM * .--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | L_NEXT | L_SB | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | Q | W | F | P | G | | | | | | J | L | U | Y | ; | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | A | R | S | T | D | | | | | | H | N | E | I | O | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | Z | X | C | V | B | | | | | | K | M | , | . | / | + * | SHIFT | NUMBER | SYMBOL | | NAV | | | | | | NAV | | SYMBOL | FUNC | SHIFT | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | LSHIFT | LCTRL | LALT | LGUI | SPACE | ENT | | | | DEL | BKSPC | RGUI | RALT | RCTRL | RSHIFT | + * .--------------------------------------------------------------------------------------------------------------------------------------. + */ + [_CM] = { + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, L_NEXT, L_SB }, + { UK_Q, UK_W, UK_F, UK_P, UK_G, _______, _______, _______, _______, _______, UK_J, UK_L, UK_U, UK_Y, UK_SCLN }, + { UK_A, UK_R, UK_S, UK_T, UK_D, _______, _______, _______, _______, _______, UK_H, UK_N, UK_E, UK_I, UK_O }, + { _Z_SFT, _X_NB, _C_SY, UK_V, _B_NAV, _______, _______, _______, _______, _______, _K_NAV, UK_M, _COM_SY, _DOT_NB, _SLSH }, + { UK_LSFT, UK_LCTL, UK_LALT, UK_LGUI, UK_SPC, UK_ENT, _______, _______, _______, UK_DEL, UK_BSPC, UK_RGUI, UK_RALT, UK_RCTL, UK_RSFT } + }, + +/* DVORAK _DV + * .--------------------------------------------------------------------------------------------------------------------------------------. * | | | | | | | | | | | | | | | | * |--------------------------------------------------------------------------------------------------------------------------------------| - * | | Q | W | F | P | G | | | | J | L | U | Y | ; | | + * | ' | , | . | P | Y | | | | | | F | G | C | R | L | * |--------------------------------------------------------------------------------------------------------------------------------------| - * | | A | R | S | T | D | | | | H | N | E | I | O | ENT | + * | A | O | E | U | I | | | | | | D | H | T | N | S | * |--------------------------------------------------------------------------------------------------------------------------------------| - * | | Z | X | C | V | B | | | | K | M | , | . | / | | - * | | SHIFT | NUMBER | SYMBOL | | NAV | | | | NAV | | SYMBOL | FUNC | SHIFT | | + * | ; | Q | J | K | X | | | | | | B | M | W | V | Z | + * | SHIFT | NUMBER | SYMBOL | | NAV | | | | | | NAV | | SYMBOL | FUNC | SHIFT | * |--------------------------------------------------------------------------------------------------------------------------------------| - * | LSHIFT | LCTRL | LALT | LGUI | TERM | SPACE | LCTRL | DEL | LALT | BACKSP | RGUI | RGUI | RALT | RCTRL | RSHIFT | + * | | | | | | | | | | | | | | | | * |--------------------------------------------------------------------------------------------------------------------------------------| */ - [_CM] = { + [_DV] = { + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { UK_QUOT, UK_COMM, UK_DOT, UK_P, UK_Y, _______, _______, _______, _______, _______, UK_F, UK_G, UK_C, UK_R, UK_L }, + { UK_A, UK_O, UK_E, UK_U, UK_I, _______, _______, _______, _______, _______, UK_D, UK_H, UK_T, UK_N, UK_S }, + { _SCLSH, _Q_NB, _J_SY, UK_K, _X_NAV, _______, _______, _______, _______, _______, _B_NAV, UK_M, _W_SY, _V_NB, _Z_SFT }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ } + }, + +/* QWERTY _QW + * .--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | Q | W | E | R | T | | | | | | Y | U | I | O | P | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | A | S | D | F | G | | | | | | H | J | K | L | ; | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | Z | X | C | V | B | | | | | | N | M | , | . | / | + * | SHIFT | NUMBER | SYMBOL | | NAV | | | | | | NAV | | SYMBOL | FUNC | SHIFT | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | + * |--------------------------------------------------------------------------------------------------------------------------------------| + * | LSHIFT | LCTRL | LALT | LGUI | SPACE | ENT | | | | DEL | BKSPC | RGUI | RALT | RCTRL | RSHIFT | + * .--------------------------------------------------------------------------------------------------------------------------------------. + */ + [_QW] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, UK_Q, UK_W, UK_F, UK_P, UK_G, _______, _______, _______, UK_J, UK_L, UK_U, UK_Y, UK_SCLN, _______ }, - { _______, UK_A, UK_R, UK_S, UK_T, UK_D, _______, _______, _______, UK_H, UK_N, UK_E, UK_I, UK_O, UK_ENT }, - { _______, _Z_SFT, _X_NB, _C_SY, UK_V, _B_NAV, _______, _______, _______, _K_NAV, UK_M, _COM_SY, _DOT_NB, _SLSH, _______ }, - { UK_LSFT, UK_LCTL, UK_LALT, UK_LGUI, _TERM, UK_SPC, UK_LCTL, UK_DEL , UK_LALT, UK_BSPC, UK_RGUI, UK_RGUI, UK_RALT, UK_RCTL, UK_RSFT }, + { UK_Q, UK_W, UK_E, UK_R, UK_T, _______, _______, _______, _______, _______, UK_Y, UK_U, UK_I, UK_O, UK_P }, + { UK_A, UK_S, UK_D, UK_F, UK_G, _______, _______, _______, _______, _______, UK_H, UK_J, UK_K, UK_L, UK_SCLN }, + { _Z_SFT, _X_NB, _C_SY, UK_V, _B_NAV, _______, _______, _______, _______, _______, _N_NAV, UK_M, _COM_SY, _DOT_NB, _SLSH }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ } }, /* Numbers _NB * .--------------------------------------------------------------------------------------------------------------------------------------. * | | | | | | | | | | | | | | | | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| - * | | | F7 | F8 | F9 | F10 | | | | | 7 | 8 | 9 | | | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | | F4 | F5 | F6 | F11 | | | | | 4 | 5 | 6 | | | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------------------------+--------| - * | | | F1 | F2 | F3 | F12 | | | | | 1 | 2 | 3 | | | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------+--------| - * | | | | | | | | | | | 0 | 0 | . | | | + * |-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | | F7 | F8 | F9 | F10 | | | | | | | 7 | 8 | 9 | | + * |-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | F4 | F5 | F6 | F11 | | | | | | | 4 | 5 | 6 | | + * |-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------------------------+--------| + * | | F1 | F2 | F3 | F12 | | | | | | 0 | 1 | 2 | 3 | . | + * |-----------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------+--------| + * | | | | | | | | | | | | | | | | * '--------------------------------------------------------------------------------------------------------------------------------------' */ [_NB] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, _______, UK_F7, UK_F8, UK_F9, UK_F10, _______, _______, _______, _______, UK_7, UK_8, UK_9, _______, _______ }, - { _______, _______, UK_F4, UK_F5, UK_F6, UK_F11, _______, _______, _______, _______, UK_4, UK_5, UK_6, _______, _______ }, - { _______, _______, _F1_NB, UK_F2, UK_F3, UK_F12, _______, _______, _______, _______, UK_1, UK_2, _3_NB, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, UK_0, UK_0, UK_DOT, _______, _______ }, + { _______, UK_F7, UK_F8, UK_F9, UK_F10, _______, _______, _______, _______, _______, _______, UK_7, UK_8, UK_9, _______ }, + { _______, UK_F4, UK_F5, UK_F6, UK_F11, _______, _______, _______, _______, _______, _______, UK_4, UK_5, UK_6, _______ }, + { _______, _F1_NB, UK_F2, UK_F3, UK_F12, _______, _______, _______, _______, _______, UK_0, UK_1, UK_2, _3_NB, UK_DOT }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ } }, -/* Symbols _SYL and _SYR - For some reason, combining this into the same layer causes problems. +/* Symbols _SY * .--------------------------------------------------------------------------------------------------------------------------------------. * | | | | | | | | | | | | | | | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | ! | £ | _ | - | ~ | | | | \ | { | } | / | # | | + * | ! | £ | _ | - | ~ | | | | | | \ | { | } | / | # | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | $ | % | + | = | | | | | " | ( | ) | ' | @ | | + * | $ | % | + | = | | | | | | | " | ( | ) | ' | @ | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | ^ | & | * | | | | | | | < | [ | ] | > | ` | | + * | ^ | & | * | | | | | | | | | < | [ | ] | > | ` | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | | | | | | | | | | | | | | | | * '--------------------------------------------------------------------------------------------------------------------------------------' */ - [_SYL] = { - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, UK_EXLM, UK_PND, UK_UNDS, UK_MINS, UK_TILD, _______, _______, _______, UK_BSLS, UK_LCBR, UK_RCBR, UK_SLSH, UK_HASH, _______ }, - { _______, UK_DLR, UK_PERC, UK_PLUS, UK_EQL, _______, _______, _______, _______, UK_DQUO, UK_LPRN, UK_RPRN, UK_QUOT, UK_AT, _______ }, - { _______, UK_CIRC, UK_AMPR, _C_SY, UK_PIPE, _______, _______, _______, _______, UK_LABK, UK_LBRC, UK_RBRC, UK_RABK, UK_GRV, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - }, - [_SYR] = { - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, UK_EXLM, UK_PND, UK_UNDS, UK_MINS, UK_TILD, _______, _______, _______, UK_BSLS, UK_LCBR, UK_RCBR, UK_SLSH, UK_HASH, _______ }, - { _______, UK_DLR, UK_PERC, UK_PLUS, UK_EQL, _______, _______, _______, _______, UK_DQUO, UK_LPRN, UK_RPRN, UK_QUOT, UK_AT, _______ }, - { _______, UK_CIRC, UK_AMPR, UK_ASTR, UK_PIPE, _______, _______, _______, _______, UK_LABK, UK_LBRC, _COM_SY, UK_RABK, UK_GRV, _______ }, + [_SY] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { UK_EXLM, UK_PND, UK_UNDS, UK_MINS, UK_TILD, _______, _______, _______, _______, _______, UK_BSLS, UK_LCBR, UK_RCBR, UK_SLSH, UK_HASH }, + { UK_DLR, UK_PERC, UK_PLUS, UK_EQL, _______, _______, _______, _______, _______, _______, UK_DQUO, UK_LPRN, UK_RPRN, UK_QUOT, UK_AT }, + { UK_CIRC, UK_AMPR, _AST_SY, UK_PIPE, _______, _______, _______, _______, _______, _______, UK_LABK, UK_LBRC, _COM_SY, UK_RABK, UK_GRV }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ } }, /* * Navigation * .--------------------------------------------------------------------------------------------------------------------------------------. - * | | | | | | | | | | | | | | | | + * | RESET | COLEMA | DVORAK | QWERTY | | | | | | | | | | | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | Esc | Ctrl L | Up | Ctrl R | | | | | | PtSn | ScLk | Pause | | | + * | Esc | Ctrl L | Up | Ctrl R | | RGB HD | RGB HI | | | | | PtSn | ScLk | Pause | | + * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | Tab | Left | Down | Right | | RGB SD | RGB SI | | | | | Insert | Home | PgUp | Term | + * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | ShTab | Alt L | Shift | Alt R | | RGB VD | RGB VI | | | | | ScLk | End | PgDn | | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | Tab | Left | Down | Right | | | | | | Insert | Home | PgUp | | | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | ShTab | Alt L | Shift | Alt R | | | | | | ScLk | End | PgDn | | | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | | | | | | | | | | | | | | | RESET | + * | | | | | | RGB RMD| RGB MD | | | | | | | | | * '--------------------------------------------------------------------------------------------------------------------------------------' */ [_NAV] = { - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, UK_ESC, _C_LEFT, UK_UP , _C_RGHT, _______, _______, _______, _______, _______, UK_PSCR, UK_SLCK, UK_PAUS, _______, _______ }, - { _______, UK_TAB, UK_LEFT, UK_DOWN, UK_RGHT, _______, _______, _______, _______, _______, UK_INS, UK_HOME, UK_PGUP, _______, _______ }, - { _______, _S_TAB, _A_LEFT, UK_LSFT, _A_RGHT, _B_NAV, _______, _______, _______, _K_NAV, UK_SLCK, UK_END, UK_PGDN, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET }, + { RESET, DF(_CM), DF(_DV), DF(_QW), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { UK_ESC, _C_LEFT, UK_UP , _C_RGHT, _______, RGB_HUD, RGB_HUI, _______, _______, _______, _______, UK_PSCR, UK_SLCK, UK_PAUS, _______ }, + { UK_TAB, UK_LEFT, UK_DOWN, UK_RGHT, _______, RGB_SAD, RGB_SAI, _______, _______, _______, _______, UK_INS, UK_HOME, UK_PGUP, _TERM }, + { _S_TAB, _A_LEFT, UK_LSFT, _A_RGHT, _B_NAV, RGB_VAD, RGB_VAI, _______, _______, _______, _K_NAV, UK_SLCK, UK_END, UK_PGDN, _______ }, + { _______, _______, _______, _______, _______, RGB_RMOD,RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______ } }, }; @@ -162,50 +215,74 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; }; -bool CTRLDOWN = false; -bool ALTDOWN = false; -bool WINDOWN = false; -bool SHIFTDOWN = false; -bool TERMINALOPEN = false; +bool lightsOn = true; +int keyPresses = 0; +int effect = 0; +uint32_t key_timer; + +void resetCounts(void) { + effect++; + keyPresses = 0; + key_timer = timer_read32(); +} void matrix_scan_user(void) { - if (TERMINALOPEN) { - rgblight_effect_rainbow_swirl(128); - } else if (SHIFTDOWN) { - rgblight_effect_breathing(3); - } else if (CTRLDOWN) { - rgblight_effect_knight(3); - } else if (WINDOWN) { - rgblight_effect_snake(3); - } else { + if (!lightsOn) { rgblight_setrgb(0, 0, 0); + return; } -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case UK_LGUI: - case UK_RGUI: - WINDOWN = record->event.pressed; - TERMINALOPEN = false; + if (timer_elapsed32(key_timer) > 60000) { + resetCounts(); + } + switch (effect) { + case 0: + rgblight_effect_breathing(3); break; - case UK_LCTL: - case UK_RCTL: - CTRLDOWN = record->event.pressed; + case 1: + rgblight_effect_knight(3); break; - case UK_LSFT: - case UK_RSFT: - SHIFTDOWN = record->event.pressed; + case 2: + rgblight_effect_rainbow_swirl(128); break; - case UK_LALT: - case UK_RALT: - ALTDOWN = record-> event.pressed; + case 3: + rgblight_effect_snake(30); break; - case _TERM: - if (record->event.pressed) { - TERMINALOPEN = !TERMINALOPEN; - } + case 4: + rgblight_effect_rainbow_swirl(128); + break; + case 5: + rgblight_effect_rainbow_mood(128); + break; + case 6: + rgblight_effect_christmas(); + break; + case 7: + rgblight_effect_rgbtest(); + break; + default: + effect = 0; break; } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!record->event.pressed) return true; + if (keycode == L_SB) { + lightsOn = !lightsOn; + if (!lightsOn) { + keyPresses = 0; + } else { + resetCounts(); + } + return true; + } + if (keycode == L_NEXT) { + resetCounts(); + return true; + } + keyPresses++; + if (keyPresses > 100) { + resetCounts(); + } return true; } |