diff options
| author | Gergely Nagy <algernon@madhouse-project.org> | 2016-08-14 14:34:52 +0200 |
|---|---|---|
| committer | Gergely Nagy <algernon@madhouse-project.org> | 2016-08-15 10:08:53 +0200 |
| commit | a312cbf712764277e0dbbbb99410c2f6fc6c7484 (patch) | |
| tree | 9f78d4f9d041304fea69e78f68bfd52f972aecfb /quantum/process_keycode | |
| parent | 234dd276cf03be6fd6961473e9d9c8f35deec682 (diff) | |
| download | qmk_firmware-a312cbf712764277e0dbbbb99410c2f6fc6c7484.tar.gz qmk_firmware-a312cbf712764277e0dbbbb99410c2f6fc6c7484.zip | |
process_unicode: Use uint32_t for UCIS purposes
Use a single uint32_t to store the unicode of a symbol, instead of an
array of uint16_ts.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Diffstat (limited to 'quantum/process_keycode')
| -rw-r--r-- | quantum/process_keycode/process_unicode.c | 12 | ||||
| -rw-r--r-- | quantum/process_keycode/process_unicode.h | 7 |
2 files changed, 13 insertions, 6 deletions
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c index c474483e7..698cc3c02 100644 --- a/quantum/process_keycode/process_unicode.c +++ b/quantum/process_keycode/process_unicode.c | |||
| @@ -60,6 +60,14 @@ 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 | |||
| 63 | bool process_unicode(uint16_t keycode, keyrecord_t *record) { | 71 | bool process_unicode(uint16_t keycode, keyrecord_t *record) { |
| 64 | if (keycode > QK_UNICODE && record->event.pressed) { | 72 | if (keycode > QK_UNICODE && record->event.pressed) { |
| 65 | uint16_t unicode = keycode & 0x7FFF; | 73 | uint16_t unicode = keycode & 0x7FFF; |
| @@ -156,9 +164,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { | |||
| 156 | for (i = 0; ucis_symbol_table[i].symbol; i++) { | 164 | for (i = 0; ucis_symbol_table[i].symbol; i++) { |
| 157 | if (is_uni_seq (ucis_symbol_table[i].symbol)) { | 165 | if (is_uni_seq (ucis_symbol_table[i].symbol)) { |
| 158 | symbol_found = true; | 166 | symbol_found = true; |
| 159 | for (uint8_t j = 0; ucis_symbol_table[i].codes[j]; j++) { | 167 | register_hex32(ucis_symbol_table[i].code); |
| 160 | register_hex(ucis_symbol_table[i].codes[j]); | ||
| 161 | } | ||
| 162 | break; | 168 | break; |
| 163 | } | 169 | } |
| 164 | } | 170 | } |
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index 75607e40e..dd6dd7138 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h | |||
| @@ -12,6 +12,7 @@ void set_unicode_input_mode(uint8_t os_target); | |||
| 12 | void unicode_input_start(void); | 12 | void unicode_input_start(void); |
| 13 | void unicode_input_finish(void); | 13 | void unicode_input_finish(void); |
| 14 | void register_hex(uint16_t hex); | 14 | void register_hex(uint16_t hex); |
| 15 | void register_hex32(uint32_t hex); | ||
| 15 | 16 | ||
| 16 | bool process_unicode(uint16_t keycode, keyrecord_t *record); | 17 | bool process_unicode(uint16_t keycode, keyrecord_t *record); |
| 17 | 18 | ||
| @@ -22,7 +23,7 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record); | |||
| 22 | 23 | ||
| 23 | typedef struct { | 24 | typedef struct { |
| 24 | char *symbol; | 25 | char *symbol; |
| 25 | uint16_t codes[4]; | 26 | uint32_t code; |
| 26 | } qk_ucis_symbol_t; | 27 | } qk_ucis_symbol_t; |
| 27 | 28 | ||
| 28 | struct { | 29 | struct { |
| @@ -31,8 +32,8 @@ struct { | |||
| 31 | bool in_progress:1; | 32 | bool in_progress:1; |
| 32 | } qk_ucis_state; | 33 | } qk_ucis_state; |
| 33 | 34 | ||
| 34 | #define UCIS_TABLE(...) {__VA_ARGS__, {NULL, {}}} | 35 | #define UCIS_TABLE(...) {__VA_ARGS__, {NULL, 0}} |
| 35 | #define UCIS_SYM(name, ...) {name, {__VA_ARGS__, 0}} | 36 | #define UCIS_SYM(name, code) {name, code} |
| 36 | 37 | ||
| 37 | extern const qk_ucis_symbol_t ucis_symbol_table[]; | 38 | extern const qk_ucis_symbol_t ucis_symbol_table[]; |
| 38 | 39 | ||
