aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kagno <cwre@protonmail.com>2018-12-15 08:29:24 -0700
committerDrashna Jaelre <drashna@live.com>2018-12-15 07:29:24 -0800
commit3ec4a00bfc090fc440480336e3273b459074aa18 (patch)
tree95cd72fb059d961a3868a9dcf67f2fb1fb6ba7e2
parent72bd17f2902c82ef84b9134433facb21ad696fbb (diff)
downloadqmk_firmware-3ec4a00bfc090fc440480336e3273b459074aa18.tar.gz
qmk_firmware-3ec4a00bfc090fc440480336e3273b459074aa18.zip
Per Key Leader Timing Option (#4026)
* leader changes to enable per key timing option * Changes requested to docs for @drashna * Changes requested by @drashna
-rw-r--r--docs/config_options.md6
-rw-r--r--docs/feature_leader_key.md23
-rw-r--r--quantum/process_keycode/process_leader.c6
3 files changed, 34 insertions, 1 deletions
diff --git a/docs/config_options.md b/docs/config_options.md
index bea4acb01..fb1655e9a 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -143,6 +143,8 @@ If you define these options you will enable the associated feature, which may in
143 * Breaks any Tap Toggle functionality (`TT` or the One Shot Tap Toggle) 143 * Breaks any Tap Toggle functionality (`TT` or the One Shot Tap Toggle)
144* `#define LEADER_TIMEOUT 300` 144* `#define LEADER_TIMEOUT 300`
145 * how long before the leader key times out 145 * how long before the leader key times out
146* `#define LEADER_PER_KEY_TIMING`
147 * sets the timer for leader key chords to run on each key press rather than overall
146* `#define ONESHOT_TIMEOUT 300` 148* `#define ONESHOT_TIMEOUT 300`
147 * how long before oneshot times out 149 * how long before oneshot times out
148* `#define ONESHOT_TAP_TOGGLE 2` 150* `#define ONESHOT_TAP_TOGGLE 2`
@@ -194,7 +196,7 @@ Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in yo
194 196
195* `#define SPLIT_HAND_PIN B7` 197* `#define SPLIT_HAND_PIN B7`
196 * 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. 198 * 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.
197 199
198* `#define USE_I2C` 200* `#define USE_I2C`
199 * For using I2C instead of Serial (defaults to serial) 201 * For using I2C instead of Serial (defaults to serial)
200 202
@@ -252,6 +254,8 @@ Use these to enable or disable building certain features. The more you have enab
252 * Enable the audio subsystem. 254 * Enable the audio subsystem.
253* `RGBLIGHT_ENABLE` 255* `RGBLIGHT_ENABLE`
254 * Enable keyboard underlight functionality 256 * Enable keyboard underlight functionality
257* `LEADER_ENABLE`
258 * Enable leader key chording
255* `MIDI_ENABLE` 259* `MIDI_ENABLE`
256 * MIDI controls 260 * MIDI controls
257* `UNICODE_ENABLE` 261* `UNICODE_ENABLE`
diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md
index 92aebd463..9b49e0fd9 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
47``` 47```
48LEADER_ENABLE = yes 48LEADER_ENABLE = yes
49``` 49```
50
51## Per Key Timing on Leader keys
52
53Rather 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).
54
55In order to enable this, place this in your `config.h`:
56```
57#define LEADER_PER_KEY_TIMING
58```
59
60After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms.
61
62```
63#define LEADER_TIMEOUT 250
64```
65
66Now, something like this won't seem impossible to do without a 1000MS leader key timeout:
67
68```
69SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
70 SEND_STRING("Per key timing is great!!!");
71}
72```
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index eddbf71f7..b32fc1db6 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;
38bool process_leader(uint16_t keycode, keyrecord_t *record) { 38bool process_leader(uint16_t keycode, keyrecord_t *record) {
39 // Leader key set-up 39 // Leader key set-up
40 if (record->event.pressed) { 40 if (record->event.pressed) {
41#ifdef LEADER_PER_KEY_TIMING
42 leader_time = timer_read();
43#endif
41 if (!leading && keycode == KC_LEAD) { 44 if (!leading && keycode == KC_LEAD) {
42 leader_start(); 45 leader_start();
43 leading = true; 46 leading = true;
47#ifndef LEADER_PER_KEY_TIMING
48 leader_time = timer_read();
49#endif
44 leader_time = timer_read(); 50 leader_time = timer_read();
45 leader_sequence_size = 0; 51 leader_sequence_size = 0;
46 leader_sequence[0] = 0; 52 leader_sequence[0] = 0;