From fd55351f94098b50aded866fc0b1af71f0ace2f0 Mon Sep 17 00:00:00 2001 From: Alex Kagno Date: Sat, 29 Sep 2018 15:28:31 -0600 Subject: [PATCH 1/3] leader changes to enable per key timing option --- docs/feature_leader_key.md | 23 +++++++++++++++++++++++ quantum/process_keycode/process_leader.c | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md index 92aebd463d67..9b49e0fd9612 100644 --- a/docs/feature_leader_key.md +++ b/docs/feature_leader_key.md @@ -47,3 +47,26 @@ To add support for Leader Key you simply need to add a single line to your keyma ``` LEADER_ENABLE = yes ``` + +## Per Key Timing on Leader keys + +Rather than relying on an incredibly high timeout for long leader key strings or those of us without 200wpm typing skills, we can enable per key timing to ensure that each key pressed provides us with more time to finish our stroke. This is incredibly helpful with leader key emulation of tap dance (read: multiple taps of the same key like C, C, C). + +In order to enable this, place this in your `config.h`: +``` +#define LEADER_PER_KEY_TIMING +``` + +After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms. + +``` +#define LEADER_TIMEOUT 250 +``` + +Now, something like this won't seem impossible to do without a 1000MS leader key timeout: + +``` +SEQ_THREE_KEYS(KC_C, KC_C, KC_C) { + SEND_STRING("Per key timing is great!!!"); +} +``` diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c index eddbf71f7001..b32fc1db6a04 100644 --- a/quantum/process_keycode/process_leader.c +++ b/quantum/process_keycode/process_leader.c @@ -38,9 +38,15 @@ uint8_t leader_sequence_size = 0; bool process_leader(uint16_t keycode, keyrecord_t *record) { // Leader key set-up if (record->event.pressed) { +#ifdef LEADER_PER_KEY_TIMING + leader_time = timer_read(); +#endif if (!leading && keycode == KC_LEAD) { leader_start(); leading = true; +#ifndef LEADER_PER_KEY_TIMING + leader_time = timer_read(); +#endif leader_time = timer_read(); leader_sequence_size = 0; leader_sequence[0] = 0; From 84b03380206809c454b4860d6d4984d1e9778405 Mon Sep 17 00:00:00 2001 From: Alex K Date: Thu, 4 Oct 2018 12:13:11 -0600 Subject: [PATCH 2/3] Changes requested to docs for @drashna --- docs/config_options.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/config_options.md b/docs/config_options.md index 072857727bd2..2eda3614dbd1 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -83,6 +83,8 @@ This is a C header file that is one of the first things included, and will persi * the length of one backlight "breath" in seconds * `#define DEBOUNCING_DELAY 5` * the delay when reading the value of the pin (5 is default) +* `#define LEADER_PER_KEY_TIMING` + * sets the timer for leader key chords to run on each key press rather than overall * `#define LOCKING_SUPPORT_ENABLE` * mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap * `#define LOCKING_RESYNC_ENABLE` @@ -187,7 +189,7 @@ Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in yo * `#define SPLIT_HAND_PIN B7` * For using high/low pin to determine handedness, low = right hand, high = left hand. Replace 'B7' with the pin you are using. This is optional and you can still use the EEHANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses. - + * `#define USE_I2C` * For using I2C instead of Serial (defaults to serial) From 5160f3801f197ff8e6b0c4f0468c3f30abf36d4f Mon Sep 17 00:00:00 2001 From: Alex K Date: Thu, 4 Oct 2018 12:27:22 -0600 Subject: [PATCH 3/3] Changes requested by @drashna --- docs/config_options.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/config_options.md b/docs/config_options.md index 2eda3614dbd1..7b177708a988 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -83,8 +83,6 @@ This is a C header file that is one of the first things included, and will persi * the length of one backlight "breath" in seconds * `#define DEBOUNCING_DELAY 5` * the delay when reading the value of the pin (5 is default) -* `#define LEADER_PER_KEY_TIMING` - * sets the timer for leader key chords to run on each key press rather than overall * `#define LOCKING_SUPPORT_ENABLE` * mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap * `#define LOCKING_RESYNC_ENABLE` @@ -144,6 +142,8 @@ If you define these options you will enable the associated feature, which may in * See [Hold after tap](feature_advanced_keycodes.md#hold-after-tap) * `#define LEADER_TIMEOUT 300` * how long before the leader key times out +* `#define LEADER_PER_KEY_TIMING` + * sets the timer for leader key chords to run on each key press rather than overall * `#define ONESHOT_TIMEOUT 300` * how long before oneshot times out * `#define ONESHOT_TAP_TOGGLE 2` @@ -242,6 +242,8 @@ Use these to enable or disable building certain features. The more you have enab * Enable the audio subsystem. * `RGBLIGHT_ENABLE` * Enable keyboard underlight functionality +* `LEADER_ENABLE` + * Enable leader key chording * `MIDI_ENABLE` * MIDI controls * `UNICODE_ENABLE`