From af0a5f623f228c463bfc9628827bb6477564518f Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 29 Sep 2019 12:53:16 -0600 Subject: [PATCH] Pass pin to power switch function --- src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 7219abb..2ea3008 100644 --- a/src/main.c +++ b/src/main.c @@ -47,19 +47,19 @@ void init(void) { // PECI information can be found here: https://www.intel.com/content/dam/www/public/us/en/documents/design-guides/core-i7-lga-2011-guide.pdf } -struct Pin PWR_SW = PIN(D, 0); - -void power_switch(void) { +void power_button(struct Pin * button) { static bool last = false; // Check if the power switch goes low - bool new = pin_get(&PWR_SW); + bool new = pin_get(button); if (!new && last) { printf("Power Switch\n"); } last = new; } +struct Pin PWR_SW = PIN(D, 0); + struct Pin LED_BAT_CHG = PIN(A, 5); struct Pin LED_BAT_FULL = PIN(A, 6); struct Pin LED_PWR = PIN(A, 7); @@ -78,7 +78,7 @@ void main(void) { gpio_debug(); for(;;) { - power_switch(); + power_button(&PWR_SW); kbc_event(&KBC); pmc_event(&PMC_1); }