lv_arduino+ESP32+Parallel-Interface-Display Touch is Not Working

Hi
lv_arduino+ESP32+SPi Display + TFT-eSPI, everything is working perfect, specially ESP32_TFT_eSPI_Slider with Night Theme.
But, I wanna use this library with Parallel Interface display, it’s lot faster then SPI,
but I’m getting this error

TFT_eSPI’ has no member named ‘getTouch’

Please help me, to use this beautiful Library.
Thank you in advance

Please fill the template to provide enough information to investigate your issue.

> ## Important: posts that do not use this template will be ignored or closed.
>
> ## Before posting
> - Get familiar with [Markdown](https://forum.lvgl.io/t/get-familiar-with-markdown/403) to format and structure your post
> - Be sure to update [lvgl](https://github.com/littlevgl/lvgl) from the latest version from the `master` branch.
> - Be sure you have checked the relevant part of the [documentation](https://docs.littlevgl.com/en/html/index.html). **We will not respond in detail to posts where you haven't read the relevant documentation.**
> - If applicable use the [Simulator](https://docs.littlevgl.com/en/html/get-started/pc-simulator.html) to eliminate hardware related issues.
> 
>  *Delete this section if you read and applied the mentioned points.*
  
## Description

###  What MCU/Processor/Board and compiler are you using?

###  What do you want to achieve?

### What have you tried so far?

## Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:
```c
/*You code here*/
```

The error is coming from the bodmer TFT_espi lib. You haven’t specified the TFT chip select.

See the TFT_espi docs or Google them.

Regards

Ok
I’m sorry, Let me be more specific.
I’m using WEMOS LOLIN 32 with ILI9488,
When I’m connecting WEMOS LOLIN 32 with ILI9488 SPI interface, I have no problem testing
lv_arduino Examples, everything works fine, but when I’m connecting WEMOS LOLIN 32 with ILI9488
with parallel connection

This is from TFT-eSPI User_Setup.h

//============ The ESP32 and TFT PARALLEL Connection pins============//

//#define ESP32_PARALLEL

//#define TFT_CS 33 // Chip select control pin (library pulls permanently low
//#define TFT_DC 15 // Data Command control pin - use a pin in the range 0-31
//#define TFT_RST 32 // Reset pin, toggles on startup
//#define TFT_WR 4 // Write strobe control pin - use a pin in the range 0-31
//#define TFT_RD 32 // Read strobe control pin - use a pin in the range 0-31
//#define TFT_D0 12 // Must use pins in the range 0-31 for the data bus
//#define TFT_D1 13 // so a single register write sets/clears all bits.
//#define TFT_D2 26 // Pins can be randomly assigned, this does not affect
//#define TFT_D3 25 // TFT screen update performance.
//#define TFT_D4 19 //17
//#define TFT_D5 23 //16
//#define TFT_D6 27
//#define TFT_D7 14

I’m getting this error

TFT_eSPI’ has no member named ‘getTouch’

so
what I notice it, in parallel connection
//#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen
is missing, maybe this is the cause for error.
Please, tell me, if can do anything to fix this?
or only option is, to ask Bodmer, for the fix?
Thank you

It’s likely that the problem is on your end, especially if this library works with other parallel displays.

This does not work on standard drivers of littlevgl, You have to modify the library to make it work. I never tried this so goodluck with the modification.

Hi embeddedt
Thank you for reply,Please, tell me what other displays you’re talking about, and they’re working with lv_arduino?
Thank you again

I don’t know anything about the specific library that you’re using. :slightly_smiling_face: What I’m saying is that if TFT_eSPI supports other parallel displays, then the issue is probably with your driver and not the library itself.

Your tftrd and tftrst have the same value. Tftrd should be pin 2.

Hi Ferdz_Reyes
Thank you for reply,
First your project is Unbelievable !!!, good job.
second, thank you for pin correction.
and the last, please tell me, if you’re use lv_arduino, for your project?

Thanks.
Yes i am using the arduino ide.

Perfect.
If possible and if you have a time, please help me with this.
With lv_arduino(1.0) I able to use Capacitive Touch 3.5" screen/ILI9488 with FT6206.
Here is example code:

#include <lvgl.h>
#include <SPI.h>
#include <Ticker.h>
#include <TFT_eSPI.h>
#include <Adafruit_FT6206.h>
#include <OneWire.h>
#include <Wire.h>
#define BL 18
#define LVGL_TICK_PERIOD 20

Ticker tick; /* timer for interrupt handler */
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */;

Adafruit_FT6206 ts = Adafruit_FT6206();

void my_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t *color_array)
{

   /*TODO copy 'color_array' to the specifed coordinats of your disaply.*/
  //tft.changeMode(GRAPHIC);//first we swith in graphic mode
   int32_t x;
   int32_t y;
    for(y = y1; y <= y2; y++) {
        for(x = x1; x <= x2; x++) {
            /* Put a pixel to the display. For example: */
            /* put_px(x, y, *color_p)*/
            tft.drawPixel(x, y, color_array->full);
            color_array++;
        }
    }

    /* IMPORTANT!!!
     * Inform the graphics library that you are ready with the flushing*/
    lv_flush_ready();
}


bool my_tp_read(lv_indev_data_t *data)
{
  /*
  uint16_t tx, ty;
  if (tft.touchDetect()){
    tft.touchReadPixel(&tx, &ty);//read directly in pixel!
        tx=tx;ty=ty;
    Serial.print("x: " );
    Serial.print(tx);
    Serial.print("   y: " );
    Serial.println(ty);
  } */

  
  //bool tp_is_pressed = false; /*TODO read here the state of toush pad*/
  //if (tft.touchDetect()) {
  if (ts.touched()) {
    
    uint16_t last_x = 0;
    uint16_t last_y = 0;
    //tft.touchReadPixel(&last_x, &last_y);
    TS_Point p = ts.getPoint();
//   last_x = last_x;
//   last_y = last_y;
//    data->point.x = (int16_t)last_x;
//    data->point.y = (int16_t)last_y;

      p.x = map(p.x, 0, 320, 320, 0);
      p.y = map(p.y, 0, 480, 480, 0);


    data->point.x = p.y;
    data->point.y = tft.height() - p.x;

    data->state = LV_INDEV_STATE_PR;
  } else data->state = LV_INDEV_STATE_REL;
  return false;       /*Return false because no moare to be read*/
}

void hal_init(void)
{
    /*Initialize the display*/
    lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv); 
    disp_drv.disp_flush = my_disp_flush;
    lv_disp_drv_register(&disp_drv);

    
    /*Initialize the touch pad*/
    lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&indev_drv); 
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read = my_tp_read;
    lv_indev_drv_register(&indev_drv);

    /*Initialize the graphics library's tick*/
    /*In a Timer call 'lv_tick_inc(1)' in every milliseconds
      Or no other option call it loop */
}

void setup() {
  
  Serial.begin(115200);
  Serial.println("RA8875 start");
  //initialization routine
  tft.begin(); /* TFT init */
  pinMode(BL, OUTPUT);
  digitalWrite(BL, HIGH);
  if (!ts.begin(40)) { 
    Serial.println("Unable to start touchscreen.");
  } 
  else { 
    Serial.println("Touchscreen started."); 
  }
  
  tft.setRotation(3); /* Landscape orientation */

  Wire.begin();
  
  lv_init();

  hal_init();
 
}

void loop() {
  // put your main code here, to run repeatedly:
  printSplash();
  while (true) {
    lv_task_handler();
    lv_tick_inc(5);  // is not called in a Timer then call it here*/
    delay(0);             /*Wait a little*/
  }
}

void printSplash(void) {
/*  lv_obj_t *label = lv_label_create(lv_scr_act(), NULL);
  lv_label_set_text(label, "Hello Arduino!");
  lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
*/  

/********************
     * CREATE A SCREEN
     *******************/
    /* Create a new screen and load it
     * Screen can be created from any type object type
     * Now a Page is used which is an objects with scrollable content*/
    lv_obj_t * scr = lv_page_create(NULL, NULL);
    lv_scr_load(scr);

    /****************
     * ADD A TITLE
     ****************/
    lv_obj_t * label = lv_label_create(scr, NULL); /*First parameters (scr) is the parent*/
    lv_label_set_text(label, "Object usage demo");  /*Set the text*/
    lv_obj_set_x(label, 50);                        /*Set the x coordinate*/

    /***********************
     * CREATE TWO BUTTONS
     ***********************/
    /*Create a button*/
    lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL);         /*Create a button on the currently loaded screen*/
    lv_btn_set_action(btn1, LV_BTN_ACTION_CLICK, btn_rel_action); /*Set function to be called when the button is released*/
    lv_obj_align(btn1, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 20);  /*Align below the label*/

    /*Create a label on the button (the 'label' variable can be reused)*/
    label = lv_label_create(btn1, NULL);
    lv_label_set_text(label, "Button 1");

    /*Copy the previous button*/
    lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), btn1);        /*Second parameter is an object to copy*/
    lv_obj_align(btn2, btn1, LV_ALIGN_OUT_RIGHT_MID, 50, 0);    /*Align next to the prev. button.*/

    /*Create a label on the button*/
    label = lv_label_create(btn2, NULL);
    lv_label_set_text(label, "Button 2");

    /****************
     * ADD A SLIDER
     ****************/
    lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);                            /*Create a slider*/
    lv_obj_set_size(slider, lv_obj_get_width(lv_scr_act())  / 3, LV_DPI / 3);   /*Set the size*/
    lv_obj_align(slider, btn1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 20);                /*Align below the first button*/
    lv_slider_set_value(slider, 30);                                            /*Set the current value*/

    /***********************
     * ADD A DROP DOWN LIST
     ************************/
    lv_obj_t * ddlist = lv_ddlist_create(lv_scr_act(), NULL);            /*Create a drop down list*/
    //lv_obj_set_size(ddlist, 100, 50);   /*Set the size*/
    lv_obj_align(ddlist, slider, LV_ALIGN_OUT_RIGHT_TOP, 50, 0);         /*Align next to the slider*/
    lv_obj_set_free_ptr(ddlist, slider);                                   /*Save the pointer of the slider in the ddlist (used in 'ddlist_action()')*/
    lv_obj_set_top(ddlist, true);                                        /*Enable to be on the top when clicked*/
    lv_ddlist_set_options(ddlist, "None\nLittle\nHalf\nA lot\nAll"); /*Set the options*/
    lv_ddlist_set_action(ddlist, ddlist_action);                         /*Set function to call on new option is chosen*/

    /****************
     * CREATE A CHART
     ****************/
    lv_obj_t * chart = lv_chart_create(lv_scr_act(), NULL);                         /*Create the chart*/
    lv_obj_set_size(chart, lv_obj_get_width(scr) / 2, lv_obj_get_width(scr) / 4);   /*Set the size*/
    lv_obj_align(chart, slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 50);                   /*Align below the slider*/
    lv_chart_set_series_width(chart, 3);                                            /*Set the line width*/

    /*Add a RED data series and set some points*/
    lv_chart_series_t * dl1 = lv_chart_add_series(chart, LV_COLOR_RED);
    lv_chart_set_next(chart, dl1, 10);
    lv_chart_set_next(chart, dl1, 25);
    lv_chart_set_next(chart, dl1, 45);
    lv_chart_set_next(chart, dl1, 80);

    /*Add a BLUE data series and set some points*/
    lv_chart_series_t * dl2 = lv_chart_add_series(chart, LV_COLOR_MAKE(0x40, 0x70, 0xC0));
    lv_chart_set_next(chart, dl2, 10);
    lv_chart_set_next(chart, dl2, 25);
    lv_chart_set_next(chart, dl2, 45);
    lv_chart_set_next(chart, dl2, 80);
    lv_chart_set_next(chart, dl2, 75);
    lv_chart_set_next(chart, dl2, 505);
}


/**
 * Called when a button is released
 * @param btn pointer to the released button
 * @return LV_RES_OK because the object is not deleted in this function
 */
static  lv_res_t btn_rel_action(lv_obj_t * btn)
{
    /*Increase the button width*/
    lv_coord_t width = lv_obj_get_width(btn);
    lv_obj_set_width(btn, width);
Serial.println("Button released");
    return LV_RES_OK;
}

/**
 * Called when a new option is chosen in the drop down list
 * @param ddlist pointer to the drop down list
 * @return LV_RES_OK because the object is not deleted in this function
 */
static  lv_res_t ddlist_action(lv_obj_t * ddlist)
{
    uint16_t opt = lv_ddlist_get_selected(ddlist);      /*Get the id of selected option*/

    //lv_obj_t * slider = lv_obj_get_free_ptr(ddlist);      /*Get the saved slider*/
    lv_obj_t * slider = (lv_obj_t *) lv_obj_get_free_ptr(ddlist);
    lv_slider_set_value(slider, (opt * 100) / 4);       /*Modify the slider value according to the selection*/

    return LV_RES_OK;
}

But, with lv_arduino(6.0), when I’m trying to compile ESP32_TFT_eSPI_Slider
I’m getting this error
‘touched’ was not declared in this scope

Thank you

youre missing an asterisk

@momosh13 In the future, please format your code using standard Markdown code blocks (```c and ```). It will make it much easier for us to read your code.

OK
Let me ask you this,
From your project picture, I can see the screen is resistive Touch screen, you think, you can help me,
to convert, let say ESP32_TFT_eSPI_Slide example, with Capacitive touch/FT6206 driver, with Adafruit Library?
Thank you

I have not worked with a touch screen with that driver. That would be hard.
Based from my experience using examples from github i disabled a couple of lines ( the calibration line i think) to make the examples work for mine.

Ok
Thank you very much for all your replys