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() { bool RA8876::initDisplay() {
lvgl_param = 10;
SPI.beginTransaction(m_spiSettings); SPI.beginTransaction(m_spiSettings);
// Set chip config register // Set chip config register

View File

@ -1,9 +1,9 @@
name=RA8876 name=RA8876
version=1.0.0 version=1.0.2
author=Jaret Burkett / Gerhard Mutz author=Jaret Burkett
maintainer=Gerhard Mutz maintainer=Jaret Burkett <jaretburkett@gmail.com>
sentence=Tasmota Library for RA8876 displays sentence=Library for RA8876 displays
paragraph=Tasmota Library for RA8876 displays paragraph=Library for RA8876 displays
category=Display category=Display
url=https://github.com/arendst/Tasmota url=https://github.com/jaretburkett/ILI9488
architectures=* 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) { 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; //lv_coord_t last_x = 0, last_y = 0;
//static uint8_t release_count = 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.x = Touch_Status(1); // Last-pressed coordinates
data->point.y = Touch_Status(2); data->point.y = Touch_Status(2);
data->state = Touch_Status(0); data->state = Touch_Status(0);
#endif
return false; /*No buffering now so no more data read*/ 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 * Touch panel control
\*********************************************************************************************/ \*********************************************************************************************/
#if defined(USE_FT5206) || defined(USE_XPT2046)
bool FT5206_found = false; bool FT5206_found = false;
bool XPT2046_found = false; bool XPT2046_found = false;
int16_t touch_xp; int16_t touch_xp;
int16_t touch_yp; int16_t touch_yp;
bool touched; 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 #ifdef USE_M5STACK_CORE2
uint8_t tbstate[3]; uint8_t tbstate[3];
#endif // USE_M5STACK_CORE2 #endif // USE_M5STACK_CORE2
@ -2747,21 +2765,7 @@ int16_t XPT2046_y() {
} }
#endif // USE_XPT2046 #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)) { void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) {