Touch UI example


#1

Anyone have an example of a Touch/Graphical UI where someone can click on a button drawn on the screen, and fire off some code. This would be a fun extension to the T-Deck or any touch enabled display.

I’m thinking a tutorial for a remote control where you click on buttons and it fires off emails/wifi api calls/ or logging of sensor data might be fun. Or list out mp3s on your sdcard and play them. I got mp3s playing on the t-deck in the past, but the library wasn’t compatible with the one that uLisp uses. If memory served one used C++ style calls while the other was C.


#2

There is an example of a set of functions for working with the touch panel:

https://github.com/molnija2/uLisp-touchscreen-example


#3

Some headers and libraries need to be included.

#if defined(ESP32_2432S028R)

#if defined(touchscreen_support)

#include <SPI.h>
#include <TFT_Touch.h> // Touchscreen driver chip

#define XPT2046_IRQ 36
#define XPT2046_MOSI 32
#define XPT2046_MISO 39
#define XPT2046_CLK 25
#define XPT2046_CS 33
TFT_Touch tft_touch = TFT_Touch(XPT2046_CS, XPT2046_CLK, XPT2046_MOSI, XPT2046_MISO) ;

#endif // TOUCHSCREEN_DRIVERS
#endif // ESP32_2432S028R


#4

Oh, this is great!

It would be nice to add a library of common UI elements: Buttons (with a parameter of button text, and what function to fire off when pressed), a slider, radio button, check box, and perhaps some charts and graphs.


#5

Btw I got the touchscreen working on the t-deck, see this post for details.


#6

hasnOlife, thank you very much for the useful idea!