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 | |
parent | e18be6910493c132fa84be1f21a579fa9b9e12a9 (diff) |
Add support for delays in send_string. (#8244)
Diffstat (limited to 'docs')
-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 7ca945683c..99dd564bf8 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 Which would send "VE" followed by a `KC_HOME` tap, and "LO" (spelling "LOVE" if on a newline). +Delays can be also added to the string: + +* `SS_DELAY(msecs)` will delay for the specified number of milliseconds. + +For example: + + SEND_STRING("VE" SS_DELAY(1000) SS_TAP(X_HOME) "LO"); + +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). + There's also a couple of mod shortcuts you can use: * `SS_LCTL(string)` @@ -200,11 +210,11 @@ This will clear all mods currently pressed. This will clear all keys besides the mods currently pressed. -## Advanced Example: +## Advanced Example: ### Super ALT↯TAB -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. +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. ```c 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) { if (!is_alt_tab_active) { is_alt_tab_active = true; register_code(KC_LALT); - } + } alt_tab_timer = timer_read(); register_code(KC_TAB); } else { @@ -232,7 +242,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } -void matrix_scan_user(void) { # The very important timer. +void matrix_scan_user(void) { # The very important timer. if (is_alt_tab_active) { if (timer_elapsed(alt_tab_timer) > 1000) { unregister_code(KC_LALT); @@ -321,7 +331,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ``` -## Advanced Example: +## Advanced Example: ### Single-Key Copy/Paste |