Refactor lid switch, disable power button when lid closed and AC disconnected
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <arch/time.h>
|
||||
#include <board/battery.h>
|
||||
#include <board/gpio.h>
|
||||
#include <board/lid.h>
|
||||
#include <board/power.h>
|
||||
#include <board/pmc.h>
|
||||
#include <board/pnp.h>
|
||||
@@ -207,6 +208,10 @@ void power_event(void) {
|
||||
// Read power switch state
|
||||
static bool ps_last = true;
|
||||
bool ps_new = gpio_get(&PWR_SW_N);
|
||||
// Disable power button if lid is closed and AC is disconnected
|
||||
if (!lid_state && ac_last) {
|
||||
ps_new = true;
|
||||
}
|
||||
if (!ps_new && ps_last) {
|
||||
// Ensure press is not spurious
|
||||
delay_ms(10);
|
||||
|
Reference in New Issue
Block a user