From 614b3a0f7ca266f9d625814a3bbd1c2de34f2f0f Mon Sep 17 00:00:00 2001 From: zer09 Date: Mon, 10 Dec 2018 00:28:46 +0800 Subject: Keymap: Keymap update (#4579) * Add YREG keycode * Add GM layer * Set tapping term to 105 * update tapping term --- keyboards/lets_split/keymaps/zer09/keymap.c | 24 ++++++++++++++++++++++-- users/zer09/config.h | 4 ++-- users/zer09/tap_dance.c | 27 ++++++++++++++++++++++++--- users/zer09/zer09.h | 10 +++++++++- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/keyboards/lets_split/keymaps/zer09/keymap.c b/keyboards/lets_split/keymaps/zer09/keymap.c index 8d0eaf141..cb6744433 100644 --- a/keyboards/lets_split/keymaps/zer09/keymap.c +++ b/keyboards/lets_split/keymaps/zer09/keymap.c @@ -9,8 +9,15 @@ extern keymap_config_t keymap_config; TD(DA_UPLY), MO(_VL), KC_TAB, KC_BSPACE, KC_ESC, /**/KC_INS, KC_HOME, KC_PGUP, MO(_VL), TD(DA_UPLY), \ TD(DA_DWLY), TD(DA_LCTL), KC_SPC, TD(DA_LSPR), LSFT_T(KC_CAPS),/**/SFT_T(KC_CAPS), TD(DA_RALT), KC_ENT, TD(DA_RCTL), TD(DA_DWLY)) +#define _GMLayer LAYOUT( \ + KC_QUOTE, KC_COMMA, KC_DOT, KC_P, KC_Y, /**/KC_F, KC_G, KC_C, KC_R, KC_L, \ + KC_A, KC_O, KC_E, KC_U, KC_I, /**/KC_D, KC_H, ALT_T(KC_T), SFT_T(KC_N), CTL_T(KC_S), \ + KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, /**/KC_B, KC_M, KC_W, KC_V, KC_Z, \ + TD(DA_UPLY), MO(_VL), KC_TAB, KC_BSPACE, KC_ESC, /**/KC_INS, KC_HOME, KC_PGUP, MO(_VL), TD(DA_UPLY), \ + TD(DA_DWLY), TD(DA_LCTL), KC_SPC, TD(DA_LSPR), LSFT_T(KC_CAPS),/**/SFT_T(KC_CAPS), TD(DA_RALT), KC_ENT, TD(DA_RCTL), TD(DA_DWLY)) + #define _upLayer LAYOUT( \ - KC_4, KC_5, KC_6, _______, _______,/**/ _______, KC_RBRC, _______, _______, _______, \ + KC_4, KC_5, KC_6, KC_YREG, _______,/**/ _______, KC_RBRC, _______, _______, _______, \ LCTL_T(KC_1), LSFT_T(KC_2), LALT_T(KC_3), _______, _______,/**/ KC_LBRC, KC_BSLS, _______, _______, _______, \ KC_7, KC_8, KC_9, KC_0, KC_GRV, /**/ KC_SLSH, _______, _______, _______, _______, \ _______, _______, _______, _______, _______,/**/ KC_DEL, KC_END, KC_PGDN, _______, _______, \ @@ -35,4 +42,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_UL] = _upLayer, [_DL] = _downLayer, [_VL] = _upLayer, - [_AL] = _astdLayer}; + [_AL] = _astdLayer, + [_GM] = _GMLayer}; + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case YREG: + SEND_STRING("\"0p"); + return false; + } + } + + return true; +} diff --git a/users/zer09/config.h b/users/zer09/config.h index 4cb65c258..c5ab32f8d 100644 --- a/users/zer09/config.h +++ b/users/zer09/config.h @@ -16,13 +16,13 @@ #define FORCE_NKRO #ifndef TAPPING_TOGGLE -#define TAPPING_TOGGLE 1 +#define TAPPING_TOGGLE 1 #endif #ifdef TAPPING_TERM #undef TAPPING_TERM #endif -#define TAPPING_TERM 120 +#define TAPPING_TERM 95 // Disable action_get_macro and fn_actions, since we don't use these // and it saves on space in the firmware. diff --git a/users/zer09/tap_dance.c b/users/zer09/tap_dance.c index a23705ad8..e99b26cca 100644 --- a/users/zer09/tap_dance.c +++ b/users/zer09/tap_dance.c @@ -17,15 +17,27 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; volatile uint8_t active_layer = _BL; +volatile uint8_t gm_layer_act = false; static tap upltap_state = {.state = 0}; static tap dwltap_state = {.state = 0}; static tap lsprtap_state = {.state = 0}; static tap ralttap_state = {.state = 0}; void layer_switcher_tap(uint8_t new_layer) { - layer_off(active_layer); - layer_on(new_layer); - active_layer = new_layer; + if (gm_layer_act == true) { + layer_off(active_layer); + if (new_layer == _BL) { + layer_on(_GM); + active_layer = _GM; + } else { + layer_on(new_layer); + active_layer = new_layer; + } + } else { + layer_off(active_layer); + layer_on(new_layer); + active_layer = new_layer; + } } int cur_dance(qk_tap_dance_state_t *state) { @@ -162,6 +174,14 @@ void dance_dwly_finished(qk_tap_dance_state_t *state, void *user_data) { case DOUBLE_HOLD: layer_switcher_tap(_AL); break; + case TRIPLE_TAP: + if (gm_layer_act == true) { + gm_layer_act = false; + layer_switcher_tap(_BL); + } else { + gm_layer_act = true; + layer_switcher_tap(_GM); + } default: layer_switcher_tap(_BL); break; @@ -174,6 +194,7 @@ void dance_dwly_reset(qk_tap_dance_state_t *state, void *user_data) { break; case SINGLE_HOLD: case DOUBLE_HOLD: + case TRIPLE_TAP: default: layer_switcher_tap(_BL); break; diff --git a/users/zer09/zer09.h b/users/zer09/zer09.h index 75c1d3cad..acac8ab09 100644 --- a/users/zer09/zer09.h +++ b/users/zer09/zer09.h @@ -3,16 +3,24 @@ #include "quantum.h" -enum custom_keycodes { CK_SAFE = SAFE_RANGE, RGUP, RGDWN, NEWPLACEHOLDER }; +enum custom_keycodes { + CK_SAFE = SAFE_RANGE, + RGUP, + RGDWN, + YREG, + NEW_SAFE_RANGE +}; #define _______ KC_TRNS #define KC_RGUP RGUP #define KC_RGDWN RGDWN +#define KC_YREG YREG #define _BL 0 // The base layer #define _UL 1 // The up layer #define _DL 2 // The down layer #define _VL 3 // The shifted up layer #define _AL 4 // The assorted layer +#define _GM 5 #endif -- cgit v1.2.3-70-g09d2