Display class for TFT_eSPI touch screens.
More...
#include <TFT_eSPITouch.h>
|
static TFT_eSPITouch * | create (int displayId) |
| Static method to enable the compiler to generate create commands from myDevices.h entries.
|
|
|
InputAction | _debounceOrHeld (InputAction currentAction) |
| Call this from the derived class' check() method to debounce and detect if the input is a hold vs. press.
|
|
InputAction | _calculateInputAction (int touchX, int touchY, int displayWidth, int displayHeight) |
| This method is designed to take an input from a touch screen display and determine which "button" has been touched according to the coordinates of the touch. This assumes the touch screen has been calibrated correctly.
|
|
CallbackInterface * | _callback = nullptr |
| Pointer to the instance for callbacks Must implement updateScreen() and onInputAction() methods.
|
|
Logger * | _logger = nullptr |
| Pointer to the Logger instance for derived classes to use.
|
|
bool | _isCalibrating = false |
| Flag if the input interface is undergoing calibration - needed for touch screens.
|
|
int | _needsDisplay = -1 |
| Display ID if this input interface requires a display instance - needed for TFT_eSPI as it shares the instance.
|
|
DisplayInterface * | _display = nullptr |
| Pointer to the DisplayInterface if this input requires it.
|
|
unsigned long | _lastDebounceTime = 0 |
| Time of the last debounce.
|
|
unsigned long | _debounceDelay = 50 |
| Inputs must remain constant for this amount of time to be valid.
|
|
unsigned long | _holdThreshold = 500 |
| Inputs constant for longer than this threshold change from PRESS to HOLD.
|
|
InputAction | _lastAction = InputAction::PRESS_NONE |
| Set initial InputAction for comparisons in determining debounce or hold.
|
|
bool | _isHolding = false |
| Flag to help determining if input is held.
|
|
bool | _forceCalibration = false |
| Flag to force calibration for touch screens if it's required.
|
|
Display class for TFT_eSPI touch screens.
◆ TFT_eSPITouch()
TFT_eSPITouch::TFT_eSPITouch |
( |
int |
displayId | ) |
|
Constructor for the TFT_eSPITouch instance.
- Parameters
-
displayId | ID of the display to retrieve the TFT_eSPI instance from |
◆ _calibrated()
bool TFT_eSPITouch::_calibrated |
( |
| ) |
|
|
private |
Test if valid calibration data is available for this touch interface.
- Returns
- true|false
◆ _displayCalibrationError()
Display calibration error on screen and pause for 5 seconds.
- Parameters
-
◆ _doCalibration()
bool TFT_eSPITouch::_doCalibration |
( |
| ) |
|
|
private |
Run the TFT_eSPI calibration sequence.
- Returns
- true if successful and saved, otherwise false
◆ _setupSPIFFS()
bool TFT_eSPITouch::_setupSPIFFS |
( |
| ) |
|
|
private |
Ensure SPIFFS filesystem is up and running.
- Returns
- true|false
◆ begin()
void TFT_eSPITouch::begin |
( |
| ) |
|
|
overridevirtual |
Perform any initial once off setup or configuration here and call only once.
Implements InputInterface.
◆ check()
void TFT_eSPITouch::check |
( |
| ) |
|
|
overridevirtual |
Call this method at least once per main loop to monitor for input actions Any actions should call the callback set in the _callback attribute.
Implements InputInterface.
◆ create()
Static method to enable the compiler to generate create commands from myDevices.h entries.
- Parameters
-
displayId | ID of the display to retrieve the TFT_eSPI instance from |
- Returns
- Pointer to the new TFT_eSPITouch instance
◆ _calibrationFile
const char TFT_eSPITouch::_calibrationFile[20] |
|
private |
◆ _tft
TFT_eSPI* TFT_eSPITouch::_tft |
|
private |
The documentation for this class was generated from the following files: