Let the keyboard figure out by itself whether the system is asleep by
looking at the USB connection state.
| | USB Active | USB Suspend |
| Lid Open | LED, keys | No LED, keys |
| Lid closed | No LED, no keys | No LED, no keys |
=> lid_open => keys registered
=> lid_open && !suspended => LEDs on
After waking from sleep, backlight does not turn back on.
Remove the custom backlight/sleep logic. Don't try to outsmart the core
quantum logic, let it handle the hard stuff. Our code just
suspends/wakes the keyboard.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
With selective suspend windows likes to suspend the keyboard very
eagerly after 5 seconds without activity. So we send keyboard reports
every second for 25 seconds to keep it awake.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
If the backlight brightness was changed and the keyboard unplugged and
replugged, the lights would stay off. They should come back to the
previous value, which will happen automatically but the code would
override.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
Other low power states should be handled perfectly fine by USB suspend,
since this is now fixed in chibios.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
With this change the 3.3V rail gets down to 22mA
The backlight and power led will auto turn off when the keyboard
SLEEP# goes low, and will resume when the sleep pin goes high.
For some reason WFI does not sleep as long as I would expect.
Something is triggering interrupts constantly
that we need to figure out to save power.
Signed-off-by: Kieran Levin <ktl@frame.work>