diff options
| author | Joshua Diamond <josh@windowoffire.com> | 2021-01-27 12:42:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-28 04:42:03 +1100 |
| commit | bad9592a18494e3f678c2a117a526ca5f2f2280d (patch) | |
| tree | 8ce28a5b691c1092795e80f3ef09871b07d0a22c | |
| parent | 162842f16ee2e064f826712c3cd0c4d24445732e (diff) | |
| download | qmk_firmware-bad9592a18494e3f678c2a117a526ca5f2f2280d.tar.gz qmk_firmware-bad9592a18494e3f678c2a117a526ca5f2f2280d.zip | |
Add rgblight_reload_from_eeprom() (#11411)
* Add rgblight_reset_from_eeprom()
* reset->reload
| -rw-r--r-- | docs/feature_rgblight.md | 1 | ||||
| -rw-r--r-- | quantum/rgblight.c | 11 | ||||
| -rw-r--r-- | quantum/rgblight.h | 3 |
3 files changed, 15 insertions, 0 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 0d3e66670..755fd769e 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md | |||
| @@ -361,6 +361,7 @@ rgblight_sethsv(HSV_GREEN, 2); // led 2 | |||
| 361 | |`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) | | 361 | |`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) | |
| 362 | |`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations | | 362 | |`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations | |
| 363 | |`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) | | 363 | |`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) | |
| 364 | |`rgblight_reload_from_eeprom()` |Reload the effect configuration (enabled, mode and color) from EEPROM | | ||
| 364 | 365 | ||
| 365 | #### effects mode disable/enable | 366 | #### effects mode disable/enable |
| 366 | |Function |Description | | 367 | |Function |Description | |
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index d856f6d6c..ac4ff9bfd 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -234,6 +234,17 @@ void rgblight_init(void) { | |||
| 234 | is_rgblight_initialized = true; | 234 | is_rgblight_initialized = true; |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | void rgblight_reload_from_eeprom(void) { | ||
| 238 | /* Reset back to what we have in eeprom */ | ||
| 239 | rgblight_config.raw = eeconfig_read_rgblight(); | ||
| 240 | RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; | ||
| 241 | rgblight_check_config(); | ||
| 242 | eeconfig_debug_rgblight(); // display current eeprom values | ||
| 243 | if (rgblight_config.enable) { | ||
| 244 | rgblight_mode_noeeprom(rgblight_config.mode); | ||
| 245 | } | ||
| 246 | } | ||
| 247 | |||
| 237 | uint32_t rgblight_read_dword(void) { return rgblight_config.raw; } | 248 | uint32_t rgblight_read_dword(void) { return rgblight_config.raw; } |
| 238 | 249 | ||
| 239 | void rgblight_update_dword(uint32_t dword) { | 250 | void rgblight_update_dword(uint32_t dword) { |
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index efbffa7fd..1854fee99 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -347,6 +347,9 @@ uint8_t rgblight_get_speed(void); | |||
| 347 | void rgblight_set_speed(uint8_t speed); | 347 | void rgblight_set_speed(uint8_t speed); |
| 348 | void rgblight_set_speed_noeeprom(uint8_t speed); | 348 | void rgblight_set_speed_noeeprom(uint8_t speed); |
| 349 | 349 | ||
| 350 | /* reset */ | ||
| 351 | void rgblight_reload_from_eeprom(void); | ||
| 352 | |||
| 350 | /* query */ | 353 | /* query */ |
| 351 | uint8_t rgblight_get_mode(void); | 354 | uint8_t rgblight_get_mode(void); |
| 352 | uint8_t rgblight_get_hue(void); | 355 | uint8_t rgblight_get_hue(void); |
