diff options
author | Wilba <Jason.S.Williams@gmail.com> | 2020-01-21 05:18:25 +1100 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2020-02-26 10:15:12 +0900 |
commit | cd526157047d870d7039cf26f034193f8c5e0cbb (patch) | |
tree | c9e72ad0992432d7901a0740919919d750e45213 /quantum/rgblight.c | |
parent | 79386844a45996fd0402bb0e94561ed4c9799847 (diff) |
Add VIA support for QMK backlight, QMK RGBLight (#7911)
* Add VIA support for QMK backlight, QMK RGBLight
* clang-format changes
Diffstat (limited to 'quantum/rgblight.c')
-rw-r--r-- | quantum/rgblight.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index e0ed30879b..643a9eaaf2 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -162,6 +162,10 @@ void eeconfig_update_rgblight(uint32_t val) { #endif } +void eeconfig_update_rgblight_current(void) { + eeconfig_update_rgblight(rgblight_config.raw); +} + void eeconfig_update_rgblight_default(void) { rgblight_config.enable = 1; rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; @@ -503,6 +507,22 @@ void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_ee void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_eeprom_helper(hue, sat, val, false); } +uint8_t rgblight_get_speed(void) { return rgblight_config.speed; } + +void rgblight_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { + rgblight_config.speed = speed; + if (write_to_eeprom) { + eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this + dprintf("rgblight set speed [EEPROM]: %u\n", rgblight_config.speed); + } else { + dprintf("rgblight set speed [NOEEPROM]: %u\n", rgblight_config.speed); + } +} + +void rgblight_set_speed(uint8_t speed) { rgblight_set_speed_eeprom_helper(speed, true); } + +void rgblight_set_speed_noeeprom(uint8_t speed) { rgblight_set_speed_eeprom_helper(speed, false); } + uint8_t rgblight_get_hue(void) { return rgblight_config.hue; } uint8_t rgblight_get_sat(void) { return rgblight_config.sat; } |