GUIslice  0.16.0
Embedded GUI in C
GUIslice_th.h
Go to the documentation of this file.
1 // Abstract touch handler (TH) class
2 // This is the abstract base class for creating specific touch handlers
3 // The touch handler performs the adaption in between the GUIslice framework and any touch driver
4 // The touch handler used is specified in the main program by calling gslc_InitTouchHandler(&touchHandler);
5 
7 
8 #ifndef _GUISLICE_TH_H_
9 #define _GUISLICE_TH_H_
10 
11 #include <Arduino.h>
12 
14 // Point x,y,z Class for usage in the touch handler
15 
16 class THPoint {
17  public:
18  THPoint(void);
19  THPoint(uint16_t x, uint16_t y, uint16_t z);
20 
21  bool operator==(THPoint);
22  bool operator!=(THPoint);
23 
24  uint16_t x, y, z;
25 };
26 
27 
29 // Abstract TouchHandler - you have to inherit this
30 
31 class TouchHandler {
32  public:
33  //in order to create a specific touch handler you have to write your own constructor
35 
36  void setSize(uint16_t _disp_xSize, uint16_t _disp_ySize);
37  void setCalibration(uint16_t ts_xMin, uint16_t ts_xMax, uint16_t ts_yMin, uint16_t ts_yMax);
38  //order of operations: map, swap, constraint, flip
39  void setSwapFlip(bool _swapXY,bool _flipX,bool _flipY);
40 
41  THPoint scale(THPoint pIn);
42 
43  //in order to create a specific touch handler you have to overwrite this methods
44  virtual void begin(void);
45  virtual THPoint getPoint(void);
46 
47 private:
48  //landscape perspective: x: width, y: heigth
49  uint16_t disp_xSize = 320;
50  uint16_t disp_ySize = 240;
51 
52  uint16_t ts_xMin = 0;
53  uint16_t ts_xMax = 4095;
54  uint16_t ts_yMin = 0;
55  uint16_t ts_yMax = 4095;
56 
57  bool swapXY = false;
58  bool flipX = false;
59  bool flipY = false;
60 };
61 
62 
63 
65 // init and set the touch handler
66 
69 
70 
71 #endif
uint16_t y
Definition: GUIslice_th.h:24
void gslc_InitTouchHandler(TouchHandler *pTHO)
Definition: GUIslice_th.cpp:107
bool operator==(THPoint)
Definition: GUIslice_th.cpp:24
uint16_t x
Definition: GUIslice_th.h:24
TouchHandler()
Definition: GUIslice_th.h:34
bool operator!=(THPoint)
Definition: GUIslice_th.cpp:28
uint16_t z
Definition: GUIslice_th.h:24
THPoint(void)
Definition: GUIslice_th.cpp:14
TouchHandler * gslc_getTouchHandler(void)
Definition: GUIslice_th.cpp:115
Definition: GUIslice_th.h:16
Definition: GUIslice_th.h:31