This touch screen input plugin supports both XPT2046 and FT6206 based touch screens. In order for this plugin to work correctly the right underlying library must be installed. These are described below:
When using this touch plugin, the concept of touching and holding touches is handled by the unit itself, even managing “repeat key” is handled by the library, based on which mode it is in.
You should note that this plugin can only be used with graphical display renderers. You can also read the IoAbstraction touch screen documentation as this support is based on that.
First, ensure your menu structure is saved and then choose Code -> Generate Code from the menu. Once the code generation dialog appears, you can click on the image below the input plugin selection, and you’ll see the two below options in the list:
Once you’ve chosen the touch screen plugin, you’ll need to configure the plugin for use, this includes choosing the right library and working out the correct rotation that aligns with your display, the easiest way to do this is to use the test sketch that’s packaged with IoAbstraction.
When you use this plugin, it will create a variable called
touchScreen on your behalf, it will be of type
MenuResistiveTouchScreen. It will be exported so that you can use it in your code.
To calibrate the touch screen, you can use our calibration “extra”, see the ESP32Amplifier example that shows how to use it.
touchScreen.calibrateMinMaxValues(float xmin, float xmax, float ymin, float ymax)
For each dimension, min and max are the minimum and maximum values possible in that dimension, BEFORE any rotation is applied.