Created
August 31, 2018 19:10
-
-
Save arkag/e9380b225668bb3e11aec66084cc49a0 to your computer and use it in GitHub Desktop.
Set OS function for QMK with update eeprom functionality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void set_os(OS type, bool update) { | |
| userspace_config.curr_os = type; | |
| underlight_color = HSV_COEFFICIENT * type; | |
| switch (type) { | |
| case OS_MAC: | |
| set_unicode_input_mode(UC_OSX_RALT); | |
| userspace_config.next_os = OS_WIN; | |
| break; | |
| case OS_WIN: | |
| set_unicode_input_mode(UC_WIN); | |
| userspace_config.next_os = OS_NIX; | |
| break; | |
| case OS_NIX: | |
| set_unicode_input_mode(UC_LNX); | |
| userspace_config.next_os = OS_MAC; | |
| break; | |
| } | |
| if (update) { | |
| rgblight_sethsv(underlight_color, 255, 255); | |
| eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); | |
| } else { | |
| rgblight_sethsv_noeeprom(underlight_color, 255, 255); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment