summaryrefslogtreecommitdiffstats
path: root/tmk_core/common/avr
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-08-30 12:21:03 -0700
committerGitHub <noreply@github.com>2021-08-30 20:21:03 +0100
commit15710db4ada682d274c1d02b4d66ed7ac820a821 (patch)
tree4e398caefe966f5f3c1c749797e060635f998d25 /tmk_core/common/avr
parentcf28feaf4d27866aad23c382fdd9cf095decefff (diff)
Move feature suspend logic out of platform specific code (#14210)
Diffstat (limited to 'tmk_core/common/avr')
-rw-r--r--tmk_core/common/avr/suspend.c98
1 files changed, 2 insertions, 96 deletions
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 690d7f38ca..b614746e6c 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -16,25 +16,6 @@
# include "vusb.h"
#endif
-#ifdef BACKLIGHT_ENABLE
-# include "backlight.h"
-#endif
-
-#ifdef AUDIO_ENABLE
-# include "audio.h"
-#endif /* AUDIO_ENABLE */
-
-#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
-# include "rgblight.h"
-#endif
-
-#ifdef LED_MATRIX_ENABLE
-# include "led_matrix.h"
-#endif
-#ifdef RGB_MATRIX_ENABLE
-# include "rgb_matrix.h"
-#endif
-
/** \brief Suspend idle
*
* FIXME: needs doc
@@ -50,17 +31,6 @@ void suspend_idle(uint8_t time) {
// TODO: This needs some cleanup
-/** \brief Run keyboard level Power down
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_power_down_user(void) {}
-/** \brief Run keyboard level Power down
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); }
-
#if !defined(NO_SUSPEND_POWER_DOWN) && defined(WDT_vect)
// clang-format off
@@ -135,41 +105,9 @@ void suspend_power_down(void) {
if (!vusb_suspended) return;
#endif
- suspend_power_down_kb();
+ suspend_power_down_quantum();
#ifndef NO_SUSPEND_POWER_DOWN
- // Turn off backlight
-# ifdef BACKLIGHT_ENABLE
- backlight_set(0);
-# endif
-
- // Turn off LED indicators
- uint8_t leds_off = 0;
-# if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE)
- if (is_backlight_enabled()) {
- // Don't try to turn off Caps Lock indicator as it is backlight and backlight is already off
- leds_off |= (1 << USB_LED_CAPS_LOCK);
- }
-# endif
- led_set(leds_off);
-
- // Turn off audio
-# ifdef AUDIO_ENABLE
- stop_all_notes();
-# endif
-
- // Turn off underglow
-# if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
- rgblight_suspend();
-# endif
-
-# if defined(LED_MATRIX_ENABLE)
- led_matrix_set_suspend_state(true);
-# endif
-# if defined(RGB_MATRIX_ENABLE)
- rgb_matrix_set_suspend_state(true);
-# endif
-
// Enter sleep state if possible (ie, the MCU has a watchdog timeout interrupt)
# if defined(WDT_vect)
power_down(WDTO_15MS);
@@ -189,18 +127,6 @@ bool suspend_wakeup_condition(void) {
return false;
}
-/** \brief run user level code immediately after wakeup
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_wakeup_init_user(void) {}
-
-/** \brief run keyboard level code immediately after wakeup
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); }
-
/** \brief run immediately after wakeup
*
* FIXME: needs doc
@@ -209,27 +135,7 @@ void suspend_wakeup_init(void) {
// clear keyboard state
clear_keyboard();
- // Turn on backlight
-#ifdef BACKLIGHT_ENABLE
- backlight_init();
-#endif
-
- // Restore LED indicators
- led_set(host_keyboard_leds());
-
- // Wake up underglow
-#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
- rgblight_wakeup();
-#endif
-
-#if defined(LED_MATRIX_ENABLE)
- led_matrix_set_suspend_state(false);
-#endif
-#if defined(RGB_MATRIX_ENABLE)
- rgb_matrix_set_suspend_state(false);
-#endif
-
- suspend_wakeup_init_kb();
+ suspend_wakeup_init_quantum();
}
#if !defined(NO_SUSPEND_POWER_DOWN) && defined(WDT_vect)