Welcome to the EyeBot  Version 7 - RPi1
A Controller For Various Hardware IO
key.h
Go to the documentation of this file.
1 
7 #ifndef KEY_H_
8 #define KEY_H_
9 
10 #include "types.h"
11 #include <stdio.h>
12 
13 /* pre-defined key constants - usable for standard & region map */
14 #define KEY1 0x00000001
15 #define KEY2 0x00000002
16 #define KEY3 0x00000004
17 #define KEY4 0x00000008
18 #define ANYKEY 0xFFFFFFFF
19 
20 /* special keys (escape & list menu)! */
21 #define KEY_ESCAPE 0x80000000
22 #define KEY_LISTTL 0x40000000
23 #define KEY_LISTUP 0x20000000
24 #define KEY_LISTDN 0x10000000
25 
26 /* special pre-defined key constants for standard list menu! */
27 #define KEY_LIST1 0x00000010
28 #define KEY_LIST2 0x00000020
29 #define KEY_LIST3 0x00000040
30 #define KEY_LIST4 0x00000080
31 #define KEY_LIST5 0x00000100
32 #define KEY_LIST6 0x00000200
33 #define KEY_LIST7 0x00000400
34 #define KEY_LIST8 0x00000800
35 
36 /* key library states - arg for KEYIdle() */
37 #define KEY_GOIDLE 1
38 #define KEY_NOIDLE 0
39 #define KEY_STATE -1
40 
41 /* key library states - arg for KEYIdle() */
42 #define KEY_GOIDLE 1
43 #define KEY_NOIDLE 0
44 #define KEY_STATE -1
45 
46 /* key touchmap types/key modes */
47 #define KEYTM_UNKNOWN 0x00
48 #define KEYTM_CLASSIC 0x01
49 #define KEYTM_STANDARD 0x02
50 #define KEYTM_REGIONS 0x03
51 #define KEYTM_LISTMENU 0x04
52 
53 /* reserve 0x0 for timed-out keycode! no key pressed! */
54 #define KEY_TIMEOUT 0x00000000
55 
56 /* i assume 32 simultaneous keys is impossible! :p */
57 #define KEY_INVALID 0xFFFFFFFF
58 
59 //initialise check for key functions
60 int KEY_INITIAL;
61 
62 int inside(int x, int y, BOX rect);
63 int KEYInit(void);
64 int KEYRelease(void);
65 int KEYIdle(int idle);
66 KEYMODE KEYSetTM(KEYMODE mode);
67 KEYMODE KEYGetTM(TOUCH_MAP** ptouch_map);
68 int KEYSetRegion(int index, BOX *region);
69 int KEYGetRegion(int index, BOX *region);
70 int KEYNoTouch(TOUCH_EVENT* rawtouch);
71 int KEYGetRAW(TOUCH_EVENT* rawtouch);
72 KEYCODE KEYDecode(TOUCH_EVENT* rawtouch);
73 KEYCODE KEYWait(KEYCODE excode);
74 KEYCODE KEYRead(void);
75 KEYCODE KEYGet(void);
76 
77 //need to change this to KEYXY(int , int)
78 COORD_PAIR KEYGetXY(void);
79 int KEYXY(int* x, int* y);
80 int activate_escape(int escape);
81 
82 #endif /* KEY_H_ */
Defines types used for the EyeBot 7.
KEYCODE KEYWait(KEYCODE excode)
Wait for specific keys only.
Definition: key.c:310
Structure defining boxes for touchscreen use.
Definition: types.h:204
int KEYGetRegion(int index, BOX *region)
Copy specific region data out from the current touch map. Only used in KEYTM_REGIONS mode...
Definition: key.c:154
KEYMODE KEYSetTM(KEYMODE mode)
Set mode for key touch map.
Definition: key.c:36
KEYCODE KEYGet(void)
Wait for a touch event and return keycode (including KEY_INVALID - undefined keycode).
Definition: key.c:332
Structure defining a rectangular box on the LCD.
Definition: types.h:194
int KEYInit(void)
Open the evdev device file for reading touch events. Load the key configuration file (if found)...
Definition: key.c:19
KEYCODE KEYDecode(TOUCH_EVENT *rawtouch)
Decode raw touch info into a keycode based on the current touch map. Mainly used for testing...
Definition: key.c:213
int KEYGetRAW(TOUCH_EVENT *rawtouch)
Gets raw touch info - a non-blocking function. Mainly used for calibration and testing.
Definition: key.c:194
Structure representing the coordinates of a point.
Definition: types.h:186
Structure defining touchscreen presses.
Definition: types.h:213
int KEYIdle(int idle)
Enable/disable event checking procedure.
Definition: key.c:296
int KEYNoTouch(TOUCH_EVENT *rawtouch)
Validate there's no touch on screen surface.
Definition: key.c:172
int KEYSetRegion(int index, BOX *region)
Manually set region data into current touch map. Only used in KEYTM_REGIONS mode. If region is 0x0...
Definition: key.c:136
int KEYXY(int *x, int *y)
Wait for a touch event and return the XY-coordinate.
Definition: key.c:374
int KEYRelease(void)
Close the evdev device file and stop checking any key touch event.
Definition: key.c:255
KEYMODE KEYGetTM(TOUCH_MAP **ptouch_map)
Get current mode and touch map (region map).
Definition: key.c:114
int inside(int x, int y, BOX rect)
Check if a point is inside a rectangle.
Definition: key.c:274
KEYCODE KEYRead(void)
Read a keycode and returns. Function does not wait, thus includes KEY_TIMEOUT.
Definition: key.c:391
COORD_PAIR KEYGetXY(void)
Wait for a touch event and return the XY-coordinate.
Definition: key.c:351