1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

simplify touch handling in the Arduino example

This commit is contained in:
Gabor Kiss-Vamosi 2020-12-01 11:40:21 +01:00 committed by GitHub
parent 73f4156aad
commit e43d6da389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,26 +36,11 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
bool touched = tft.getTouch(&touchX, &touchY, 600);
if(!touched)
{
if(!touched) {
data->state = LV_INDEV_STATE_REL;
return false;
}
else
{
} else {
data->state = LV_INDEV_STATE_PR;
}
if(touchX>screenWidth || touchY > screenHeight)
{
Serial.println("Y or y outside of expected parameters..");
Serial.print("y:");
Serial.print(touchX);
Serial.print(" x:");
Serial.print(touchY);
}
else
{
/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;
@ -65,7 +50,6 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
Serial.print("Data y");
Serial.println(touchY);
}
return false; /*Return `false` because we are not buffering and no more data to read*/