commit 7319ecec88a7baa709b76d96151f12fae2e57971
parent 128bdd13b32244430208590b07d89b1280d0ce4b
Author: Lukas F. Hartmann <lukas@mntre.com>
Date: Mon, 27 Sep 2021 22:26:54 +0200
kbd: don't overwrite brightness setting in sleep
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/reform2-keyboard-fw/Keyboard.c b/reform2-keyboard-fw/Keyboard.c
@@ -469,7 +469,7 @@ void kbd_brightness_dec(void) {
}
void kbd_brightness_set(int brite) {
- pwmval=brite;
+ pwmval = brite;
if (pwmval<0) pwmval = 0;
if (pwmval>=10) pwmval = 10;
OCR0A = pwmval;
@@ -890,7 +890,9 @@ void EnterPowerOff(void)
{
USB_Disable(); // Stop USB stack so it doesn't wake us up
- kbd_brightness_set(0);
+ // turn off backlight, but don't overwrite setting
+ OCR0A = 0;
+
// Turn off OLED to save power
gfx_clear_screen();
gfx_off();
diff --git a/reform2-keyboard-fw/Keyboard.h b/reform2-keyboard-fw/Keyboard.h
@@ -68,6 +68,7 @@
/* Function Prototypes: */
void SetupHardware(void);
void EnterPowerOff(void);
+ void reset_keyboard_state(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);