try to fix the coordinates returned by touch events

This commit is contained in:
Amy Bowersox 2019-12-11 12:31:32 -07:00
parent 46213020dd
commit a62364082a
1 changed files with 5 additions and 2 deletions

View File

@ -11,6 +11,7 @@
#include "log.h"
#include "msg_queue.h"
#include "gpio.h"
#include "fbinit.h"
#include "time_func.h"
#define INPUT_EVENT_BATCH 16 /* number of events to retrieve from touchscreen at once */
@ -130,10 +131,12 @@ static BOOL poll_touchscreen(void)
break;
case EV_ABS:
/* Note that the touchscreen driver assumes the screen is "vertical," so swap the x and y axes */
/* Also it thinks origin is lower left with up = +y */
if (buffer[i].code == ABS_X)
touch_x = buffer[i].value;
touch_y = Fb_Info->height - buffer[i].value;
else if (buffer[i].code == ABS_Y)
touch_y = buffer[i].value;
touch_x = buffer[i].value;
break;
case EV_KEY: