|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
Container for touch point data and optional gesture information. More...
#include <TouchPoints.hpp>
Public Member Functions | |
| TouchPoints () | |
| Constructs an empty TouchPoints object. | |
| ~TouchPoints ()=default | |
| void | clear () |
| Clears all stored touch points and gesture. | |
| bool | addPoint (uint16_t x, uint16_t y, uint16_t pressure=0, uint8_t id=0, uint8_t event=0) |
| Adds a touch point to the container. | |
| void | setGesture (Gesture g) |
| Sets the gesture for this touch event. | |
| uint8_t | getPointCount () const |
| Returns the number of stored touch points. | |
| TouchPoint & | getPoint (uint8_t index) |
| Gets a reference to a touch point at the specified index. | |
| const TouchPoint & | getPoint (uint8_t index) const |
| Gets a constant reference to a touch point at the specified index. | |
| bool | hasPoints () const |
| Checks whether any touch points are stored. | |
| bool | hasGesture () const |
| Checks whether a gesture is stored. | |
| Gesture | getGesture () const |
| Returns the stored gesture. | |
| TouchPoint & | operator[] (uint8_t index) |
| const TouchPoint & | operator[] (uint8_t index) const |
| TouchPoint * | begin () |
| TouchPoint * | end () |
| const TouchPoint * | begin () const |
| const TouchPoint * | end () const |
Static Public Attributes | |
| static constexpr uint8_t | MAX_POINTS = 5 |
| Maximum number of touch points supported. | |
Container for touch point data and optional gesture information.
This class holds up to MAX_POINTS touch points and an optional gesture. It is designed to be filled by a touch driver and consumed by the application.
Definition at line 66 of file TouchPoints.hpp.
| TouchPoints::TouchPoints | ( | ) |
Constructs an empty TouchPoints object.
Definition at line 36 of file TouchPoints.cpp.
|
default |
| bool TouchPoints::addPoint | ( | uint16_t | x, |
| uint16_t | y, | ||
| uint16_t | pressure = 0, |
||
| uint8_t | id = 0, |
||
| uint8_t | event = 0 |
||
| ) |
Adds a touch point to the container.
| x | X coordinate of the touch point. |
| y | Y coordinate of the touch point. |
| pressure | Pressure value (default 0). |
| id | Touch point ID (default 0). |
| event | Event type (default 0). |
Definition at line 45 of file TouchPoints.cpp.
References TouchPoint::event, TouchPoint::id, MAX_POINTS, pressure(), TouchPoint::pressure, x, TouchPoint::x, y, and TouchPoint::y.
Referenced by TouchDrvCHSC5816::getTouchPoints(), TouchDrvCST226::getTouchPoints(), TouchDrvCST3530::getTouchPoints(), TouchDrvCST816::getTouchPoints(), TouchDrvCST92xx::getTouchPoints(), TouchDrvFT6X36::getTouchPoints(), TouchDrvGT911::getTouchPoints(), TouchDrvGT9895::getTouchPoints(), and TouchDrvHI8561::getTouchPoints().
|
inline |
Definition at line 158 of file TouchPoints.hpp.
|
inline |
Definition at line 166 of file TouchPoints.hpp.
| void TouchPoints::clear | ( | ) |
Clears all stored touch points and gesture.
Resets the object to its initial empty state.
Definition at line 38 of file TouchPoints.cpp.
References NONE.
Referenced by TouchDrvCHSC5816::getTouchPoints(), TouchDrvCST226::getTouchPoints(), TouchDrvCST3530::getTouchPoints(), TouchDrvCST816::getTouchPoints(), TouchDrvCST92xx::getTouchPoints(), TouchDrvFT6X36::getTouchPoints(), TouchDrvGT911::getTouchPoints(), TouchDrvGT9895::getTouchPoints(), and TouchDrvHI8561::getTouchPoints().
|
inline |
Definition at line 162 of file TouchPoints.hpp.
|
inline |
Definition at line 170 of file TouchPoints.hpp.
| Gesture TouchPoints::getGesture | ( | ) | const |
Returns the stored gesture.
Definition at line 93 of file TouchPoints.cpp.
| TouchPoint & TouchPoints::getPoint | ( | uint8_t | index | ) |
Gets a reference to a touch point at the specified index.
| index | The index of the touch point to retrieve. |
| A | reference to the touch point at the specified index. |
Definition at line 68 of file TouchPoints.cpp.
References SENSORLIB_LOG_E.
Referenced by TouchDrvInterface::getPoint(), TouchDrvCST92xx::getTouchPoints(), loop(), operator[](), operator[](), touch_drv_isr_handler(), and TouchDrvInterface::updateXY().
| const TouchPoint & TouchPoints::getPoint | ( | uint8_t | index | ) | const |
Gets a constant reference to a touch point at the specified index.
| index | The index of the touch point to retrieve. |
| A | constant reference to the touch point at the specified index. |
Definition at line 75 of file TouchPoints.cpp.
References SENSORLIB_LOG_E.
| uint8_t TouchPoints::getPointCount | ( | ) | const |
Returns the number of stored touch points.
Definition at line 63 of file TouchPoints.cpp.
Referenced by TouchDrvInterface::getPoint(), loop(), touch_drv_isr_handler(), and TouchDrvInterface::updateXY().
| bool TouchPoints::hasGesture | ( | ) | const |
Checks whether a gesture is stored.
Definition at line 88 of file TouchPoints.cpp.
| bool TouchPoints::hasPoints | ( | ) | const |
Checks whether any touch points are stored.
Definition at line 82 of file TouchPoints.cpp.
Referenced by TouchDrvInterface::getPoint(), TouchDrvInterface::isPressed(), loop(), and touch_drv_isr_handler().
|
inline |
Definition at line 149 of file TouchPoints.hpp.
References getPoint().
|
inline |
Definition at line 153 of file TouchPoints.hpp.
References getPoint().
| void TouchPoints::setGesture | ( | Gesture | g | ) |
Sets the gesture for this touch event.
| g | The gesture to set. |
Definition at line 57 of file TouchPoints.cpp.
|
staticconstexpr |
Maximum number of touch points supported.
Definition at line 70 of file TouchPoints.hpp.
Referenced by addPoint().