diff options
author | Ryan <fauxpark@gmail.com> | 2020-10-27 06:14:56 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 06:14:56 +1100 |
commit | 2c92ee1f56b92b15403b2f070c827162db37c9ba (patch) | |
tree | 72aba98d58b032f16eca7c49b248a950fb9a9d16 /quantum/process_keycode/process_unicode_common.c | |
parent | 0c42f91f4ccf98a37f055afb777ed491da56335e (diff) | |
download | qmk_firmware-2c92ee1f56b92b15403b2f070c827162db37c9ba.tar.gz qmk_firmware-2c92ee1f56b92b15403b2f070c827162db37c9ba.zip |
Allow modified keycodes in Unicode input (#10658)
Diffstat (limited to 'quantum/process_keycode/process_unicode_common.c')
-rw-r--r-- | quantum/process_keycode/process_unicode_common.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 84c44d987..80be31623 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c | |||
@@ -136,20 +136,10 @@ __attribute__((weak)) void unicode_input_cancel(void) { | |||
136 | set_mods(unicode_saved_mods); // Reregister previously set mods | 136 | set_mods(unicode_saved_mods); // Reregister previously set mods |
137 | } | 137 | } |
138 | 138 | ||
139 | __attribute__((weak)) uint16_t hex_to_keycode(uint8_t hex) { | ||
140 | if (hex == 0x0) { | ||
141 | return KC_0; | ||
142 | } else if (hex < 0xA) { | ||
143 | return KC_1 + (hex - 0x1); | ||
144 | } else { | ||
145 | return KC_A + (hex - 0xA); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | void register_hex(uint16_t hex) { | 139 | void register_hex(uint16_t hex) { |
150 | for (int i = 3; i >= 0; i--) { | 140 | for (int i = 3; i >= 0; i--) { |
151 | uint8_t digit = ((hex >> (i * 4)) & 0xF); | 141 | uint8_t digit = ((hex >> (i * 4)) & 0xF); |
152 | tap_code(hex_to_keycode(digit)); | 142 | tap_code16(hex_to_keycode(digit)); |
153 | } | 143 | } |
154 | } | 144 | } |
155 | 145 | ||
@@ -162,10 +152,10 @@ void register_hex32(uint32_t hex) { | |||
162 | uint8_t digit = ((hex >> (i * 4)) & 0xF); | 152 | uint8_t digit = ((hex >> (i * 4)) & 0xF); |
163 | if (digit == 0) { | 153 | if (digit == 0) { |
164 | if (!onzerostart) { | 154 | if (!onzerostart) { |
165 | tap_code(hex_to_keycode(digit)); | 155 | tap_code16(hex_to_keycode(digit)); |
166 | } | 156 | } |
167 | } else { | 157 | } else { |
168 | tap_code(hex_to_keycode(digit)); | 158 | tap_code16(hex_to_keycode(digit)); |
169 | onzerostart = false; | 159 | onzerostart = false; |
170 | } | 160 | } |
171 | } | 161 | } |