From 6540b31d71a13a1b612cc31bad4c081f1a178630 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 23 Mar 2023 00:37:13 +0000 Subject: [PATCH] Add some helpers to tidy up XAP (#20235) --- quantum/audio/audio.c | 4 ++++ quantum/audio/audio.h | 5 +++++ quantum/rgblight/rgblight.c | 4 ++++ quantum/rgblight/rgblight.h | 1 + 4 files changed, 14 insertions(+) diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index ca78a483ad..3f6dc20232 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -112,6 +112,10 @@ static bool audio_initialized = false; static bool audio_driver_stopped = true; audio_config_t audio_config; +void eeconfig_update_audio_current(void) { + eeconfig_update_audio(audio_config.raw); +} + void audio_init(void) { if (audio_initialized) { return; diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h index fe23cf3ed1..6feecb5e65 100644 --- a/quantum/audio/audio.h +++ b/quantum/audio/audio.h @@ -63,6 +63,11 @@ typedef struct { // public interface +/** + * @brief Save the current choices to the eeprom + */ +void eeconfig_update_audio_current(void); + /** * @brief one-time initialization called by quantum/quantum.c * @details usually done lazy, when some tones are to be played diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 19d80e0097..4c476f924f 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -422,6 +422,10 @@ void rgblight_disable_noeeprom(void) { rgblight_set(); } +void rgblight_enabled_noeeprom(bool state) { + state ? rgblight_enable_noeeprom() : rgblight_disable_noeeprom(); +} + bool rgblight_is_enabled(void) { return rgblight_config.enable; } diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h index 7693888462..c71da29332 100644 --- a/quantum/rgblight/rgblight.h +++ b/quantum/rgblight/rgblight.h @@ -321,6 +321,7 @@ void rgblight_enable(void); void rgblight_enable_noeeprom(void); void rgblight_disable(void); void rgblight_disable_noeeprom(void); +void rgblight_enabled_noeeprom(bool state); /* hue, sat, val change */ void rgblight_increase_hue(void);