summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/creative-zenxfi2
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-09-16 23:51:25 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-09-17 00:04:14 +0200
commit064fa902c56f7cb421fa8071e58096248ea9c5ae (patch)
treedd04d85888e523ffff64f549138078559629ca5f /firmware/target/arm/imx233/creative-zenxfi2
parenta0fca0c7bf3bd1c121667a1e66614646a6b96752 (diff)
downloadrockbox-064fa902c56f7cb421fa8071e58096248ea9c5ae.tar.gz
rockbox-064fa902c56f7cb421fa8071e58096248ea9c5ae.tar.bz2
rockbox-064fa902c56f7cb421fa8071e58096248ea9c5ae.zip
zenxfi2: fix touchscreen bug
Due to some undocumented behavior, the touchscreen was almost unusable in point mode. Now it's much better but still not very nice to use, probably it needs some filtering. Change-Id: Idc8a0214b09f268e6be907ee6ec3126cc0d88773
Diffstat (limited to 'firmware/target/arm/imx233/creative-zenxfi2')
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
index bfefe2c13f..1021884d54 100644
--- a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
+++ b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
@@ -82,7 +82,7 @@ void button_init_device(void)
imx233_button_init();
}
-static int touch_to_pixels(int *val_x, int *val_y)
+static void fix_pixels(int *val_x, int *val_y)
{
short x,y;
@@ -101,9 +101,7 @@ static int touch_to_pixels(int *val_x, int *val_y)
y = MAX(0, MIN(y, LCD_HEIGHT - 1));
*val_x = x;
- *val_y = y;
-
- return (x<<16)|y;
+ *val_y = y;;
}
void touchscreen_enable_device(bool en)
@@ -114,11 +112,10 @@ void touchscreen_enable_device(bool en)
static int touchscreen_read_device(int *data)
{
int x, y;
- if(!imx233_touchscreen_get_touch(&x, &y))
- return 0;
- if(data)
- *data = touch_to_pixels(&x, &y);
- return touchscreen_to_pixels(x, y, data);
+ bool touch = imx233_touchscreen_get_touch(&x, &y);
+ fix_pixels(&x, &y);
+ int btns = touchscreen_to_pixels(x, y, data);
+ return touch ? btns : 0;
}
int button_read_device(int *data)