|
TinyGPU
|
Base class for touch controllers. More...
#include <TouchDriverCommon.h>


Public Member Functions | |
| 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 |
Protected Member Functions | |
| 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 | |
| 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 | |
| Rotation | rotation_ = Rotation::Deg0 |
| CalibrationData | calibration_ |
| bool | hasCalibration_ = false |
Base class for touch controllers.
|
virtualdefault |
|
pure virtual |
Initialize the controller.
The driver does NOT initialize the SPI/I2C bus itself. The application is responsible for calling Wire.begin(), SPI.begin(), and configuring any board-specific bus pins.
Implemented in TouchDriverSTM32F723Discovery, TouchDriverXPT2046, TouchDriverBitBang, TouchDriverFT6236, TouchDriverCST816S, TouchDriverGT911, TouchDriverSDL, and TouchDriverTFTeSPI.
|
inlinestaticprotected |
Clamp an integer to an inclusive range.
|
inline |
|
pure virtual |
Read the current touch point.
Implemented in TouchDriverSTM32F723Discovery, TouchDriverXPT2046, TouchDriverBitBang, TouchDriverFT6236, TouchDriverCST816S, TouchDriverGT911, TouchDriverSDL, and TouchDriverTFTeSPI.
|
inline |
|
inlinevirtual |
Read a second, simultaneous touch point, for multi-touch gestures (pinch/rotate).
Returns false by default. Only override this if the underlying controller can genuinely report two simultaneous touches - none of the drivers built into this library can (XPT2046 is a resistive, inherently single-touch controller; CST816S/FT6236 are single-touch capacitive parts), so pinch/rotate gestures built on top of this will not fire against them.
Reimplemented in TouchDriverSTM32F723Discovery, and TouchDriverGT911.
|
inline |
|
pure virtual |
Return whether the panel currently appears touched.
For controllers without an IRQ pin this may perform a controller read.
Implemented in TouchDriverSTM32F723Discovery, TouchDriverXPT2046, TouchDriverBitBang, TouchDriverFT6236, TouchDriverCST816S, TouchDriverGT911, TouchDriverSDL, and TouchDriverTFTeSPI.
|
inlineprotected |
Convert raw controller coordinates into logical display space.
Processing order:
raw coordinates -> inversion -> independent X/Y calibration -> swap XY -> display rotation
This order is important. In particular, swapping raw X/Y before calibration would incorrectly apply the X calibration range to Y and vice versa.
|
inlinestaticprotected |
Map an integer from one range to another.
Unlike Arduino's map(), this function:
|
inline |
Set and validate calibration.
|
inline |
|
inlinestaticprotected |
|
protected |
|
protected |
|
protected |