Skip to content

Commit

Permalink
Fix ChibiOS backlight not turning off on suspend (qmk#10114)
Browse files Browse the repository at this point in the history
* Fix ChibiOS backlight not turning off on suspend

* Add missing code for backlight as caps lock too
  • Loading branch information
fauxpark authored and drashna committed Sep 30, 2020
1 parent 8784ab0 commit 0df4551
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tmk_core/common/chibios/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "mousekey.h"
#include "host.h"
#include "suspend.h"
#include "led.h"
#include "wait.h"

#ifdef BACKLIGHT_ENABLE
Expand Down Expand Up @@ -47,6 +48,20 @@ __attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user
* FIXME: needs doc
*/
void suspend_power_down(void) {
#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);

// 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
Expand Down Expand Up @@ -119,6 +134,7 @@ void suspend_wakeup_init(void) {
#ifdef BACKLIGHT_ENABLE
backlight_init();
#endif /* BACKLIGHT_ENABLE */
led_set(host_keyboard_leds());
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
is_suspended = false;
if (rgblight_enabled) {
Expand Down

0 comments on commit 0df4551

Please sign in to comment.