finished/fixed button api
[my-code/arm.git] / betty / buttons.h
1 /*
2  * buttons.h - button api header file
3  *
4  * author: hackbard@hackdaworld.org
5  *
6  */
7
8 #ifndef BUTTONS_H
9 #define BUTTONS_H
10
11 /* includes */
12 #include "betty.h"
13
14 /* defines */
15 #define BUTTON_MAX      8
16 #define BUTTON_INT      (1<<0)
17 #define BUTTON_POLL     (1<<1)
18
19 /* typedefs */
20 typedef struct s_button {
21         unsigned char mode;             // mode of the button api
22         int retries;                    // amount of retries per event capture
23         unsigned char cnt;              // amount of recognized key presses
24         unsigned char key[BUTTON_MAX];  // pressed keys
25 } t_button;
26
27 /* function prototypes */
28 void button_init(t_button *button);
29 void button_set_retries(t_button *button,int retries);
30 unsigned char button_get_event(t_button *button);
31
32 /* button definitions */
33 #define BUTTON_A                0x04
34 #define BUTTON_B                0x03
35 #define BUTTON_C                0x02
36 #define BUTTON_D                0x08
37 #define BUTTON_BETTY            0x0a
38 #define BUTTON_EXIT             0x14
39 #define BUTTON_UP               0x09
40 #define BUTTON_DOWN             0x1b
41 #define BUTTON_RIGHT            0x0e
42 #define BUTTON_LEFT             0x0f
43 #define BUTTON_OK               0x15
44 #define BUTTON_VOL_UP           0x10
45 #define BUTTON_VOL_DOWN         0x16
46 #define BUTTON_PRG_UP           0x1a
47 #define BUTTON_PRG_DOWN         0x20
48 #define BUTTON_MUTE             0x21
49 #define BUTTON_1                0x05
50 #define BUTTON_2                0x27
51 #define BUTTON_3                0x26
52 #define BUTTON_4                0x0b
53 #define BUTTON_5                0x00
54 #define BUTTON_6                0x01
55 #define BUTTON_7                0x11
56 #define BUTTON_8                0x06
57 #define BUTTON_9                0x07
58 #define BUTTON_SHIFT            0x17
59 #define BUTTON_0                0x0c
60 #define BUTTON_AV               0x0d
61 #define BUTTON_MENU             0x1c
62 #define BUTTON_PIP              0x1d
63 #define BUTTON_A_B              0x12
64 #define BUTTON_16_9             0x13
65 #define BUTTON_INFO             0x22
66 #define BUTTON_TV1              0x23
67 #define BUTTON_TV2              0x18
68 #define BUTTON_TV3              0x19
69 #define BUTTON_RED              0x28
70 #define BUTTON_GREEN            0x29
71 #define BUTTON_YELLOW           0x1e
72 #define BUTTON_BLUE             0x1f
73 #define BUTTON_TV               0x24
74 #define BUTTON_POWER            0x25
75
76 #endif