discoverpixy
touch.h
Go to the documentation of this file.
1 #ifndef TOUCH_H
2 #define TOUCH_H
3 
4 #include<stdbool.h>
5 #include<stdint.h>
6 
17 
21 typedef enum {
24 } TOUCH_STATE ;
25 
30 typedef enum {
31  NONE=0x00,
32  PEN_DOWN=0x01,
33  PEN_UP=0x02,
34  PEN_ENTER=0x04,
35  PEN_LEAVE=0x08,
36  PEN_MOVE=0x10
37 } TOUCH_ACTION;
38 
45 typedef void (*TOUCH_CALLBACK)(void* touchArea, TOUCH_ACTION triggeredAction);
46 
50 typedef struct {
52  uint16_t x1;
53  uint16_t y1;
54  uint16_t x2;
55  uint16_t y2;
57  uint8_t flags;
59 
60 
64 typedef struct {
65  uint16_t x;
66  uint16_t y;
67 } POINT_STRUCT;
68 
74 bool touch_init();
75 
85 bool touch_add_raw_event(uint16_t x, uint16_t y,TOUCH_STATE state);
86 
92 bool touch_have_empty(unsigned char num);
93 
100 
106 
112 
120 void touch_set_calibration_values(int xs, int dx, int ys, int dy);
121 
122 
128 
131 #endif /* TOUCH_H */
TOUCH_ACTION
Definition: touch.h:30
bool touch_register_area(TOUCH_AREA_STRUCT *area)
Definition: touch.c:167
Receive an event when the pen moves inside the region (pen is down)
Definition: touch.h:36
Receive an event when the pen goes down inside the region.
Definition: touch.h:32
void(* TOUCH_CALLBACK)(void *touchArea, TOUCH_ACTION triggeredAction)
Definition: touch.h:45
Receive an event when the pen goes up inside the region.
Definition: touch.h:33
uint16_t y1
Top Left Y-Coordinate of Area.
Definition: touch.h:53
uint16_t y
The Y-Coordinate of the point.
Definition: touch.h:66
uint8_t flags
For internal use, don't change, don't initialize.
Definition: touch.h:57
uint16_t x
The X-Coordinate of the point.
Definition: touch.h:65
uint16_t x1
Top Left X-Coordinate of Area.
Definition: touch.h:52
void touch_unregister_area(TOUCH_AREA_STRUCT *area)
Definition: touch.c:182
Definition: touch.h:50
bool touch_add_raw_event(uint16_t x, uint16_t y, TOUCH_STATE state)
Definition: touch.c:52
uint16_t y2
Bottom Right Y-Coordinate of Area.
Definition: touch.h:55
The display is currently not touched.
Definition: touch.h:22
The display is currently touched at some point.
Definition: touch.h:23
static enum @0 state
TOUCH_CALLBACK callback
Callback which is executed when an event occurred in this Area.
Definition: touch.h:56
void touch_set_value_convert_mode(bool use_calibration)
Definition: touch.c:47
uint16_t x2
Bottom Right X-Coordinate of Area.
Definition: touch.h:54
Receive an event when the pen enters the region (pen was down before)
Definition: touch.h:34
POINT_STRUCT touch_get_last_point()
Definition: touch.c:198
bool use_calibration
Definition: touch.c:25
TOUCH_ACTION hookedActions
Actions to listen to.
Definition: touch.h:51
Definition: touch.h:64
TOUCH_STATE
Definition: touch.h:21
bool touch_have_empty(unsigned char num)
Definition: touch.c:156
Do not receive any events.
Definition: touch.h:31
void touch_set_calibration_values(int xs, int dx, int ys, int dy)
Definition: touch.c:34
bool touch_init()
Definition: touch.c:43
Receive an event when the pen leaves the region (pen was inside region before)
Definition: touch.h:35