diff options
Diffstat (limited to 'firmware/drivers/touchscreen.c')
-rw-r--r-- | firmware/drivers/touchscreen.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/firmware/drivers/touchscreen.c b/firmware/drivers/touchscreen.c index 823c2e7a92..8ce2400ca2 100644 --- a/firmware/drivers/touchscreen.c +++ b/firmware/drivers/touchscreen.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #define BUTTON_MARGIN_X (int)(LCD_WIDTH * 0.03) | 31 | #define BUTTON_MARGIN_X (int)(LCD_WIDTH * 0.03) |
32 | #define BUTTON_MARGIN_Y (int)(LCD_HEIGHT * 0.03) | 32 | #define BUTTON_MARGIN_Y (int)(LCD_HEIGHT * 0.03) |
33 | 33 | ||
34 | static bool touch_enabled = true; | ||
34 | static enum touchscreen_mode current_mode = TOUCHSCREEN_POINT; | 35 | static enum touchscreen_mode current_mode = TOUCHSCREEN_POINT; |
35 | static const int touchscreen_buttons[3][3] = | 36 | static const int touchscreen_buttons[3][3] = |
36 | { | 37 | { |
@@ -121,6 +122,8 @@ static void map_pixels(int *x, int *y) | |||
121 | /* TODO: add jitter (and others) filter */ | 122 | /* TODO: add jitter (and others) filter */ |
122 | int touchscreen_to_pixels(int x, int y, int *data) | 123 | int touchscreen_to_pixels(int x, int y, int *data) |
123 | { | 124 | { |
125 | if(!touch_enabled) | ||
126 | return 0; | ||
124 | x &= 0xFFFF; | 127 | x &= 0xFFFF; |
125 | y &= 0xFFFF; | 128 | y &= 0xFFFF; |
126 | 129 | ||
@@ -169,6 +172,19 @@ enum touchscreen_mode touchscreen_get_mode(void) | |||
169 | return current_mode; | 172 | return current_mode; |
170 | } | 173 | } |
171 | 174 | ||
175 | void touchscreen_enable(bool en) | ||
176 | { | ||
177 | if(en != touch_enabled) | ||
178 | { | ||
179 | touch_enabled = en; | ||
180 | touchscreen_enable_device(en); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | bool touchscreen_is_enabled(void) | ||
185 | { | ||
186 | return touch_enabled; | ||
187 | } | ||
172 | 188 | ||
173 | #if ((CONFIG_PLATFORM & PLATFORM_ANDROID) == 0) | 189 | #if ((CONFIG_PLATFORM & PLATFORM_ANDROID) == 0) |
174 | /* android has an API for this */ | 190 | /* android has an API for this */ |