diff options
Diffstat (limited to 'quantum/process_keycode/process_unicode.c')
| -rw-r--r-- | quantum/process_keycode/process_unicode.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index 698cc3c02..d8a0f667c 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c | |||
| @@ -60,14 +60,6 @@ void register_hex(uint16_t hex) { | |||
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | void register_hex32(uint32_t hex) { | ||
| 64 | for(int i = 7; i >= 0; i--) { | ||
| 65 | uint8_t digit = ((hex >> (i*8)) & 0xF); | ||
| 66 | register_code(hex_to_keycode(digit)); | ||
| 67 | unregister_code(hex_to_keycode(digit)); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | bool process_unicode(uint16_t keycode, keyrecord_t *record) { | 63 | bool process_unicode(uint16_t keycode, keyrecord_t *record) { |
| 72 | if (keycode > QK_UNICODE && record->event.pressed) { | 64 | if (keycode > QK_UNICODE && record->event.pressed) { |
| 73 | uint16_t unicode = keycode & 0x7FFF; | 65 | uint16_t unicode = keycode & 0x7FFF; |
| @@ -120,6 +112,33 @@ void qk_ucis_symbol_fallback (void) { | |||
| 120 | } | 112 | } |
| 121 | } | 113 | } |
| 122 | 114 | ||
| 115 | void register_ucis(const char *hex) { | ||
| 116 | for(int i = 0; hex[i]; i++) { | ||
| 117 | uint8_t kc = 0; | ||
| 118 | char c = hex[i]; | ||
| 119 | |||
| 120 | switch (c) { | ||
| 121 | case '0': | ||
| 122 | kc = KC_0; | ||
| 123 | break; | ||
| 124 | case '1' ... '9': | ||
| 125 | kc = c - '1' + KC_1; | ||
| 126 | break; | ||
| 127 | case 'a' ... 'f': | ||
| 128 | kc = c - 'a' + KC_A; | ||
| 129 | break; | ||
| 130 | case 'A' ... 'F': | ||
| 131 | kc = c - 'A' + KC_A; | ||
| 132 | break; | ||
| 133 | } | ||
| 134 | |||
| 135 | if (kc) { | ||
| 136 | register_code (kc); | ||
| 137 | unregister_code (kc); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 123 | bool process_ucis (uint16_t keycode, keyrecord_t *record) { | 142 | bool process_ucis (uint16_t keycode, keyrecord_t *record) { |
| 124 | uint8_t i; | 143 | uint8_t i; |
| 125 | 144 | ||
| @@ -164,7 +183,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { | |||
| 164 | for (i = 0; ucis_symbol_table[i].symbol; i++) { | 183 | for (i = 0; ucis_symbol_table[i].symbol; i++) { |
| 165 | if (is_uni_seq (ucis_symbol_table[i].symbol)) { | 184 | if (is_uni_seq (ucis_symbol_table[i].symbol)) { |
| 166 | symbol_found = true; | 185 | symbol_found = true; |
| 167 | register_hex32(ucis_symbol_table[i].code); | 186 | register_ucis(ucis_symbol_table[i].code + 2); |
| 168 | break; | 187 | break; |
| 169 | } | 188 | } |
| 170 | } | 189 | } |
