|
TinyGPU
|
Touch driver that reads through Bodmer's TFT_eSPI (https://github.com/Bodmer/TFT_eSPI) resistive touch support (TFT_eSPI::getTouch()) instead of one of this library's own touch controller drivers (TouchDriverXPT2046, ...) - the companion to DisplayDriverTFTeSPI, for a panel already wired up and calibrated through TFT_eSPI. More...
#include <TouchDriverTFTeSPI.h>


Public Member Functions | |
| TouchDriverTFTeSPI (TFT_eSPI &tft, uint16_t threshold=600) | |
| bool | begin () override |
| bool | isTouched () override |
| Return whether the panel currently appears touched. | |
| bool | getPoint (Point &outPoint) override |
| Read the current touch point. | |
Public Member Functions inherited from TouchDriver | |
| virtual | ~TouchDriver ()=default |
| virtual bool | begin ()=0 |
| Initialize the controller. | |
| virtual bool | isTouched ()=0 |
| Return whether the panel currently appears touched. | |
| virtual bool | getPoint (Point &outPoint)=0 |
| Read the current touch point. | |
| virtual bool | getSecondPoint (Point &outPoint) |
| Read a second, simultaneous touch point, for multi-touch gestures (pinch/rotate). | |
| void | setRotation (Rotation rotation) |
| Rotation | getRotation () const |
| bool | setCalibration (const CalibrationData &cal) |
| Set and validate calibration. | |
| const CalibrationData & | getCalibration () const |
| bool | hasCalibration () const |
Additional Inherited Members | |
Protected Member Functions inherited from TouchDriver | |
| Point | mapCoordinates (int16_t rawX, int16_t rawY, uint16_t pressure=255) const |
| Convert raw controller coordinates into logical display space. | |
Static Protected Member Functions inherited from TouchDriver | |
| static bool | validateCalibration (const CalibrationData &cal) |
| static int32_t | clamp32 (int32_t value, int32_t minimum, int32_t maximum) |
| Clamp an integer to an inclusive range. | |
| static int32_t | mapRange (int32_t value, int32_t inMin, int32_t inMax, int32_t outMin, int32_t outMax) |
| Map an integer from one range to another. | |
Protected Attributes inherited from TouchDriver | |
| Rotation | rotation_ = Rotation::Deg0 |
| CalibrationData | calibration_ |
| bool | hasCalibration_ = false |
Touch driver that reads through Bodmer's TFT_eSPI (https://github.com/Bodmer/TFT_eSPI) resistive touch support (TFT_eSPI::getTouch()) instead of one of this library's own touch controller drivers (TouchDriverXPT2046, ...) - the companion to DisplayDriverTFTeSPI, for a panel already wired up and calibrated through TFT_eSPI.
TFT_eSPI is a separate, optional Arduino library - install it alongside TinyGPU and #include <TinyGPU/Input/TouchDriverTFTeSPI.h> explicitly (this header is not pulled in by TinyGPU/Input/TouchDriver.h or TinyGPU.h) to opt in.
TFT_eSPI::getTouch() already returns calibrated, rotation-corrected screen-pixel coordinates (matching the display's current TFT_eSPI::setRotation()), so - like TouchDriverSDL - this driver has no use for TouchDriver's own CalibrationData/mapCoordinates() raw-ADC pipeline; leave setCalibration() unset. Calibration itself is entirely TFT_eSPI's job: call tft.setTouch(calData) with data from tft.calibrateTouch(...) (or a hardcoded panel-specific array) before using this driver, the same "driver does not own bus/calibration setup, the application does" division of responsibility TouchDriverArduino.h's drivers use for their own SPI/I2C buses.
Like every TouchDriver, isTouched() and getPoint() do not implicitly loop or block. isTouched() is where the actual TFT_eSPI::getTouch() read happens (and its result cached), so - as with this library's other touch drivers - call it exactly once per loop() iteration.
|
inlineexplicit |
Wraps an existing TFT_eSPI instance (ownership not taken - construct and keep it alive for as long as this driver is used, the same way DisplayDriverTFTeSPI takes its TFT_eSPI& rather than owning one). threshold is forwarded to TFT_eSPI::getTouch() as its pressure threshold (raw ADC units - see TFT_eSPI's own documentation for what your panel's controller considers a real touch).
|
inlineoverridevirtual |
No-op: TFT_eSPI itself is initialized (and touch-calibrated) by the application before constructing this driver - see class comment.
Implements TouchDriver.
|
inlineoverridevirtual |
Read the current touch point.
Implements TouchDriver.
|
inlineoverridevirtual |
Return whether the panel currently appears touched.
For controllers without an IRQ pin this may perform a controller read.
Implements TouchDriver.