9#ifndef AdafruitResistiveTouchScreen_h
10#define AdafruitResistiveTouchScreen_h
13#ifdef _ADAFRUIT_TOUCHSCREEN_H_
17#include "TouchScreenAdapter.h"
52 touchscreen =
new TouchScreen(pinXPos, pinYPos, pinXNeg, pinYNeg, ohms);
72 TSPoint tsPoint = touchscreen->getPoint();
78 if ( tsPoint.z > (int16_t)minRawZ && tsPoint.z < (int16_t)maxRawZ
79 && tsPoint.x > (int16_t)minRawX && tsPoint.x < (int16_t)maxRawX
80 && tsPoint.y > (int16_t)minRawY && tsPoint.y < (int16_t)maxRawY ) {
81 touchpoint.
z = constrain(map(tsPoint.z, maxRawZ, minRawZ, 1, 255), 1, 255);
82 uint16_t x =
rotation % 2 ? tsPoint.y : tsPoint.x;
83 uint16_t y =
rotation % 2 ? tsPoint.x : tsPoint.y;
109 TSPoint tsPoint = touchscreen->getPoint();
111 touchpoint.
x = tsPoint.x;
112 touchpoint.
y = tsPoint.y;
113 touchpoint.
z = tsPoint.z;
178 TouchScreen *touchscreen =
nullptr;
180 uint16_t minRawY = 100;
181 uint16_t maxRawY = 900;
182 uint16_t minRawX = 100;
183 uint16_t maxRawX = 900;
184 uint16_t minRawZ = 1;
185 uint16_t maxRawZ = 1023;
186 uint8_t zThreshold = 10;
Concrete implementation of TouchScreenAdapter for Adafruit's resistive TouchScreen class.
Definition: AdafruitResistiveTouchScreen.h:31
bool begin(void)
Empty begin() implementation.
Definition: AdafruitResistiveTouchScreen.h:123
TouchScreenAdapter::TouchPoint getTouchPointRaw(void)
Get the raw TouchPoint struct.
Definition: AdafruitResistiveTouchScreen.h:108
void setMaxRawX(uint16_t limit)
Set the maximum raw X value.
Definition: AdafruitResistiveTouchScreen.h:149
void setMaxRawZ(uint16_t limit)
Set the maximum raw Z value.
Definition: AdafruitResistiveTouchScreen.h:170
void setMaxRawY(uint16_t limit)
Set the maximum raw Y value.
Definition: AdafruitResistiveTouchScreen.h:156
void setMinRawY(uint16_t limit)
Set the minimun raw Y value.
Definition: AdafruitResistiveTouchScreen.h:135
~AdafruitResistiveTouchScreen()
Destroy the AdafruitResistiveTouchScreen object.
Definition: AdafruitResistiveTouchScreen.h:59
void setMinRawZ(uint16_t limit)
Set the maximum raw Z value.
Definition: AdafruitResistiveTouchScreen.h:163
void setMinRawX(uint16_t limit)
Set the minimun raw X value.
Definition: AdafruitResistiveTouchScreen.h:142
TouchScreenAdapter::TouchPoint getTouchPoint(void)
Get the TouchPoint struct.
Definition: AdafruitResistiveTouchScreen.h:71
AdafruitResistiveTouchScreen(uint8_t pinXPos, uint8_t pinYPos, uint8_t pinXNeg, uint8_t pinYNeg, uint16_t ohms=300, uint16_t displayWidth=240, uint16_t displayHeight=320)
Construct a new Resistive Touch Screen object.
Definition: AdafruitResistiveTouchScreen.h:46
A lightweight abstract Abstract class for touch screen panels.
Definition: TouchScreenAdapter.h:19
uint16_t displayHeight
The (optionally rotated) height of the display in pixels.
Definition: TouchScreenAdapter.h:162
uint16_t displayWidth
The (optionally rotated) width of the display in pixels.
Definition: TouchScreenAdapter.h:161
uint8_t rotation
The current rotation of the touch panel. Default is 0 (native orientation).
Definition: TouchScreenAdapter.h:156
uint16_t DISPLAY_HEIGHT
The non-rotated height of the display in pixels.
Definition: TouchScreenAdapter.h:159
uint16_t DISPLAY_WIDTH
The non-rotated width of the display in pixels.
Definition: TouchScreenAdapter.h:158
A consistent struct containing points X & Y plus Z as pressure.
Definition: TouchScreenAdapter.h:27
uint16_t x
Mapped 0 to screen width -1.
Definition: TouchScreenAdapter.h:47
uint16_t y
Mapped 0 to screen height -1.
Definition: TouchScreenAdapter.h:48
uint16_t z
Mapped 0-255 representing pressure (0 = not touched). is uint16_t because raw is odten > 255.
Definition: TouchScreenAdapter.h:49