diff --git a/common/power_button.c b/common/power_button.c index 7d7e90b86d..ffa93d1027 100644 --- a/common/power_button.c +++ b/common/power_button.c @@ -30,6 +30,16 @@ static int debounced_power_pressed; /* Debounced power button state */ static int simulate_power_pressed; +/** + * Return non-zero if power button signal asserted at hardware input. + * + */ +int power_button_signal_asserted(void) +{ + return !!(gpio_get_level(GPIO_POWER_BUTTON_L) + == CONFIG_POWER_BUTTON_ACTIVE_STATE); +} + /** * Get raw power button signal state. * @@ -50,8 +60,7 @@ static int raw_power_button_pressed(void) return 0; #endif - return !!(gpio_get_level(GPIO_POWER_BUTTON_L) - == CONFIG_POWER_BUTTON_ACTIVE_STATE); + return power_button_signal_asserted(); } int power_button_is_pressed(void) diff --git a/include/power_button.h b/include/power_button.h index 190073812e..ce9f63e216 100644 --- a/include/power_button.h +++ b/include/power_button.h @@ -17,6 +17,12 @@ */ int power_button_is_pressed(void); +/** + * Return non-zero if power button signal asserted at hardware input. + * + */ +int power_button_signal_asserted(void); + /** * Interrupt handler for power button. *