-
Notifications
You must be signed in to change notification settings - Fork 214
Configuring Touch for XPT2046
Overview > Configuring GUIslice > Touch >
-
For Arduino users:
- Touch mode selected by:
DRV_TOUCH_XPT2046_PS
- Library used:
XPT2046_TouchScreen.h
from PaulStoffregen/XPT2046_Touchscreen
- Touch mode selected by:
-
For STM32 users:
- Touch mode selected by:
DRV_TOUCH_XPT2046_STM
- Library used:
XPT2046_Touch.h
from rogerclarkmelbourne/Arduino_STM32
- Touch mode selected by:
The XPT2046 provides filtering and easy access to the raw touch readings. The software then is responsible for performing a remapping between the raw analog read values and the corresponding display coordinates.
- For TFT_eSPI users
- The TFT_eSPI library includes an integrated XPT2046 touch controller, but in this selected mode (
DRV_TOUCH_XPT2046_*
), we are going to use the XPT2046_TouchScreen library for the XPT2046 instead. Therefore, we need to ensure that we disable the TFT_eSPI's integrated touch controller. This is done by ensuring that the#define TOUCH_CS
line in the TFT_eSPI'sUser_Setup
config file has been commented out.
- The TFT_eSPI library includes an integrated XPT2046 touch controller, but in this selected mode (
With the XPT2046 touch driver, connectivity is provided via the SPI interface.
For STM32 users:
- On some devices (such as STM32), multiple hardware SPI interfaces may be available. In order to maximize compatibility, the SPI interface can be selected via the
XPT2046_DEFINE_DPICLASS
setting (documentation coming soon).
To configure the hardware SPI interface:
-
XPT2046_CS
: Selects the chip-select pin
The XPT2046 uses calibration settings that are specific to your display, described in the following configuration parameters:
ADATOUCH_X_MIN
ADATOUCH_X_MAX
ADATOUCH_Y_MIN
ADATOUCH_Y_MAX
In order to determine these calibration settings, please run the examples/arduino/diag_ard_touch_calib
sketch.
- Instructions: Running the Touch Calibration diagnostic
The touch sensitivity can be defined by the following parameters. In most cases the default setting can be used.
ADATOUCH_PRESS_MIN
ADATOUCH_PRESS_MAX
Run examples/arduino/diag_ard_touch_test
to assess whether the touch handling is operating correctly.
- Instructions: Running the Touch Test diagnostic