Skip to content

Keyboard: Power-saving mode

Hayden Kroepfl requested to merge Chartreuse/reform:powersave into master

Enables power saving modes for the keyboard controller. Currently only enters the power down mode via the user manually selecting a menu entry, or after the use selects Power-Off via the menu.

Power-off is awoken from by holding down until the boot logo appears (should be at most 1s, but in practice could be 2-3s).

The EnterPowerOff() function disables all devices, sets ports to mostly a driven state (possibly more could be done here), and presets the keyboard to be scanning ROW1 to be able to read the circle button. Watchdog timer is setup for 1s timeouts to wake us and check if the button is pressed, and the CPU is set into PWR_DOWN mode. Once complete, SetupHardware() is called again to reinitialize the hardware and control returns.

Further work will be needed to automate this when the LPC controller detects a low battery condition, and for the resume to also wake up the LPC if it goes into sleep.

Edited by Hayden Kroepfl

Merge request reports