diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2017-09-16 23:51:25 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-09-17 00:04:14 +0200 |
commit | 064fa902c56f7cb421fa8071e58096248ea9c5ae (patch) | |
tree | dd04d85888e523ffff64f549138078559629ca5f | |
parent | a0fca0c7bf3bd1c121667a1e66614646a6b96752 (diff) | |
download | rockbox-064fa902c56f7cb421fa8071e58096248ea9c5ae.tar.gz 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
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c | 15 |
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) | |||
82 | imx233_button_init(); | 82 | imx233_button_init(); |
83 | } | 83 | } |
84 | 84 | ||
85 | static int touch_to_pixels(int *val_x, int *val_y) | 85 | static void fix_pixels(int *val_x, int *val_y) |
86 | { | 86 | { |
87 | short x,y; | 87 | short x,y; |
88 | 88 | ||
@@ -101,9 +101,7 @@ static int touch_to_pixels(int *val_x, int *val_y) | |||
101 | y = MAX(0, MIN(y, LCD_HEIGHT - 1)); | 101 | y = MAX(0, MIN(y, LCD_HEIGHT - 1)); |
102 | 102 | ||
103 | *val_x = x; | 103 | *val_x = x; |
104 | *val_y = y; | 104 | *val_y = y;; |
105 | |||
106 | return (x<<16)|y; | ||
107 | } | 105 | } |
108 | 106 | ||
109 | void touchscreen_enable_device(bool en) | 107 | void touchscreen_enable_device(bool en) |
@@ -114,11 +112,10 @@ void touchscreen_enable_device(bool en) | |||
114 | static int touchscreen_read_device(int *data) | 112 | static int touchscreen_read_device(int *data) |
115 | { | 113 | { |
116 | int x, y; | 114 | int x, y; |
117 | if(!imx233_touchscreen_get_touch(&x, &y)) | 115 | bool touch = imx233_touchscreen_get_touch(&x, &y); |
118 | return 0; | 116 | fix_pixels(&x, &y); |
119 | if(data) | 117 | int btns = touchscreen_to_pixels(x, y, data); |
120 | *data = touch_to_pixels(&x, &y); | 118 | return touch ? btns : 0; |
121 | return touchscreen_to_pixels(x, y, data); | ||
122 | } | 119 | } |
123 | 120 | ||
124 | int button_read_device(int *data) | 121 | int button_read_device(int *data) |