diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-10-02 11:08:41 -0700 |
|---|---|---|
| committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-04-12 14:07:05 -0700 |
| commit | a2090d5e863a580d71e29de104844d5fc4fbe036 (patch) | |
| tree | bf4be102f5be309d41ac1d8da2a2fd48fc775526 /quantum/quantum.c | |
| parent | 6832a067ef8966993319f07f34a4a08b39c2ded4 (diff) | |
| download | qmk_firmware-a2090d5e863a580d71e29de104844d5fc4fbe036.tar.gz qmk_firmware-a2090d5e863a580d71e29de104844d5fc4fbe036.zip | |
Add AltGr/RALT support to Send String
Diffstat (limited to 'quantum/quantum.c')
| -rw-r--r-- | quantum/quantum.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index a4ccccd00..0fe918b36 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -851,6 +851,26 @@ const bool ascii_to_shift_lut[0x80] PROGMEM = { | |||
| 851 | }; | 851 | }; |
| 852 | 852 | ||
| 853 | __attribute__ ((weak)) | 853 | __attribute__ ((weak)) |
| 854 | const bool ascii_to_alt_lut[0x80] PROGMEM = { | ||
| 855 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 856 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 857 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 858 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 859 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 860 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 861 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 862 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 863 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 864 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 865 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 866 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 867 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 868 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 869 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 870 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 871 | }; | ||
| 872 | |||
| 873 | __attribute__ ((weak)) | ||
| 854 | const uint8_t ascii_to_keycode_lut[0x80] PROGMEM = { | 874 | const uint8_t ascii_to_keycode_lut[0x80] PROGMEM = { |
| 855 | 0, 0, 0, 0, 0, 0, 0, 0, | 875 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 856 | KC_BSPC, KC_TAB, KC_ENT, 0, 0, 0, 0, 0, | 876 | KC_BSPC, KC_TAB, KC_ENT, 0, 0, 0, 0, 0, |
| @@ -932,16 +952,21 @@ void send_string_with_delay_P(const char *str, uint8_t interval) { | |||
| 932 | 952 | ||
| 933 | void send_char(char ascii_code) { | 953 | void send_char(char ascii_code) { |
| 934 | uint8_t keycode; | 954 | uint8_t keycode; |
| 955 | bool is_shifted; | ||
| 956 | bool is_alted; | ||
| 957 | |||
| 935 | keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]); | 958 | keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]); |
| 936 | if (pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code])) { | 959 | if (pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code])) { is_shifted = true; } else { is_shifted = false; } |
| 937 | register_code(KC_LSFT); | 960 | if (pgm_read_byte(&ascii_to_alt_lut[(uint8_t)ascii_code])) { is_alted = true; } else { is_alted = false; } |
| 938 | register_code(keycode); | 961 | |
| 939 | unregister_code(keycode); | 962 | if (is_shifted) { register_code(KC_LSFT); } |
| 940 | unregister_code(KC_LSFT); | 963 | if (is_alted) { register_code(KC_RALT); } |
| 941 | } else { | 964 | |
| 942 | register_code(keycode); | 965 | register_code(keycode); |
| 943 | unregister_code(keycode); | 966 | unregister_code(keycode); |
| 944 | } | 967 | |
| 968 | if (is_alted) { unregister_code(KC_RALT); } | ||
| 969 | if (is_shifted) { unregister_code(KC_LSFT); } | ||
| 945 | } | 970 | } |
| 946 | 971 | ||
| 947 | void set_single_persistent_default_layer(uint8_t default_layer) { | 972 | void set_single_persistent_default_layer(uint8_t default_layer) { |
