![]() |
TouchScreenAdapter v0.5.0
TouchScreenAdapter is a library providing a unified touchscreen API.
|
A lightweight abstract Abstract class for touch screen panels.
#include <TouchScreenAdapter.h>
Classes | |
struct | TouchPoint |
A consistent struct containing points X & Y plus Z as pressure. More... | |
Public Member Functions | |
void | setDisplayWidth (uint16_t widthPx) |
Set the native (non-rotated) display width (X) in pixels. More... | |
void | setDisplayHeight (uint16_t heightPx) |
Set the native (non-rotated) display height (Y) in pixels. More... | |
virtual TouchScreenAdapter::TouchPoint | getTouchPoint (void)=0 |
Get the TouchPoint object. More... | |
virtual TouchScreenAdapter::TouchPoint | getTouchPointRaw (void)=0 |
Get a TouchPoint struct containing raw values from the underlying library. More... | |
virtual bool | begin (void)=0 |
For compatibility with the Arduino library convention. More... | |
void | setRotation (uint8_t r) |
Set the rotation touch screen. More... | |
Protected Attributes | |
uint8_t | rotation = 0 |
The current rotation of the touch panel. Default is 0 (native orientation). | |
uint16_t | DISPLAY_WIDTH = 240 |
The non-rotated width of the display in pixels. | |
uint16_t | DISPLAY_HEIGHT = 320 |
The non-rotated height of the display in pixels. | |
uint16_t | displayWidth = DISPLAY_WIDTH |
The (optionally rotated) width of the display in pixels. | |
uint16_t | displayHeight = DISPLAY_HEIGHT |
The (optionally rotated) height of the display in pixels. | |
|
pure virtual |
For compatibility with the Arduino library convention.
Must be implemented (but can be empty) as some touch libraries require it. Can return a boolean to idicate if initialisation has failed.
Implemented in AdafruitFT6206TouchScreen, and AdafruitResistiveTouchScreen.
|
pure virtual |
Get the TouchPoint object.
Returns a TouchPoint. Display are x & y populated (ie non-zero) only if touched.
Implemented in AdafruitFT6206TouchScreen, and AdafruitResistiveTouchScreen.
|
pure virtual |
Get a TouchPoint struct containing raw values from the underlying library.
Returns a TouchPoint with raw x, y & z populated from the underlying library. For most panels this will usually return the same values as getTouchPoint() but can be useful for tuning resistive panels. Note: This will return a populated TouchPoint irrespective of the Z value. Generally used for setup or debugging.
Implemented in AdafruitFT6206TouchScreen, and AdafruitResistiveTouchScreen.
|
inline |
Set the native (non-rotated) display height (Y) in pixels.
Is set to 320 by default. For some adapters (resistive) this must be set to the native height of your display. For adapters that report pixel position directly, this is only used to reverse X or Y.
heightPx | Width in pixels |
|
inline |
Set the native (non-rotated) display width (X) in pixels.
Is set to 240 by default. For some adapters (resistive) this must be set to the native width of your display. For adapters that report pixel position directly, this is only reqired if X and/or Y need to be reversed. (Ahem, FT6206).
widthPx | Width in pixels |
|
inline |
Set the rotation touch screen.
This should be called at the same time the display rotation is set.
r | Follows the convention of:
|