summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c')
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c33
1 files changed, 4 insertions, 29 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
index ba2cedb76c..3e5be7c22f 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
@@ -33,6 +33,7 @@
33#include "uart-target.h" 33#include "uart-target.h"
34#include "tsc2100.h" 34#include "tsc2100.h"
35#include "string.h" 35#include "string.h"
36#include "touchscreen.h"
36 37
37#define BUTTON_TIMEOUT 50 38#define BUTTON_TIMEOUT 50
38 39
@@ -42,22 +43,6 @@
42static short last_x, last_y, last_z1, last_z2; /* for the touch screen */ 43static short last_x, last_y, last_z1, last_z2; /* for the touch screen */
43static bool touch_available = false; 44static bool touch_available = false;
44 45
45static enum touchscreen_mode current_mode = TOUCHSCREEN_POINT;
46static int touchscreen_buttons[3][3] = {
47 {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT},
48 {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT},
49 {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT},
50};
51
52void touchscreen_set_mode(enum touchscreen_mode mode)
53{
54 current_mode = mode;
55}
56enum touchscreen_mode touchscreen_get_mode(void)
57{
58 return current_mode;
59}
60
61static struct touch_calibration_point topleft, bottomright; 46static struct touch_calibration_point topleft, bottomright;
62 47
63/* Jd's tests.. These will hopefully work for everyone so we dont have to 48/* Jd's tests.. These will hopefully work for everyone so we dont have to
@@ -183,19 +168,9 @@ int button_read_device(int *data)
183 last_x = x; 168 last_x = x;
184 last_y = y; 169 last_y = y;
185 *data = touch_to_pixels(x, y); 170 *data = touch_to_pixels(x, y);
186 switch (current_mode) 171 r_button |= touchscreen_to_pixels((*data&0xffff0000)>>16,
187 { 172 *data&0x0000ffff, data);
188 case TOUCHSCREEN_POINT: 173 oldbutton = r_button;
189 r_button |= BUTTON_TOUCHSCREEN;
190 break;
191 case TOUCHSCREEN_BUTTON:
192 {
193 int px_x = ((*data&0xffff0000)>>16), px_y = ((*data&0x0000ffff));
194 r_button |= touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)];
195 oldbutton = r_button;
196 break;
197 }
198 }
199 } 174 }
200 last_touch = current_tick; 175 last_touch = current_tick;
201 touch_available = false; 176 touch_available = false;