discoverpixy
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
touch.h
Go to the documentation of this file.
1 /**************************************************************************************************************************************
2 * Project: discoverpixy
3 * Website: https://github.com/t-moe/discoverpixy
4 * Authors: Aaron Schmocker, Timo Lang
5 * Institution: BFH Bern University of Applied Sciences
6 * File: common/touch/touch.h
7 *
8 * Version History:
9 * Date Autor Email SHA Changes
10 * 2015-04-03 timolang@gmail.com 51089aa Refactored Project Structure for use with emulator
11 * 2015-04-27 timolang@gmail.com 259d446 Added touch support to emulator. Implemented basic touch function.
12 * 2015-04-27 timolang@gmail.com cf72baa Introduced a Screen (sub) module and divided app into multiple screens.
13 * 2015-05-02 timolang@gmail.com 3281616 Added some more touch functions. Improved pixy test. Drag the Image around!
14 * 2015-05-11 timolang@gmail.com a175a2f Added doxygen docu for touch module
15 * 2015-05-11 timolang@gmail.com 08d9fe0 More work on doxygen module structure
16 * 2015-05-12 timolang@gmail.com 1402598 Added doxygen stuff for button module and some minor changes to touch, screen_main and tft module.
17 * 2015-05-15 timolang@gmail.com 9a16865 Added doxgen comments to filesyste, checkbox, numupdown and screen module. And some minor changes to the other modules.
18 * 2015-06-01 timolang@gmail.com 06227da Added calibrate screen (WIP). fixed bug in emulator drawing.
19 * 2015-06-01 timolang@gmail.com eb573bc Finalized calibration. Fixed a bug in screen module.
20 *
21 **************************************************************************************************************************************/
22 
23 #ifndef TOUCH_H
24 #define TOUCH_H
25 
26 #include<stdbool.h>
27 #include<stdint.h>
28 
39 
43 typedef enum {
46 } TOUCH_STATE ;
47 
52 typedef enum {
53  NONE = 0x00,
54  PEN_DOWN = 0x01,
55  PEN_UP = 0x02,
56  PEN_ENTER = 0x04,
57  PEN_LEAVE = 0x08,
58  PEN_MOVE = 0x10
59 } TOUCH_ACTION;
60 
67 typedef void (*TOUCH_CALLBACK)(void* touchArea, TOUCH_ACTION triggeredAction);
68 
72 typedef struct {
74  uint16_t x1;
75  uint16_t y1;
76  uint16_t x2;
77  uint16_t y2;
79  uint8_t flags;
81 
82 
86 typedef struct {
87  uint16_t x;
88  uint16_t y;
89 } POINT_STRUCT;
90 
96 bool touch_init();
97 
107 bool touch_add_raw_event(uint16_t x, uint16_t y, TOUCH_STATE state);
108 
114 bool touch_have_empty(unsigned char num);
115 
122 
128 
134 
142 void touch_set_calibration_values(int xs, int dx, int ys, int dy);
143 
144 
150 
153 #endif /* TOUCH_H */
TOUCH_ACTION
Definition: touch.h:52
bool touch_register_area(TOUCH_AREA_STRUCT *area)
Definition: touch.c:181
Receive an event when the pen moves inside the region (pen is down)
Definition: touch.h:58
Receive an event when the pen goes down inside the region.
Definition: touch.h:54
void(* TOUCH_CALLBACK)(void *touchArea, TOUCH_ACTION triggeredAction)
Definition: touch.h:67
Receive an event when the pen goes up inside the region.
Definition: touch.h:55
uint16_t y1
Top Left Y-Coordinate of Area.
Definition: touch.h:75
uint16_t y
The Y-Coordinate of the point.
Definition: touch.h:88
uint8_t flags
For internal use, don't change, don't initialize.
Definition: touch.h:79
uint16_t x
The X-Coordinate of the point.
Definition: touch.h:87
uint16_t x1
Top Left X-Coordinate of Area.
Definition: touch.h:74
void touch_unregister_area(TOUCH_AREA_STRUCT *area)
Definition: touch.c:195
bool touch_add_raw_event(uint16_t x, uint16_t y, TOUCH_STATE state)
Definition: touch.c:72
uint16_t y2
Bottom Right Y-Coordinate of Area.
Definition: touch.h:77
The display is currently not touched.
Definition: touch.h:44
The display is currently touched at some point.
Definition: touch.h:45
static enum @0 state
TOUCH_CALLBACK callback
Callback which is executed when an event occurred in this Area.
Definition: touch.h:78
void touch_set_value_convert_mode(bool use_calibration)
Definition: touch.c:66
uint16_t x2
Bottom Right X-Coordinate of Area.
Definition: touch.h:76
Receive an event when the pen enters the region (pen was down before)
Definition: touch.h:56
POINT_STRUCT touch_get_last_point()
Definition: touch.c:211
bool use_calibration
Definition: touch.c:42
TOUCH_ACTION hookedActions
Actions to listen to.
Definition: touch.h:73
TOUCH_STATE
Definition: touch.h:43
bool touch_have_empty(unsigned char num)
Definition: touch.c:165
Do not receive any events.
Definition: touch.h:53
void touch_set_calibration_values(int xs, int dx, int ys, int dy)
Definition: touch.c:51
bool touch_init()
Definition: touch.c:61
Receive an event when the pen leaves the region (pen was inside region before)
Definition: touch.h:57