Use TFT_eSPI instance created with `lv_tft_espi_create` for input device


I want to use the TFT_eSPI instance created by calling lv_tft_espi_create for my input driver.

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


What LVGL version are you using?


What do you want to achieve?

Touch controller configured with minimal additional setup or libraries

What have you tried so far?

The create TFT_eSPI instance is stored driver_data in lv_display_set_driver_data, however there is no public access to the instance that I have found so far

Code to reproduce

void my_touchpad_read(lv_indev_t *indev, lv_indev_data_t *data)

  TFT_eSPI *tft = lv_get_tft_espi_instance(disp);
  uint16_t x, y;
  bool touched = tft->getTouch(&x, &y);

  if (!touched)
    data->state = LV_INDEV_STATE_RELEASED;
    data->state = LV_INDEV_STATE_PRESSED;

    data->point.x = x;
    data->point.y = y;

Thank you in advance for any assistance or information!