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