From 7222e3691b18128c4822f6bb5db008010f5e41dd Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 18 Oct 2018 21:35:15 -0700 Subject: 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 --- quantum/process_keycode/process_unicode_common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'quantum/process_keycode/process_unicode_common.c') 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 @@ static uint8_t input_mode; uint8_t mods; -void set_unicode_input_mode(uint8_t os_target) -{ +void set_unicode_input_mode(uint8_t os_target) { input_mode = os_target; eeprom_update_byte(EECONFIG_UNICODEMODE, os_target); } @@ -32,6 +31,14 @@ uint8_t get_unicode_input_mode(void) { return input_mode; } +void unicode_input_mode_init(void) { + static bool first_flag = false; + if (!first_flag) { + input_mode = eeprom_read_byte(EECONFIG_UNICODEMODE); + first_flag = true; + } +} + __attribute__((weak)) void unicode_input_start (void) { // save current mods @@ -104,8 +111,7 @@ void unicode_input_finish (void) { } __attribute__((weak)) -uint16_t hex_to_keycode(uint8_t hex) -{ +uint16_t hex_to_keycode(uint8_t hex) { if (hex == 0x0) { return KC_0; } else if (hex < 0xA) { @@ -123,8 +129,7 @@ void register_hex(uint16_t hex) { } } -void send_unicode_hex_string(const char *str) -{ +void send_unicode_hex_string(const char *str) { if (!str) { return; } // Safety net while (*str) { -- cgit v1.2.3-24-g4f1b