diff options
author | Jonathan Rascher <jon@bcat.name> | 2019-11-08 15:43:02 -0600 |
---|---|---|
committer | Joel Challis <git@zvecr.com> | 2019-11-08 21:43:02 +0000 |
commit | 680d401faf03737b01f595b8800c211c0d130db6 (patch) | |
tree | 24916000837d4258f842c771d6e79188b2663950 /tmk_core/common/chibios/suspend.c | |
parent | 6fd88c15565f88ce1e595358ea98ecc1121fa26b (diff) |
Support RGBLIGHT_SLEEP when ChibiOS boards suspend (#7280)
Copypasta from the AVR suspend implementation with a Teensy-specific
hack removed
Diffstat (limited to 'tmk_core/common/chibios/suspend.c')
-rw-r--r-- | tmk_core/common/chibios/suspend.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index c0f9c28d44..5be1b76777 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -15,6 +15,13 @@ # include "backlight.h" #endif +#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) +# include "rgblight.h" +extern rgblight_config_t rgblight_config; +static bool rgblight_enabled; +static bool is_suspended; +#endif + /** \brief suspend idle * * FIXME: needs doc @@ -43,6 +50,16 @@ void suspend_power_down(void) { // TODO: figure out what to power down and how // shouldn't power down TPM/FTM if we want a breathing LED // also shouldn't power down USB +#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) +# ifdef RGBLIGHT_ANIMATIONS + rgblight_timer_disable(); +# endif + if (!is_suspended) { + is_suspended = true; + rgblight_enabled = rgblight_config.enable; + rgblight_disable_noeeprom(); + } +#endif suspend_power_down_kb(); // on AVR, this enables the watchdog for 15ms (max), and goes to @@ -104,5 +121,14 @@ void suspend_wakeup_init(void) { #ifdef BACKLIGHT_ENABLE backlight_init(); #endif /* BACKLIGHT_ENABLE */ +#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) + is_suspended = false; + if (rgblight_enabled) { + rgblight_enable_noeeprom(); + } +# ifdef RGBLIGHT_ANIMATIONS + rgblight_timer_enable(); +# endif +#endif suspend_wakeup_init_kb(); } |