From 5a6737a778cfa828e4fdb5d382a84a41e5210d8e Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 26 Nov 2019 18:16:58 +1100 Subject: Send string keycode tweaks (#7471) --- quantum/process_keycode/process_terminal.c | 2 +- quantum/quantum.h | 24 +------------------ quantum/send_string_keycodes.h | 32 ++++++++++++++++++++++++++ quantum/template/base/keymaps/default/keymap.c | 2 +- 4 files changed, 35 insertions(+), 25 deletions(-) (limited to 'quantum') diff --git a/quantum/process_keycode/process_terminal.c b/quantum/process_keycode/process_terminal.c index f48f3d702d..7d1eefa9ed 100644 --- a/quantum/process_keycode/process_terminal.c +++ b/quantum/process_keycode/process_terminal.c @@ -61,7 +61,7 @@ void enable_terminal(void) { memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80); for (int i = 0; i < 6; i++) strcpy(arguments[i], ""); // select all text to start over - // SEND_STRING(SS_LCTRL("a")); + // SEND_STRING(SS_LCTL("a")); send_string(terminal_prompt); } diff --git a/quantum/quantum.h b/quantum/quantum.h index 6beab65a32..91b9170b16 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -182,30 +182,8 @@ typedef ioline_t pin_t; # define readPin(pin) palReadLine(pin) #endif -// Send string macros -#define STRINGIZE(z) #z -#define ADD_SLASH_X(y) STRINGIZE(\x##y) -#define SYMBOL_STR(x) ADD_SLASH_X(x) - -#define SS_TAP_CODE 1 -#define SS_DOWN_CODE 2 -#define SS_UP_CODE 3 - -#define SS_TAP(keycode) "\1" SYMBOL_STR(keycode) -#define SS_DOWN(keycode) "\2" SYMBOL_STR(keycode) -#define SS_UP(keycode) "\3" SYMBOL_STR(keycode) - -// `string` arguments must not be parenthesized -#define SS_LCTRL(string) SS_DOWN(X_LCTRL) string SS_UP(X_LCTRL) -#define SS_LGUI(string) SS_DOWN(X_LGUI) string SS_UP(X_LGUI) -#define SS_LCMD(string) SS_LGUI(string) -#define SS_LWIN(string) SS_LGUI(string) -#define SS_LALT(string) SS_DOWN(X_LALT) string SS_UP(X_LALT) -#define SS_LSFT(string) SS_DOWN(X_LSHIFT) string SS_UP(X_LSHIFT) -#define SS_RALT(string) SS_DOWN(X_RALT) string SS_UP(X_RALT) -#define SS_ALGR(string) SS_RALT(string) - #define SEND_STRING(string) send_string_P(PSTR(string)) +#define SEND_STRING_DELAY(string, interval) send_string_with_delay_P(PSTR(string), interval) extern const bool ascii_to_shift_lut[128]; extern const bool ascii_to_altgr_lut[128]; diff --git a/quantum/send_string_keycodes.h b/quantum/send_string_keycodes.h index e2deb980ae..fc6467a741 100644 --- a/quantum/send_string_keycodes.h +++ b/quantum/send_string_keycodes.h @@ -340,3 +340,35 @@ #define X_MEDIA_REWIND bc #define X_BRIGHTNESS_UP bd #define X_BRIGHTNESS_DOWN be + +// Send string macros +#define STRINGIZE(z) #z +#define ADD_SLASH_X(y) STRINGIZE(\x##y) +#define SYMBOL_STR(x) ADD_SLASH_X(x) + +#define SS_TAP_CODE 1 +#define SS_DOWN_CODE 2 +#define SS_UP_CODE 3 + +#define SS_TAP(keycode) "\1" SYMBOL_STR(keycode) +#define SS_DOWN(keycode) "\2" SYMBOL_STR(keycode) +#define SS_UP(keycode) "\3" SYMBOL_STR(keycode) + +// `string` arguments must not be parenthesized +#define SS_LCTL(string) SS_DOWN(X_LCTL) string SS_UP(X_LCTL) +#define SS_LSFT(string) SS_DOWN(X_LSFT) string SS_UP(X_LSFT) +#define SS_LALT(string) SS_DOWN(X_LALT) string SS_UP(X_LALT) +#define SS_LGUI(string) SS_DOWN(X_LGUI) string SS_UP(X_LGUI) +#define SS_LCMD(string) SS_LGUI(string) +#define SS_LWIN(string) SS_LGUI(string) + +#define SS_RCTL(string) SS_DOWN(X_RCTL) string SS_UP(X_RCTL) +#define SS_RSFT(string) SS_DOWN(X_RSFT) string SS_UP(X_RSFT) +#define SS_RALT(string) SS_DOWN(X_RALT) string SS_UP(X_RALT) +#define SS_RGUI(string) SS_DOWN(X_RGUI) string SS_UP(X_RGUI) +#define SS_ALGR(string) SS_RALT(string) +#define SS_RCMD(string) SS_RGUI(string) +#define SS_RWIN(string) SS_RGUI(string) + +// DEPRECATED +#define SS_LCTRL(string) SS_LCTL(string) diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c index 3a68f5487c..af35ccec15 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/quantum/template/base/keymaps/default/keymap.c @@ -52,7 +52,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case QMKURL: if (record->event.pressed) { // when keycode QMKURL is pressed - SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); + SEND_STRING("https://qmk.fm/\n"); } else { // when keycode QMKURL is released } -- cgit v1.2.3