Touch Interface
The touch component provides the shared TouchPoint, TouchState, TouchpadData, and ITouchDevice types used by ESPP touch controller drivers and BSPs.
It also provides the type-erasure helpers used to store any touch driver behind a single runtime handle:
espp::TouchDriverConcept— C++23 concept satisfied by any touch driver exposingupdate(),get_touch_point(), andget_home_button_state().espp::ITouchDriver— abstract type-erased interface backed by the concept.espp::TouchDriverAdapter<T>— concept-constrained adapter wrapping any concrete driver (e.g.Gt911orSt7123Touch) behindITouchDriver.espp::make_touch_driver(driver)— convenience factory returning astd::shared_ptr<ITouchDriver>.
API Reference
Header File
Classes
-
class ITouchDevice
Runtime interface implemented by touch controller drivers.
Subclassed by espp::Chsc6x, espp::Cst816, espp::Ft5x06, espp::Gt911, espp::Tt21100
Public Functions
-
virtual bool update(std::error_code &ec) = 0
Update the cached touch state from the hardware.
- Parameters:
ec – Error code to set if an error occurs.
- Returns:
True if the device reported new data, false otherwise.
-
virtual TouchState touch_state() const = 0
Get the cached touch state.
- Returns:
The cached touch state.
-
inline virtual bool has_home_button() const
Whether the controller exposes a touch-adjacent home button.
- Returns:
True if the controller exposes a home button, false otherwise.
-
inline uint8_t get_num_touch_points() const
Get the number of cached touch points.
- Returns:
The number of cached touch points.
-
inline void get_touch_point(uint8_t *num_touch_points, uint16_t *x, uint16_t *y) const
Get the primary cached touch point.
- Parameters:
num_touch_points – The number of touch points as of the last update.
x – The x coordinate of the primary touch point.
y – The y coordinate of the primary touch point.
-
inline uint8_t get_home_button_state() const
Get the cached home button state.
- Returns:
The cached home button state.
-
inline TouchpadData touchpad_data() const
Get the cached single-point touchpad view.
- Returns:
The primary touchpad view of the cached state.
-
virtual bool update(std::error_code &ec) = 0