diff options
author | wanleg <32079073+wanleg@users.noreply.github.com> | 2018-10-19 11:01:40 -0700 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-10-19 11:01:40 -0700 |
commit | 6f6d28fa8d81063691d2fd11540675eaa5b6989c (patch) | |
tree | 6a80736f959e9b4029bc180304b790c06d391e12 /users | |
parent | 9ca73a9edcb8cfaeba13baae16b8c8cc5c9fafe6 (diff) |
Big Switch and 5x5 edits (#4168)
* 4x4 - pro micro version
* pro-micro setup on 4x4
* tap dance LCTL/RESET key
* remove test file
* more research
* revert a couple un-intended edits
* opt_defs version of adding custom rules.mk variables
* cleanup
* cleanup
* cleanup
* cleanup
* layout edits
* layout edits
* keymap edit
* numpad layout change
* got tap dance layer-switch working
* keymap changes
* temporary revert
* restore previous settings
* misc fixes
* layer order change
* fix layout matrix
* Update tapdances.c
* playing around with triple tap dance
* sync with upstream
* quick edit
* tapdance cleanup
* mod tap interrupt
* tapping term edit
* tapping term adjust
* 5x5 board edits
* set gherkin tapping term
* big switch tap dance edit
* tapping term refinements
* 5x10 layout setup
* add audio for bigswitch
* keymap change
* keymap change & created testing board
* sound setup for big_switch
* more big switch size testing
* bigswitch testing finished
* final touch-ups
Diffstat (limited to 'users')
-rw-r--r-- | users/wanleg/config.h | 18 | ||||
-rw-r--r-- | users/wanleg/rules.mk | 4 | ||||
-rw-r--r-- | users/wanleg/tapdances.c | 246 | ||||
-rw-r--r-- | users/wanleg/wanleg.c | 6 | ||||
-rw-r--r-- | users/wanleg/wanleg.h | 39 |
5 files changed, 196 insertions, 117 deletions
diff --git a/users/wanleg/config.h b/users/wanleg/config.h index 28e7690e65..f2e785659f 100644 --- a/users/wanleg/config.h +++ b/users/wanleg/config.h @@ -2,8 +2,17 @@ #define USERSPACE_CONFIG_H //TAPPING_TERM -#ifdef TAP_DANCE_ENABLE -#define TAPPING_TERM 200 +//tapping term short (<100): on multi-purpose keys, slow taps may not register, but "holds" register easier. multi-tap keys may be difficult to activate. +//tapping term long (>200): holds don't register as easily - noticeable when typing quickly (e.g. shift doesn't want to engage.) +#if defined(TAP_DANCE_ENABLE) && defined(KEYBOARD_lets_split_rev2) +//Kailh Coppers activate quickly and don't need a long tapping term +#define TAPPING_TERM 100 + +#elif defined(TAP_DANCE_ENABLE) && defined(KEYBOARD_bigswitch) +#define TAPPING_TERM 700 + +#else +#define TAPPING_TERM 145 #endif //Mousekey Settings @@ -27,4 +36,9 @@ #define NO_ACTION_FUNCTION #define NO_ACTION_ONESHOT +// Disable mod tap interrrupt +#ifndef IGNORE_MOD_TAP_INTERRUPT +#define IGNORE_MOD_TAP_INTERRUPT +#endif // !mod tap interrrupt + #endif // !USERSPACE_CONFIG_H diff --git a/users/wanleg/rules.mk b/users/wanleg/rules.mk index 5630401315..2a2a65cfea 100644 --- a/users/wanleg/rules.mk +++ b/users/wanleg/rules.mk @@ -9,8 +9,8 @@ ifeq ($(strip $(dfu)), qmk) BOOTLOADER = qmk-dfu endif -#use alternate settings for 4x4 board using ProMicro instead of Micro -#usage: make 4x4:wanleg PM=yes +#use alternate settings for boards using ProMicro instead of Micro +#example usage: make 4x4:wanleg PM=yes ifeq ($(strip $(PM)), yes) OPT_DEFS += -DPRO_MICRO endif diff --git a/users/wanleg/tapdances.c b/users/wanleg/tapdances.c index 0778bf5f7e..3878e6d31c 100644 --- a/users/wanleg/tapdances.c +++ b/users/wanleg/tapdances.c @@ -1,6 +1,12 @@ //Tap Dance Settings #include "wanleg.h" +//audio settings for one of the tap dances below +#ifdef AUDIO_ENABLE + float lyrup_song[][2] = SONG(MUSIC_ON_SOUND); + float lyrdown_song[][2] = SONG(MUSIC_OFF_SOUND); +#endif + ///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION START ///// ///// (no need to edit this section) ///// //Enums used to clearly convey the state of the tap dance @@ -9,7 +15,10 @@ enum { SINGLE_HOLD = 2, DOUBLE_TAP = 3, DOUBLE_HOLD = 4, - DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP + DOUBLE_SINGLE_TAP = 5, //send SINGLE_TAP twice - NOT DOUBLE_TAP + TRIPLE_TAP = 6, + TRIPLE_HOLD = 7, + TRIPLE_SINGLE_TAP = 8 // Add more enums here if you want for triple, quadruple, etc. }; @@ -32,69 +41,18 @@ int cur_dance (qk_tap_dance_state_t *state) { else if (state->pressed) return DOUBLE_HOLD; else return DOUBLE_TAP; } - else return 6; //magic number. At some point this method will expand to work for more presses -} -///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION END ///// -///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION START ///// -//instantiate 'tap' for the 'ENT' tap dance. -static tap ENTtap_state = { - .is_press_action = true, - .state = 0 -}; - -void ENT_finished (qk_tap_dance_state_t *state, void *user_data) { - ENTtap_state.state = cur_dance(state); - switch (ENTtap_state.state) { - case SINGLE_TAP: register_code(KC_SPC); break; - case SINGLE_HOLD: register_code(KC_LSFT); break; - case DOUBLE_TAP: register_code(KC_ENT); break; - case DOUBLE_HOLD: register_code(KC_NO); break; // setting double hold to do nothing (change this if you want) - case DOUBLE_SINGLE_TAP: register_code(KC_SPC); unregister_code(KC_SPC); register_code(KC_SPC); - //Last case is for fast typing. Assuming your key is `f`: - //For example, when typing the word `buffer`, and you want to make sure that you send `ff` and not `Esc`. - //In order to type `ff` when typing fast, the next character will have to be hit within the `TAPPING_TERM`, which by default is 200ms. - } -} - -void ENT_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (ENTtap_state.state) { - case SINGLE_TAP: unregister_code(KC_SPC); break; - case SINGLE_HOLD: unregister_code(KC_LSFT); break; - case DOUBLE_TAP: unregister_code(KC_ENT); break; - case DOUBLE_HOLD: unregister_code(KC_NO); - case DOUBLE_SINGLE_TAP: unregister_code(KC_SPC); - } - ENTtap_state.state = 0; -} - -//instantiate 'tap' for the 'DEL' tap dance. -static tap DELtap_state = { - .is_press_action = true, - .state = 0 -}; - -void DEL_finished (qk_tap_dance_state_t *state, void *user_data) { - DELtap_state.state = cur_dance(state); - switch (DELtap_state.state) { - case SINGLE_TAP: register_code(KC_BSPC); break; - case SINGLE_HOLD: register_code(KC_LCTL); break; - case DOUBLE_TAP: register_code(KC_DEL); break; - case DOUBLE_HOLD: register_code(KC_NO); break; - case DOUBLE_SINGLE_TAP: register_code(KC_BSPC); unregister_code(KC_BSPC); register_code(KC_BSPC); - } -} -void DEL_reset (qk_tap_dance_state_t *state, void *user_data) { - switch (DELtap_state.state) { - case SINGLE_TAP: unregister_code(KC_BSPC); break; - case SINGLE_HOLD: unregister_code(KC_LCTL); break; - case DOUBLE_TAP: unregister_code(KC_DEL); break; - case DOUBLE_HOLD: unregister_code(KC_NO); - case DOUBLE_SINGLE_TAP: unregister_code(KC_BSPC); + //If count = 3, and it has been interrupted - assume that user is trying to type the letter associated + //with double tap. + else if (state->count == 3) { + if (state->interrupted) return TRIPLE_SINGLE_TAP; + else if (state->pressed) return TRIPLE_HOLD; + else return TRIPLE_TAP; } - DELtap_state.state = 0; + else return 9; //magic number. At some point this method will expand to work for more presses } - +///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION END ///// +///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION START ///// //instantiate 'tap' for the 'CAD' tap dance. static tap CADtap_state = { .is_press_action = true, @@ -104,14 +62,14 @@ static tap CADtap_state = { void CAD_finished (qk_tap_dance_state_t *state, void *user_data) { CADtap_state.state = cur_dance(state); switch (CADtap_state.state) { - case SINGLE_TAP: - //register_code(KC_SPC); + case SINGLE_TAP: + //register_code(KC_SPC); SEND_STRING(SS_LGUI("l")); #ifdef BACKLIGHT_ENABLE - backlight_set(3); + backlight_level(3); #endif break; - case SINGLE_HOLD: + case SINGLE_HOLD: //register_code(KC_NO); //take a screenshot of a single window, open Paint and paste SEND_STRING(SS_LALT(SS_TAP(X_PSCREEN)) SS_LGUI("r")); @@ -120,47 +78,37 @@ void CAD_finished (qk_tap_dance_state_t *state, void *user_data) { _delay_ms(700); SEND_STRING(SS_LCTRL("v")); break; //register this keycode when button is held - case DOUBLE_TAP: - //register_code(KC_ENT); + case DOUBLE_TAP: + //register_code(KC_ENT); SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_DELETE)))); #ifdef BACKLIGHT_ENABLE - backlight_set(0); + backlight_level(0); #endif break; //case DOUBLE_HOLD: register_code(KC_NO); break; //register this keycode when button is tapped and then held - case DOUBLE_HOLD: - reset_keyboard(); + case DOUBLE_HOLD: + reset_keyboard(); break; //register this keycode when button is tapped and then held - case DOUBLE_SINGLE_TAP: register_code(KC_NO); unregister_code(KC_NO); register_code(KC_NO); + case TRIPLE_TAP: + SEND_STRING("wanleg@github.com"); + break; + case TRIPLE_HOLD: + set_single_persistent_default_layer(1); + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(lyrup_song); + #endif + break; } } void CAD_reset (qk_tap_dance_state_t *state, void *user_data) { switch (CADtap_state.state) { - case SINGLE_TAP: - //unregister_code(KC_SPC); - SEND_STRING(SS_LGUI("l")); - #ifdef BACKLIGHT_ENABLE - backlight_set(3); - #endif - break; - case SINGLE_HOLD: - register_code(KC_NO); //(un)register this keycode when button is held and then released - //SEND_STRING(SS_LCTRL("v")); - break; - case DOUBLE_TAP: - //register_code(KC_ENT); - SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_DELETE)))); - #ifdef BACKLIGHT_ENABLE - backlight_set(0); - #endif - break; - case DOUBLE_HOLD: register_code(KC_NO); //(un)register this keycode when button is tapped and then held, and then released - case DOUBLE_SINGLE_TAP: unregister_code(KC_NO); +//nothing to do } CADtap_state.state = 0; -} - +} + //instantiate 'tap' for the 'RST' tap dance. static tap RSTtap_state = { .is_press_action = true, @@ -173,21 +121,18 @@ void RST_finished (qk_tap_dance_state_t *state, void *user_data) { case SINGLE_TAP: register_code(KC_LCTL); break; case SINGLE_HOLD: register_code(KC_LCTL); break; case DOUBLE_TAP: reset_keyboard(); break; - case DOUBLE_HOLD: register_code(KC_NO); break; - case DOUBLE_SINGLE_TAP: register_code(KC_LCTL); unregister_code(KC_LCTL); register_code(KC_LCTL); + case DOUBLE_SINGLE_TAP: register_code(KC_LCTL); unregister_code(KC_LCTL); register_code(KC_LCTL); break; } -} +} void RST_reset (qk_tap_dance_state_t *state, void *user_data) { switch (RSTtap_state.state) { case SINGLE_TAP: unregister_code(KC_LCTL); break; case SINGLE_HOLD: unregister_code(KC_LCTL); break; - case DOUBLE_TAP: unregister_code(KC_NO); break; - case DOUBLE_HOLD: unregister_code(KC_NO); - case DOUBLE_SINGLE_TAP: unregister_code(KC_LCTL); + case DOUBLE_SINGLE_TAP: unregister_code(KC_LCTL); break; } RSTtap_state.state = 0; -} +} //instantiate 'tap' for the 'LYR' tap dance. static tap LYRtap_state = { @@ -199,23 +144,106 @@ void LYR_finished (qk_tap_dance_state_t *state, void *user_data) { LYRtap_state.state = cur_dance(state); switch (LYRtap_state.state) { case SINGLE_TAP: register_code(KC_PSLS); break; - case SINGLE_HOLD: register_code(KC_NO); break; case DOUBLE_TAP: set_single_persistent_default_layer(_GK); break; - case DOUBLE_HOLD: register_code(KC_NO); break; case DOUBLE_SINGLE_TAP: register_code(KC_PSLS); unregister_code(KC_PSLS); register_code(KC_PSLS); } -} +} void LYR_reset (qk_tap_dance_state_t *state, void *user_data) { switch (LYRtap_state.state) { case SINGLE_TAP: unregister_code(KC_PSLS); break; - case SINGLE_HOLD: unregister_code(KC_NO); break; case DOUBLE_TAP: set_single_persistent_default_layer(_GK); break; - case DOUBLE_HOLD: unregister_code(KC_NO); case DOUBLE_SINGLE_TAP: unregister_code(KC_PSLS); } LYRtap_state.state = 0; -} +} + +//instantiate 'tap' for the 'LYR75' tap dance. +static tap LYR75tap_state = { + .is_press_action = true, + .state = 0 +}; + +void LYR75_finished (qk_tap_dance_state_t *state, void *user_data) { + LYR75tap_state.state = cur_dance(state); + switch (LYR75tap_state.state) { + case SINGLE_TAP: register_code(KC_PSLS); break; + case DOUBLE_TAP: set_single_persistent_default_layer(GK75); break; + case DOUBLE_SINGLE_TAP: register_code(KC_PSLS); unregister_code(KC_PSLS); register_code(KC_PSLS); + } +} + +void LYR75_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (LYR75tap_state.state) { + case SINGLE_TAP: unregister_code(KC_PSLS); break; + case DOUBLE_TAP: set_single_persistent_default_layer(GK75); break; + case DOUBLE_SINGLE_TAP: unregister_code(KC_PSLS); + } + LYR75tap_state.state = 0; +} + +//instantiate 'tap' for the 'LYR50' tap dance. +static tap LYR50tap_state = { + .is_press_action = true, + .state = 0 +}; + +void LYR50_finished (qk_tap_dance_state_t *state, void *user_data) { + LYR50tap_state.state = cur_dance(state); + switch (LYR75tap_state.state) { + case SINGLE_TAP: register_code(KC_PSLS); break; + case DOUBLE_TAP: set_single_persistent_default_layer(GK50); break; + case DOUBLE_SINGLE_TAP: register_code(KC_PSLS); unregister_code(KC_PSLS); register_code(KC_PSLS); + } +} + +void LYR50_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (LYR50tap_state.state) { + case SINGLE_TAP: unregister_code(KC_PSLS); break; + case DOUBLE_TAP: set_single_persistent_default_layer(GK50); break; + case DOUBLE_SINGLE_TAP: unregister_code(KC_PSLS); + } + LYR50tap_state.state = 0; +} + +//instantiate 'tap' for the 'BSW' tap dance. +static tap BSWtap_state = { + .is_press_action = true, + .state = 0 +}; + +void BSW_finished (qk_tap_dance_state_t *state, void *user_data) { + BSWtap_state.state = cur_dance(state); + switch (BSWtap_state.state) { + case SINGLE_TAP: register_code(KC_ENTER); break; + case SINGLE_HOLD: + set_single_persistent_default_layer(0); + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(lyrdown_song); + #endif + break; + case DOUBLE_TAP: + register_code(KC_LCTRL); + register_code(KC_C); + break; + case DOUBLE_HOLD: + reset_keyboard(); + break; //register this keycode when button is tapped and then held + } +} + +void BSW_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (BSWtap_state.state) { + case SINGLE_TAP: unregister_code(KC_ENTER); break; + case DOUBLE_TAP: + unregister_code(KC_LCTRL); + unregister_code(KC_C); + break; + } + BSWtap_state.state = 0; +} + ///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION END ///// //Tap Dance Definitions @@ -224,12 +252,12 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS) // Other declarations would go here, separated by commas, if you have them ,[TD_Q_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC) - ,[ENT_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ENT_finished, ENT_reset) - ,[DEL_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, DEL_finished, DEL_reset) ,[RST_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, RST_finished, RST_reset) ,[CAD_TD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, CAD_finished, CAD_reset) ,[LYR_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, LYR_finished, LYR_reset) - + ,[LYR75_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, LYR75_finished, LYR75_reset) + ,[LYR50_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, LYR50_finished, LYR50_reset) + ,[BSW_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, BSW_finished, BSW_reset) }; //In Layer declaration, add tap dance item in place of a key code diff --git a/users/wanleg/wanleg.c b/users/wanleg/wanleg.c index f22c34ba30..4e60c422fa 100644 --- a/users/wanleg/wanleg.c +++ b/users/wanleg/wanleg.c @@ -47,6 +47,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case GHERKIN50: + if (record->event.pressed) { + set_single_persistent_default_layer(GK50); + } + return false; + break; case SUBTER: if (record->event.pressed) { layer_on(SUB); diff --git a/users/wanleg/wanleg.h b/users/wanleg/wanleg.h index 65028751a9..9e0cf3ee5d 100644 --- a/users/wanleg/wanleg.h +++ b/users/wanleg/wanleg.h @@ -27,10 +27,12 @@ enum userspace_layers { ETC75, FN75, PAD, + GK50, }; #elif KEYBOARD_xd75 enum userspace_layers { GK75 = 0, + PAD, QW75, SUB75, SUP75, @@ -50,7 +52,32 @@ enum userspace_layers { gNUM, gDIR, gETC, + GK50, +}; +#elif KEYBOARD_5x5 +enum userspace_layers { + GK50 = 0, + gNUM, + gDIR, + gETC, + GK75, + QW75, + SUB75, + SUP75, + NUM75, + DIR75, + ETC75, + FN75, PAD, + gGK, + _GK, + _QW, + ONE, + SUB, + SUP, + NUM, + DIR, + ETC, }; #else enum userspace_layers { @@ -75,6 +102,7 @@ enum userspace_layers { DIR75, ETC75, FN75, + GK50, }; #endif @@ -100,6 +128,7 @@ enum userspace_custom_keycodes { ETCETERA75, FUNCTION75, NUMPAD, + GHERKIN50, }; @@ -108,11 +137,12 @@ enum userspace_custom_keycodes { enum { TD_SFT_CAPS = 0 ,TD_Q_ESC - ,ENT_TAP_DANCE - ,DEL_TAP_DANCE ,CAD_TD ,RST_TAP_DANCE ,LYR_TAP_DANCE + ,LYR50_TAP_DANCE + ,LYR75_TAP_DANCE + ,BSW_TAP_DANCE }; #endif @@ -130,6 +160,7 @@ enum { #define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) #define LAYOUT_ortho_5x15_wrapper(...) LAYOUT_ortho_5x15(__VA_ARGS__) #define LAYOUT_ortho_4x4_wrapper(...) LAYOUT_ortho_4x4(__VA_ARGS__) +#define LAYOUT_ortho_5x5_wrapper(...) LAYOUT_ortho_5x5(__VA_ARGS__) // Blocks for each of the major keyboard layouts // Organized so we can quickly adapt and modify all of them @@ -189,12 +220,12 @@ enum { * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| * | mLeft | mDown | mRight | | SHIFT | mBtn3 | mBtn1 | mBtn2 | ; | ' | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| - * | Sft//Cp| | | | | C-A-D | mScrL | mScrR | ALT | DEL | + * | Sft//Cp| CAPS | | | | C-A-D | mScrL | mScrR | ALT | DEL | * '-----------------------------------------------------------------------------------------' */ #define _______________Gherkin_ETC_0_______________ KC_GRV, KC_MS_U, _______,_______, RESET, KC_RSFT, KC_WH_U, KC_WH_D, _______, KC_BSLS #define _______________Gherkin_ETC_1_______________ KC_MS_L, KC_MS_D, KC_MS_R,_______, KC_LSFT, KC_BTN3, KC_BTN1, KC_BTN2, KC_SCLN, KC_QUOT -#define _______________Gherkin_ETC_2_______________ TD(TD_SFT_CAPS),_______, _______,_______, _______, LALT(LCTL(KC_DEL)), KC_WH_L, KC_WH_R, KC_LALT, KC_DEL +#define _______________Gherkin_ETC_2_______________ TD(TD_SFT_CAPS),KC_CAPS, _______,_______, _______, LALT(LCTL(KC_DEL)), KC_WH_L, KC_WH_R, KC_LALT, KC_DEL /* Gherkin-Like * .-----------------------------------------------------------------------------------------------------------. |