summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 9677580838..626afc415f 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -65,6 +65,9 @@ static bool phones_present = false;
65#ifdef HAVE_LINEOUT_DETECTION 65#ifdef HAVE_LINEOUT_DETECTION
66static bool lineout_present = false; 66static bool lineout_present = false;
67#endif 67#endif
68#ifdef HAVE_SW_POWEROFF
69static bool enable_sw_poweroff = true;
70#endif
68 71
69/* how long until repeat kicks in, in centiseconds */ 72/* how long until repeat kicks in, in centiseconds */
70#define REPEAT_START (30*HZ/100) 73#define REPEAT_START (30*HZ/100)
@@ -280,7 +283,8 @@ static void button_tick(void)
280 which doesn't shut down easily with the OFF 283 which doesn't shut down easily with the OFF
281 key */ 284 key */
282#ifdef HAVE_SW_POWEROFF 285#ifdef HAVE_SW_POWEROFF
283 if ((btn & POWEROFF_BUTTON 286 if (enable_sw_poweroff &&
287 (btn & POWEROFF_BUTTON
284#ifdef RC_POWEROFF_BUTTON 288#ifdef RC_POWEROFF_BUTTON
285 || btn == RC_POWEROFF_BUTTON 289 || btn == RC_POWEROFF_BUTTON
286#endif 290#endif
@@ -773,3 +777,13 @@ void button_enable_touch(bool en)
773#endif 777#endif
774} 778}
775#endif 779#endif
780
781#ifdef HAVE_SW_POWEROFF
782void button_set_sw_poweroff_state(bool en) {
783 enable_sw_poweroff = en;
784}
785
786bool button_get_sw_poweroff_state() {
787 return enable_sw_poweroff;
788}
789#endif