summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc780x/cowond2/button-cowond2.c')
-rw-r--r--firmware/target/arm/tcc780x/cowond2/button-cowond2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
index 6ff87dd49c..a9b7265d4a 100644
--- a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
@@ -103,11 +103,12 @@ int button_read_device(int *data)
103{ 103{
104 int btn = BUTTON_NONE; 104 int btn = BUTTON_NONE;
105 int adc; 105 int adc;
106 static int old_data = 0;
106 107
107 static bool hold_button = false; 108 static bool hold_button = false;
108 bool hold_button_old; 109 bool hold_button_old;
109 110
110 *data = 0; 111 *data = old_data;
111 112
112 hold_button_old = hold_button; 113 hold_button_old = hold_button;
113 hold_button = button_hold(); 114 hold_button = button_hold();
@@ -188,7 +189,7 @@ int button_read_device(int *data)
188 { 189 {
189 last_x = x; 190 last_x = x;
190 last_y = y; 191 last_y = y;
191 *data = touch_to_pixels(x, y); 192 old_data = *data = touch_to_pixels(x, y);
192 btn |= touchscreen_to_pixels((*data&0xffff0000)>>16, 193 btn |= touchscreen_to_pixels((*data&0xffff0000)>>16,
193 (*data&0x0000ffff), 194 (*data&0x0000ffff),
194 data); 195 data);
@@ -197,12 +198,12 @@ int button_read_device(int *data)
197 last_touch = current_tick; 198 last_touch = current_tick;
198 touch_available = false; 199 touch_available = false;
199 } 200 }
200 201
201 if (!(GPIOA & 0x4)) 202 if (!(GPIOA & 0x4))
202 btn |= BUTTON_POWER; 203 btn |= BUTTON_POWER;
203 204
204 if(btn & BUTTON_TOUCHSCREEN && !is_backlight_on(true)) 205 if(btn & BUTTON_TOUCHSCREEN && !is_backlight_on(true))
205 *data = 0; 206 old_data = *data = 0;
206 207
207 return btn; 208 return btn;
208} 209}