Header file for the key functions.
More...
#include "types.h"
#include <stdio.h>
Go to the source code of this file.
|
#define | KEY1 0x00000001 |
|
#define | KEY2 0x00000002 |
|
#define | KEY3 0x00000004 |
|
#define | KEY4 0x00000008 |
|
#define | ANYKEY 0xFFFFFFFF |
|
#define | KEY_ESCAPE 0x80000000 |
|
#define | KEY_LISTTL 0x40000000 |
|
#define | KEY_LISTUP 0x20000000 |
|
#define | KEY_LISTDN 0x10000000 |
|
#define | KEY_LIST1 0x00000010 |
|
#define | KEY_LIST2 0x00000020 |
|
#define | KEY_LIST3 0x00000040 |
|
#define | KEY_LIST4 0x00000080 |
|
#define | KEY_LIST5 0x00000100 |
|
#define | KEY_LIST6 0x00000200 |
|
#define | KEY_LIST7 0x00000400 |
|
#define | KEY_LIST8 0x00000800 |
|
#define | KEY_GOIDLE 1 |
|
#define | KEY_NOIDLE 0 |
|
#define | KEY_STATE -1 |
|
#define | KEY_GOIDLE 1 |
|
#define | KEY_NOIDLE 0 |
|
#define | KEY_STATE -1 |
|
#define | KEYTM_UNKNOWN 0x00 |
|
#define | KEYTM_CLASSIC 0x01 |
|
#define | KEYTM_STANDARD 0x02 |
|
#define | KEYTM_REGIONS 0x03 |
|
#define | KEYTM_LISTMENU 0x04 |
|
#define | KEY_TIMEOUT 0x00000000 |
|
#define | KEY_INVALID 0xFFFFFFFF |
|
|
int | inside (int x, int y, BOX rect) |
| Check if a point is inside a rectangle. More...
|
|
int | KEYInit (void) |
| Open the evdev device file for reading touch events. Load the key configuration file (if found), else use the hardcoded default value. More...
|
|
int | KEYRelease (void) |
| Close the evdev device file and stop checking any key touch event. More...
|
|
int | KEYIdle (int idle) |
| Enable/disable event checking procedure. More...
|
|
KEYMODE | KEYSetTM (KEYMODE mode) |
| Set mode for key touch map. More...
|
|
KEYMODE | KEYGetTM (TOUCH_MAP **ptouch_map) |
| Get current mode and touch map (region map). More...
|
|
int | KEYSetRegion (int index, BOX *region) |
| Manually set region data into current touch map. Only used in KEYTM_REGIONS mode. If region is 0x0, resets the touch map (mode becomes KEYTM_UNKNOWN). More...
|
|
int | KEYGetRegion (int index, BOX *region) |
| Copy specific region data out from the current touch map. Only used in KEYTM_REGIONS mode. More...
|
|
int | KEYNoTouch (TOUCH_EVENT *rawtouch) |
| Validate there's no touch on screen surface. More...
|
|
int | KEYGetRAW (TOUCH_EVENT *rawtouch) |
| Gets raw touch info - a non-blocking function. Mainly used for calibration and testing. More...
|
|
KEYCODE | KEYDecode (TOUCH_EVENT *rawtouch) |
| Decode raw touch info into a keycode based on the current touch map. Mainly used for testing. More...
|
|
KEYCODE | KEYWait (KEYCODE excode) |
| Wait for specific keys only. More...
|
|
KEYCODE | KEYRead (void) |
| Read a keycode and returns. Function does not wait, thus includes KEY_TIMEOUT. More...
|
|
KEYCODE | KEYGet (void) |
| Wait for a touch event and return keycode (including KEY_INVALID - undefined keycode). More...
|
|
COORD_PAIR | KEYGetXY (void) |
| Wait for a touch event and return the XY-coordinate. More...
|
|
int | KEYXY (int *x, int *y) |
| Wait for a touch event and return the XY-coordinate. More...
|
|
int | activate_escape (int escape) |
|
Header file for the key functions.
- Author
- Marcus Pham & Remi KEAT
int inside |
( |
int |
x, |
|
|
int |
y, |
|
|
BOX |
rect |
|
) |
| |
Check if a point is inside a rectangle.
- Parameters
-
int | x : X-coordinate of the point |
int | y : Y-coordinate of the point |
BOX | rect : rectangle structure |
- Returns
- int retVal : non-null if inside
Decode raw touch info into a keycode based on the current touch map. Mainly used for testing.
- Parameters
-
TOUCH_EVENT* | rawtouch : pointer to TOUCH_EVENT structure |
- Returns
- KEYCODE keyCode : Status of touch data (variable in rawtouch)
Wait for a touch event and return keycode (including KEY_INVALID - undefined keycode).
- Returns
- KEYCODE retKey : Keycode value
Gets raw touch info - a non-blocking function. Mainly used for calibration and testing.
- Parameters
-
TOUCH_EVENT* | rawtouch : pointer to TOUCH_EVENT structure |
- Returns
- int retVal :
0 if sync signal received!
Negative value if otherwise
int KEYGetRegion |
( |
int |
index, |
|
|
BOX * |
region |
|
) |
| |
Copy specific region data out from the current touch map. Only used in KEYTM_REGIONS mode.
- Parameters
-
int | index : Index for region |
BOX* | region : Pointer to a storage for region data |
- Returns
- int retVal : 0 on success
Negative value on failure
Get current mode and touch map (region map).
- Parameters
-
TOUCH_MAP** | ptouch_map : Pointer to a TOUCH_MAP structure |
- Returns
- KEYMODE retMod : Current touch map mode
Wait for a touch event and return the XY-coordinate.
- Returns
- COORD_PAIR retCoord : Coordinate pair
Enable/disable event checking procedure.
- Parameters
-
Valid values for idle:
- KEY_GOIDLE - deactivate event checking
- KEY_NOIDLE - activate event checking
- KEY_STATE - request current status
- Returns
- int status : Idle status of event checking procedure
Open the evdev device file for reading touch events. Load the key configuration file (if found), else use the hardcoded default value.
- Returns
- int retVal : 0 on success
Negative value on failure
Validate there's no touch on screen surface.
- Parameters
-
TOUCH_EVENT* | rawtouch : pointer to TOUCH_EVENT structure this is optional! only if raw data needed! else, use 0x0! |
- Returns
- int retVal :
0 - being touched
1 - not touched
Read a keycode and returns. Function does not wait, thus includes KEY_TIMEOUT.
- Returns
- retKey the Keycode value
Close the evdev device file and stop checking any key touch event.
- Returns
- int retVal : 0 on success
Negative value on failure
int KEYSetRegion |
( |
int |
index, |
|
|
BOX * |
region |
|
) |
| |
Manually set region data into current touch map. Only used in KEYTM_REGIONS mode. If region is 0x0, resets the touch map (mode becomes KEYTM_UNKNOWN).
- Parameters
-
int | index : Index for region |
BOX* | region : Pointer to a region data |
- Returns
- int retVal : 0 on success
Negative value on failure
KEYMODE KEYSetTM |
( |
KEYMODE |
mode | ) |
|
Set mode for key touch map.
- Parameters
-
KEYMODE | mode : Requested touch map mode |
- Returns
- KEYMODE retMod : Current touch map mode
KEYCODE KEYWait |
( |
KEYCODE |
excode | ) |
|
Wait for specific keys only.
- Parameters
-
KEYCODE | excode : Expected keycode values (bit XORed) |
- Returns
- KEYCODE retKey : Keycode value
int KEYXY |
( |
int * |
x, |
|
|
int * |
y |
|
) |
| |
Wait for a touch event and return the XY-coordinate.
- Parameters
-
x | a pointer to the horizontal coord |
y | a pointer to the vertical coord |
- Returns
- always 0