diff options
author | QMK Bot <hello@qmk.fm> | 2021-04-10 00:38:17 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-04-10 00:38:17 +0000 |
commit | 29d537ce7b9b9770d99b0244793b6bc159d8a435 (patch) | |
tree | 6286d9e012bd89a4e267a23f41f1c31cf0b63d24 /users/edvorakjp/edvorakjp_status.c | |
parent | 688fb1999b339d20ba8cd173d6dc7c53754d4ba0 (diff) | |
parent | 3dbb7f261dab573a3b55390394444ac3ceb3d257 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'users/edvorakjp/edvorakjp_status.c')
-rw-r--r-- | users/edvorakjp/edvorakjp_status.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/users/edvorakjp/edvorakjp_status.c b/users/edvorakjp/edvorakjp_status.c index 128fc3bd28..c8a06c2255 100644 --- a/users/edvorakjp/edvorakjp_status.c +++ b/users/edvorakjp/edvorakjp_status.c @@ -2,63 +2,55 @@ #include "edvorakjp.h" typedef union { - uint8_t raw; - struct { - bool enable_kc_lang; // for macOS - }; + uint8_t raw; + struct { + bool enable_kc_lang; // for macOS + }; } edvorakjp_config_t; static edvorakjp_config_t edvorakjp_config; typedef struct { - bool japanese_mode; + bool japanese_mode; } edvorakjp_state_t; static edvorakjp_state_t edvorakjp_state; /* * private methods */ -uint8_t eeconfig_read_edvorakjp(void) { - return eeprom_read_byte(EECONFIG_EDVORAK); -} +uint8_t eeconfig_read_edvorakjp(void) { return eeprom_read_byte(EECONFIG_EDVORAK); } -void eeconfig_update_edvorakjp(uint8_t val) { - eeprom_update_byte(EECONFIG_EDVORAK, val); -} +void eeconfig_update_edvorakjp(uint8_t val) { eeprom_update_byte(EECONFIG_EDVORAK, val); } /* * public methods */ void edvorakjp_status_init(void) { - edvorakjp_state.japanese_mode = false; - edvorakjp_config.raw = eeconfig_read_edvorakjp(); + edvorakjp_state.japanese_mode = false; + edvorakjp_config.raw = eeconfig_read_edvorakjp(); } -bool get_enable_kc_lang(void) { - return edvorakjp_config.enable_kc_lang; -} +bool get_enable_kc_lang(void) { return edvorakjp_config.enable_kc_lang; } void set_enable_kc_lang(bool new_state) { - edvorakjp_config.enable_kc_lang = new_state; - eeconfig_update_edvorakjp(edvorakjp_config.raw); + edvorakjp_config.enable_kc_lang = new_state; + eeconfig_update_edvorakjp(edvorakjp_config.raw); } -bool get_japanese_mode(void) { - return edvorakjp_state.japanese_mode; -} +bool get_japanese_mode(void) { return edvorakjp_state.japanese_mode; } void set_japanese_mode(bool new_state) { - edvorakjp_state.japanese_mode = new_state; - if (edvorakjp_state.japanese_mode) { - if (edvorakjp_config.enable_kc_lang) { - SEND_STRING(SS_TAP(X_LANG1)); - } else { - SEND_STRING(SS_LALT("`")); - } - } else { - if (edvorakjp_config.enable_kc_lang) { - SEND_STRING(SS_TAP(X_LANG2)); + edvorakjp_state.japanese_mode = new_state; + if (edvorakjp_state.japanese_mode) { + if (edvorakjp_config.enable_kc_lang) { + SEND_STRING(SS_TAP(X_LANG1)); + } else { + SEND_STRING(SS_LALT("`")); + } } else { - SEND_STRING(SS_LALT("`")); + if (edvorakjp_config.enable_kc_lang) { + SEND_STRING(SS_TAP(X_LANG2)); + } else { + SEND_STRING(SS_LALT("`")); + } } - } } |