diff options
author | Drashna Jaelre <drashna@live.com> | 2018-10-18 21:35:15 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-10-19 00:35:15 -0400 |
commit | 7222e3691b18128c4822f6bb5db008010f5e41dd (patch) | |
tree | 9be08574cf226f6a4f5d08cfad5d302013b44f9e /quantum/process_keycode/process_unicode_common.c | |
parent | 7e1b57add42dcc3330d9d99e28c9b7f96eb2eee8 (diff) | |
download | qmk_firmware-7222e3691b18128c4822f6bb5db008010f5e41dd.tar.gz qmk_firmware-7222e3691b18128c4822f6bb5db008010f5e41dd.zip |
Fix Unicode EEPROM handling so it is consistent. (#4066)
* Fix Unicode EEPROM handling so it's consistant
* Remove changes to my userspace
* Optimize variables used
* fix functions
* additional cleanup
* Add False Flag
* rename function
Diffstat (limited to 'quantum/process_keycode/process_unicode_common.c')
-rw-r--r-- | quantum/process_keycode/process_unicode_common.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index e6620b7ea..4285d20a1 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c | |||
@@ -22,8 +22,7 @@ | |||
22 | static uint8_t input_mode; | 22 | static uint8_t input_mode; |
23 | uint8_t mods; | 23 | uint8_t mods; |
24 | 24 | ||
25 | void set_unicode_input_mode(uint8_t os_target) | 25 | void set_unicode_input_mode(uint8_t os_target) { |
26 | { | ||
27 | input_mode = os_target; | 26 | input_mode = os_target; |
28 | eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); | 27 | eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); |
29 | } | 28 | } |
@@ -32,6 +31,14 @@ uint8_t get_unicode_input_mode(void) { | |||
32 | return input_mode; | 31 | return input_mode; |
33 | } | 32 | } |
34 | 33 | ||
34 | void unicode_input_mode_init(void) { | ||
35 | static bool first_flag = false; | ||
36 | if (!first_flag) { | ||
37 | input_mode = eeprom_read_byte(EECONFIG_UNICODEMODE); | ||
38 | first_flag = true; | ||
39 | } | ||
40 | } | ||
41 | |||
35 | __attribute__((weak)) | 42 | __attribute__((weak)) |
36 | void unicode_input_start (void) { | 43 | void unicode_input_start (void) { |
37 | // save current mods | 44 | // save current mods |
@@ -104,8 +111,7 @@ void unicode_input_finish (void) { | |||
104 | } | 111 | } |
105 | 112 | ||
106 | __attribute__((weak)) | 113 | __attribute__((weak)) |
107 | uint16_t hex_to_keycode(uint8_t hex) | 114 | uint16_t hex_to_keycode(uint8_t hex) { |
108 | { | ||
109 | if (hex == 0x0) { | 115 | if (hex == 0x0) { |
110 | return KC_0; | 116 | return KC_0; |
111 | } else if (hex < 0xA) { | 117 | } else if (hex < 0xA) { |
@@ -123,8 +129,7 @@ void register_hex(uint16_t hex) { | |||
123 | } | 129 | } |
124 | } | 130 | } |
125 | 131 | ||
126 | void send_unicode_hex_string(const char *str) | 132 | void send_unicode_hex_string(const char *str) { |
127 | { | ||
128 | if (!str) { return; } // Safety net | 133 | if (!str) { return; } // Safety net |
129 | 134 | ||
130 | while (*str) { | 135 | while (*str) { |