diff options
| author | Nick Brassel <nick@tzarc.org> | 2020-02-27 20:38:19 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-27 20:38:19 +1100 |
| commit | 444fd3b1cc07d7f68aa37cbc9e38f2e4ed4d3ea7 (patch) | |
| tree | 9198deb31eb8b79b3416f3806ef5d6b9da340829 /docs/feature_macros.md | |
| parent | e18be6910493c132fa84be1f21a579fa9b9e12a9 (diff) | |
| download | qmk_firmware-444fd3b1cc07d7f68aa37cbc9e38f2e4ed4d3ea7.tar.gz qmk_firmware-444fd3b1cc07d7f68aa37cbc9e38f2e4ed4d3ea7.zip | |
Add support for delays in send_string. (#8244)
Diffstat (limited to 'docs/feature_macros.md')
| -rw-r--r-- | docs/feature_macros.md | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/docs/feature_macros.md b/docs/feature_macros.md index 7ca945683..99dd564bf 100644 --- a/docs/feature_macros.md +++ b/docs/feature_macros.md | |||
| @@ -107,6 +107,16 @@ Would tap `KC_HOME` - note how the prefix is now `X_`, and not `KC_`. You can al | |||
| 107 | 107 | ||
| 108 | Which would send "VE" followed by a `KC_HOME` tap, and "LO" (spelling "LOVE" if on a newline). | 108 | Which would send "VE" followed by a `KC_HOME` tap, and "LO" (spelling "LOVE" if on a newline). |
| 109 | 109 | ||
| 110 | Delays can be also added to the string: | ||
| 111 | |||
| 112 | * `SS_DELAY(msecs)` will delay for the specified number of milliseconds. | ||
| 113 | |||
| 114 | For example: | ||
| 115 | |||
| 116 | SEND_STRING("VE" SS_DELAY(1000) SS_TAP(X_HOME) "LO"); | ||
| 117 | |||
| 118 | Which would send "VE" followed by a 1-second delay, then a `KC_HOME` tap, and "LO" (spelling "LOVE" if on a newline, but delayed in the middle). | ||
| 119 | |||
| 110 | There's also a couple of mod shortcuts you can use: | 120 | There's also a couple of mod shortcuts you can use: |
| 111 | 121 | ||
| 112 | * `SS_LCTL(string)` | 122 | * `SS_LCTL(string)` |
| @@ -200,11 +210,11 @@ This will clear all mods currently pressed. | |||
| 200 | 210 | ||
| 201 | This will clear all keys besides the mods currently pressed. | 211 | This will clear all keys besides the mods currently pressed. |
| 202 | 212 | ||
| 203 | ## Advanced Example: | 213 | ## Advanced Example: |
| 204 | 214 | ||
| 205 | ### Super ALT↯TAB | 215 | ### Super ALT↯TAB |
| 206 | 216 | ||
| 207 | This macro will register `KC_LALT` and tap `KC_TAB`, then wait for 1000ms. If the key is tapped again, it will send another `KC_TAB`; if there is no tap, `KC_LALT` will be unregistered, thus allowing you to cycle through windows. | 217 | This macro will register `KC_LALT` and tap `KC_TAB`, then wait for 1000ms. If the key is tapped again, it will send another `KC_TAB`; if there is no tap, `KC_LALT` will be unregistered, thus allowing you to cycle through windows. |
| 208 | 218 | ||
| 209 | ```c | 219 | ```c |
| 210 | bool is_alt_tab_active = false; # ADD this near the begining of keymap.c | 220 | bool is_alt_tab_active = false; # ADD this near the begining of keymap.c |
| @@ -221,7 +231,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 221 | if (!is_alt_tab_active) { | 231 | if (!is_alt_tab_active) { |
| 222 | is_alt_tab_active = true; | 232 | is_alt_tab_active = true; |
| 223 | register_code(KC_LALT); | 233 | register_code(KC_LALT); |
| 224 | } | 234 | } |
| 225 | alt_tab_timer = timer_read(); | 235 | alt_tab_timer = timer_read(); |
| 226 | register_code(KC_TAB); | 236 | register_code(KC_TAB); |
| 227 | } else { | 237 | } else { |
| @@ -232,7 +242,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 232 | return true; | 242 | return true; |
| 233 | } | 243 | } |
| 234 | 244 | ||
| 235 | void matrix_scan_user(void) { # The very important timer. | 245 | void matrix_scan_user(void) { # The very important timer. |
| 236 | if (is_alt_tab_active) { | 246 | if (is_alt_tab_active) { |
| 237 | if (timer_elapsed(alt_tab_timer) > 1000) { | 247 | if (timer_elapsed(alt_tab_timer) > 1000) { |
| 238 | unregister_code(KC_LALT); | 248 | unregister_code(KC_LALT); |
| @@ -321,7 +331,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 321 | ``` | 331 | ``` |
| 322 | 332 | ||
| 323 | 333 | ||
| 324 | ## Advanced Example: | 334 | ## Advanced Example: |
| 325 | 335 | ||
| 326 | ### Single-Key Copy/Paste | 336 | ### Single-Key Copy/Paste |
| 327 | 337 | ||
