summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quantum/process_keycode/process_unicode.c37
-rw-r--r--quantum/process_keycode/process_unicode.h8
2 files changed, 32 insertions, 13 deletions
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index 698cc3c025..d8a0f667cd 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) {
}
}
-void register_hex32(uint32_t hex) {
- for(int i = 7; i >= 0; i--) {
- uint8_t digit = ((hex >> (i*8)) & 0xF);
- register_code(hex_to_keycode(digit));
- unregister_code(hex_to_keycode(digit));
- }
-}
-
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
if (keycode > QK_UNICODE && record->event.pressed) {
uint16_t unicode = keycode & 0x7FFF;
@@ -120,6 +112,33 @@ void qk_ucis_symbol_fallback (void) {
}
}
+void register_ucis(const char *hex) {
+ for(int i = 0; hex[i]; i++) {
+ uint8_t kc = 0;
+ char c = hex[i];
+
+ switch (c) {
+ case '0':
+ kc = KC_0;
+ break;
+ case '1' ... '9':
+ kc = c - '1' + KC_1;
+ break;
+ case 'a' ... 'f':
+ kc = c - 'a' + KC_A;
+ break;
+ case 'A' ... 'F':
+ kc = c - 'A' + KC_A;
+ break;
+ }
+
+ if (kc) {
+ register_code (kc);
+ unregister_code (kc);
+ }
+ }
+}
+
bool process_ucis (uint16_t keycode, keyrecord_t *record) {
uint8_t i;
@@ -164,7 +183,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
for (i = 0; ucis_symbol_table[i].symbol; i++) {
if (is_uni_seq (ucis_symbol_table[i].symbol)) {
symbol_found = true;
- register_hex32(ucis_symbol_table[i].code);
+ register_ucis(ucis_symbol_table[i].code + 2);
break;
}
}
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index dd6dd71384..be24ddc2bb 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -12,7 +12,6 @@ void set_unicode_input_mode(uint8_t os_target);
void unicode_input_start(void);
void unicode_input_finish(void);
void register_hex(uint16_t hex);
-void register_hex32(uint32_t hex);
bool process_unicode(uint16_t keycode, keyrecord_t *record);
@@ -23,7 +22,7 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record);
typedef struct {
char *symbol;
- uint32_t code;
+ char *code;
} qk_ucis_symbol_t;
struct {
@@ -32,14 +31,15 @@ struct {
bool in_progress:1;
} qk_ucis_state;
-#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, 0}}
-#define UCIS_SYM(name, code) {name, code}
+#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}}
+#define UCIS_SYM(name, code) {name, #code}
extern const qk_ucis_symbol_t ucis_symbol_table[];
void qk_ucis_start(void);
void qk_ucis_start_user(void);
void qk_ucis_symbol_fallback (void);
+void register_ucis(const char *hex);
bool process_ucis (uint16_t keycode, keyrecord_t *record);
#endif