diff options
| -rw-r--r-- | docs/feature_auto_shift.md | 27 | ||||
| -rw-r--r-- | quantum/process_keycode/process_auto_shift.c | 20 | ||||
| -rw-r--r-- | quantum/process_keycode/process_auto_shift.h | 1 |
3 files changed, 41 insertions, 7 deletions
diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md index 8e04d9dd3..ec7eeaaa0 100644 --- a/docs/feature_auto_shift.md +++ b/docs/feature_auto_shift.md | |||
| @@ -109,6 +109,33 @@ Do not Auto Shift numeric keys, zero through nine. | |||
| 109 | 109 | ||
| 110 | Do not Auto Shift alpha characters, which include A through Z. | 110 | Do not Auto Shift alpha characters, which include A through Z. |
| 111 | 111 | ||
| 112 | ### Auto Shift Per Key | ||
| 113 | |||
| 114 | This is a function that allows you to determine which keys shold be autoshifted, much like the tap-hold keys. | ||
| 115 | |||
| 116 | The default function looks like this: | ||
| 117 | |||
| 118 | ```c | ||
| 119 | bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { | ||
| 120 | switch (keycode) { | ||
| 121 | # ifndef NO_AUTO_SHIFT_ALPHA | ||
| 122 | case KC_A ... KC_Z: | ||
| 123 | # endif | ||
| 124 | # ifndef NO_AUTO_SHIFT_NUMERIC | ||
| 125 | case KC_1 ... KC_0: | ||
| 126 | # endif | ||
| 127 | # ifndef NO_AUTO_SHIFT_SPECIAL | ||
| 128 | case KC_TAB: | ||
| 129 | case KC_MINUS ... KC_SLASH: | ||
| 130 | case KC_NONUS_BSLASH: | ||
| 131 | # endif | ||
| 132 | return true; | ||
| 133 | } | ||
| 134 | return false; | ||
| 135 | } | ||
| 136 | ``` | ||
| 137 | This functionality is enabled by default, and does not need a define. | ||
| 138 | |||
| 112 | ### AUTO_SHIFT_REPEAT (simple define) | 139 | ### AUTO_SHIFT_REPEAT (simple define) |
| 113 | 140 | ||
| 114 | Enables keyrepeat. | 141 | Enables keyrepeat. |
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index bf359e994..51b0efdb4 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c | |||
| @@ -216,7 +216,18 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 216 | # endif | 216 | # endif |
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| 219 | if (get_auto_shifted_key(keycode, record)) { | ||
| 220 | if (record->event.pressed) { | ||
| 221 | return autoshift_press(keycode, now, record); | ||
| 222 | } else { | ||
| 223 | autoshift_end(keycode, now, false); | ||
| 224 | return false; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | return true; | ||
| 228 | } | ||
| 219 | 229 | ||
| 230 | __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { | ||
| 220 | switch (keycode) { | 231 | switch (keycode) { |
| 221 | # ifndef NO_AUTO_SHIFT_ALPHA | 232 | # ifndef NO_AUTO_SHIFT_ALPHA |
| 222 | case KC_A ... KC_Z: | 233 | case KC_A ... KC_Z: |
| @@ -229,14 +240,9 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 229 | case KC_MINUS ... KC_SLASH: | 240 | case KC_MINUS ... KC_SLASH: |
| 230 | case KC_NONUS_BSLASH: | 241 | case KC_NONUS_BSLASH: |
| 231 | # endif | 242 | # endif |
| 232 | if (record->event.pressed) { | 243 | return true; |
| 233 | return autoshift_press(keycode, now, record); | ||
| 234 | } else { | ||
| 235 | autoshift_end(keycode, now, false); | ||
| 236 | return false; | ||
| 237 | } | ||
| 238 | } | 244 | } |
| 239 | return true; | 245 | return false; |
| 240 | } | 246 | } |
| 241 | 247 | ||
| 242 | #endif | 248 | #endif |
diff --git a/quantum/process_keycode/process_auto_shift.h b/quantum/process_keycode/process_auto_shift.h index 5b2718f11..00a9ab036 100644 --- a/quantum/process_keycode/process_auto_shift.h +++ b/quantum/process_keycode/process_auto_shift.h | |||
| @@ -31,3 +31,4 @@ bool get_autoshift_state(void); | |||
| 31 | uint16_t get_autoshift_timeout(void); | 31 | uint16_t get_autoshift_timeout(void); |
| 32 | void set_autoshift_timeout(uint16_t timeout); | 32 | void set_autoshift_timeout(uint16_t timeout); |
| 33 | void autoshift_matrix_scan(void); | 33 | void autoshift_matrix_scan(void); |
| 34 | bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record); | ||
