davetcc / tcMenu

Menu library for Arduino, mbed and ESP with designer UI and remote control capabilities.
https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/
Apache License 2.0
271 stars 25 forks source link

XPT2046 Touch screen control on other SPI bus #471

Open paulvk2 opened 1 month ago

paulvk2 commented 1 month ago

With the ESP32-2432S028 and other similar displays the touch control chip is on the second buss of the ESP32 but tcMenu has no options when the TFT and touch are on different bus.

davetcc commented 1 month ago

Need more information to understand what plugins you're using etc.

For example, the TFT-eSPI plugin uses the libraries internal interrogator, and therefore would be configured within that library. So does the BSP touch plugin.

The only other plugin is the ArduinoLibrary based plugin, I am assuming that. However, someone will need to determine how the plugin needs to change in order to pass in other than the default bus, is it in the variable definition, here in the plugin:

https://github.com/davetcc/tcMenu/blob/master/xmlPlugins/core-display/ArduinoTouchLibraryIntegration.xml#L58

paulvk2 commented 1 month ago

Using the XPT2046 and the example code that works with the library is `` // Touchscreen pins

define XPT2046_IRQ 36 // T_IRQ

define XPT2046_MOSI 32 // T_DIN

define XPT2046_MISO 39 // T_OUT

define XPT2046_CLK 25 // T_CLK

define XPT2046_CS 33 // T_CS

SPIClass touchscreenSPI = SPIClass(VSPI); XPT2046_Touchscreen touchscreen(XPT2046_CS, XPT2046_IRQ); `` So the option to fill in these details would be helpful This is for the CYD display (ESP32-2432S028) which has the touch IC on the forth spi bus VSPI they are very inexpensive and a number of sizes exist Regards Paul and thank you for such a quick reply.

paulvk2 commented 1 month ago

If you add GFX_Library_for_Arduino for the ESP devices as selection it will simplify things as many displays are preconfigured for use . In the PDQgraphicstest example are Arduino_GFX_databus.h , Arduino_GFX_dev_device.h , Arduino_GFX_display.h , Arduino_GFX_pins.h . Arduino_GFX_dev_device.h contains a large number of displays by uncommenting the used display the configuration is taken care of and in the TouchCalibration example touch.h just needs the GPIO numbers used Regards Paul