fix lvgl touch

This commit is contained in:
gemu2015 2021-04-25 17:28:42 +02:00
parent b44c16d861
commit 1e230e1f2d
4 changed files with 30 additions and 25 deletions

View File

@ -481,6 +481,9 @@ void RA8876::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) {
}
bool RA8876::initDisplay() {
lvgl_param = 10;
SPI.beginTransaction(m_spiSettings);
// Set chip config register

View File

@ -1,9 +1,9 @@
name=RA8876
version=1.0.0
author=Jaret Burkett / Gerhard Mutz
maintainer=Gerhard Mutz
sentence=Tasmota Library for RA8876 displays
paragraph=Tasmota Library for RA8876 displays
version=1.0.2
author=Jaret Burkett
maintainer=Jaret Burkett <jaretburkett@gmail.com>
sentence=Library for RA8876 displays
paragraph=Library for RA8876 displays
category=Display
url=https://github.com/arendst/Tasmota
url=https://github.com/jaretburkett/ILI9488
architectures=*

View File

@ -29,11 +29,9 @@ uint32_t Touch_Status(uint32_t sel);
static bool touchscreen_read(struct _lv_indev_drv_t *indev_drv, lv_indev_data_t *data) {
//lv_coord_t last_x = 0, last_y = 0;
//static uint8_t release_count = 0;
#if defined(USE_FT5206) || defined(USE_XPT2046)
data->point.x = Touch_Status(1); // Last-pressed coordinates
data->point.y = Touch_Status(2);
data->state = Touch_Status(0);
#endif
return false; /*No buffering now so no more data read*/
}

View File

@ -2677,14 +2677,32 @@ void AddValue(uint8_t num,float fval) {
* Touch panel control
\*********************************************************************************************/
#if defined(USE_FT5206) || defined(USE_XPT2046)
bool FT5206_found = false;
bool XPT2046_found = false;
int16_t touch_xp;
int16_t touch_yp;
bool touched;
uint32_t Touch_Status(uint32_t sel) {
if (FT5206_found || XPT2046_found) {
switch (sel) {
case 0:
return touched;
case 1:
return touch_xp;
case 2:
return touch_yp;
}
return 0;
} else {
return 0;
}
}
#if defined(USE_FT5206) || defined(USE_XPT2046)
#ifdef USE_M5STACK_CORE2
uint8_t tbstate[3];
#endif // USE_M5STACK_CORE2
@ -2747,21 +2765,7 @@ int16_t XPT2046_y() {
}
#endif // USE_XPT2046
uint32_t Touch_Status(uint32_t sel) {
if (FT5206_found || XPT2046_found) {
switch (sel) {
case 0:
return touched;
case 1:
return touch_xp;
case 2:
return touch_yp;
}
return 0;
} else {
return 0;
}
}
void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) {