mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-11 06:05:21 -05:00
... and fix M:Robe 500 red
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20059 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7d0b9f7fb7
commit
56ad29bab8
1 changed files with 4 additions and 29 deletions
|
|
@ -33,6 +33,7 @@
|
||||||
#include "uart-target.h"
|
#include "uart-target.h"
|
||||||
#include "tsc2100.h"
|
#include "tsc2100.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "touchscreen.h"
|
||||||
|
|
||||||
#define BUTTON_TIMEOUT 50
|
#define BUTTON_TIMEOUT 50
|
||||||
|
|
||||||
|
|
@ -42,22 +43,6 @@
|
||||||
static short last_x, last_y, last_z1, last_z2; /* for the touch screen */
|
static short last_x, last_y, last_z1, last_z2; /* for the touch screen */
|
||||||
static bool touch_available = false;
|
static bool touch_available = false;
|
||||||
|
|
||||||
static enum touchscreen_mode current_mode = TOUCHSCREEN_POINT;
|
|
||||||
static int touchscreen_buttons[3][3] = {
|
|
||||||
{BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT},
|
|
||||||
{BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT},
|
|
||||||
{BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT},
|
|
||||||
};
|
|
||||||
|
|
||||||
void touchscreen_set_mode(enum touchscreen_mode mode)
|
|
||||||
{
|
|
||||||
current_mode = mode;
|
|
||||||
}
|
|
||||||
enum touchscreen_mode touchscreen_get_mode(void)
|
|
||||||
{
|
|
||||||
return current_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct touch_calibration_point topleft, bottomright;
|
static struct touch_calibration_point topleft, bottomright;
|
||||||
|
|
||||||
/* Jd's tests.. These will hopefully work for everyone so we dont have to
|
/* Jd's tests.. These will hopefully work for everyone so we dont have to
|
||||||
|
|
@ -183,19 +168,9 @@ int button_read_device(int *data)
|
||||||
last_x = x;
|
last_x = x;
|
||||||
last_y = y;
|
last_y = y;
|
||||||
*data = touch_to_pixels(x, y);
|
*data = touch_to_pixels(x, y);
|
||||||
switch (current_mode)
|
r_button |= touchscreen_to_pixels((*data&0xffff0000)>>16,
|
||||||
{
|
*data&0x0000ffff, data);
|
||||||
case TOUCHSCREEN_POINT:
|
oldbutton = r_button;
|
||||||
r_button |= BUTTON_TOUCHSCREEN;
|
|
||||||
break;
|
|
||||||
case TOUCHSCREEN_BUTTON:
|
|
||||||
{
|
|
||||||
int px_x = ((*data&0xffff0000)>>16), px_y = ((*data&0x0000ffff));
|
|
||||||
r_button |= touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)];
|
|
||||||
oldbutton = r_button;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
last_touch = current_tick;
|
last_touch = current_tick;
|
||||||
touch_available = false;
|
touch_available = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue