diff options
3 files changed, 15 insertions, 5 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 | } |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 04acb71e45..7d9a43f902 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -108,9 +108,13 @@ inline bool button_hold(void) | |||
108 | return hold_button; | 108 | return hold_button; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* Since this is a touchscreen, the expectation in higher levels is that the | ||
112 | * previous touch location is maintained when a release occurs. This is | ||
113 | * intended to mimic a mouse or other similar pointing device. | ||
114 | */ | ||
111 | int button_read_device(int *data) | 115 | int button_read_device(int *data) |
112 | { | 116 | { |
113 | static int old_data; | 117 | static int old_data = 0; |
114 | int button_read = BUTTON_NONE; | 118 | int button_read = BUTTON_NONE; |
115 | short touch_x, touch_y, touch_z1, touch_z2; | 119 | short touch_x, touch_y, touch_z1, touch_z2; |
116 | static bool hold_button_old = false; | 120 | static bool hold_button_old = false; |
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c index 24caac0100..592d0805a3 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c | |||
@@ -158,6 +158,9 @@ bool button_hold(void) | |||
158 | int button_read_device(int *data) | 158 | int button_read_device(int *data) |
159 | { | 159 | { |
160 | int ret = 0; | 160 | int ret = 0; |
161 | static int old_data = 0; | ||
162 | |||
163 | data = old_data; | ||
161 | 164 | ||
162 | /* Filter button events out if HOLD button is pressed at firmware/ level */ | 165 | /* Filter button events out if HOLD button is pressed at firmware/ level */ |
163 | if(button_hold()) | 166 | if(button_hold()) |
@@ -181,6 +184,8 @@ int button_read_device(int *data) | |||
181 | ret |= touchscreen_to_pixels(cur_touch >> 16, cur_touch & 0xFFFF, data); | 184 | ret |= touchscreen_to_pixels(cur_touch >> 16, cur_touch & 0xFFFF, data); |
182 | if( UNLIKELY(!is_backlight_on(true)) ) | 185 | if( UNLIKELY(!is_backlight_on(true)) ) |
183 | *data = 0; | 186 | *data = 0; |
187 | |||
188 | old_data = data; | ||
184 | } | 189 | } |
185 | 190 | ||
186 | return ret; | 191 | return ret; |