summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/philips/sa9200/button-sa9200.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c
index 9fab3d4068..e3d569f422 100644
--- a/firmware/target/arm/philips/sa9200/button-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/button-sa9200.c
@@ -30,6 +30,8 @@
30static int int_btn = BUTTON_NONE; 30static int int_btn = BUTTON_NONE;
31 31
32#ifndef BOOTLOADER 32#ifndef BOOTLOADER
33static bool hold_button_old = false;
34
33void button_init_device(void) 35void button_init_device(void)
34{ 36{
35 /* The touchpad is powered on and initialized in power-sa9200.c 37 /* The touchpad is powered on and initialized in power-sa9200.c
@@ -72,8 +74,10 @@ void button_int(void)
72 } 74 }
73} 75}
74#else 76#else
75void button_init_device(void){} 77void button_init_device(void)
76#endif /* bootloader */ 78{
79}
80#endif /* BOOTLOADER */
77 81
78bool button_hold(void) 82bool button_hold(void)
79{ 83{
@@ -86,8 +90,18 @@ bool button_hold(void)
86int button_read_device(void) 90int button_read_device(void)
87{ 91{
88 int btn = int_btn; 92 int btn = int_btn;
93 bool hold = !(GPIOL_INPUT_VAL & 0x40);
94
95#ifndef BOOTLOADER
96 /* Backlight hold handling */
97 if (hold != hold_button_old)
98 {
99 hold_button_old = hold;
100 backlight_hold_changed(hold);
101 }
102#endif
89 103
90 if (button_hold()) 104 if (hold)
91 return BUTTON_NONE; 105 return BUTTON_NONE;
92 106
93 if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; 107 if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER;