X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fbuttons.h;h=04ed9fac8a632af450f2a9abe0574e62231f9fed;hp=e4016b1efc7fca68ccf3543ef2c95d094ca5061a;hb=202c5cb4442b81aa5d0f7389b6dca62b2c121ac1;hpb=60432148802391c2ba390e9c56f999514653c969 diff --git a/betty/buttons.h b/betty/buttons.h index e4016b1..04ed9fa 100644 --- a/betty/buttons.h +++ b/betty/buttons.h @@ -9,10 +9,69 @@ #define BUTTONS_H /* includes */ -#include "betty.h" +#include "lpc2xxx.h" +#include "types.h" + +/* defines */ +#define BUTTON_MAX 8 +#define BUTTON_INT (1<<0) +#define BUTTON_POLL (1<<1) + +/* typedefs */ +typedef struct s_button { + unsigned char mode; // mode of the button api + int retries; // amount of retries per event capture + unsigned char cnt; // amount of recognized key presses + unsigned char key[BUTTON_MAX]; // pressed keys +} t_button; /* function prototypes */ -void button_init(void); -unsigned char button_get_event(unsigned long long int *keys,int retries); +void button_init(t_button *button); +void button_set_retries(t_button *button,int retries); +unsigned char button_get_event(t_button *button); + +/* button definitions */ +#define BUTTON_A 0x04 +#define BUTTON_B 0x03 +#define BUTTON_C 0x02 +#define BUTTON_D 0x08 +#define BUTTON_BETTY 0x0a +#define BUTTON_EXIT 0x14 +#define BUTTON_UP 0x09 +#define BUTTON_DOWN 0x1b +#define BUTTON_RIGHT 0x0e +#define BUTTON_LEFT 0x0f +#define BUTTON_OK 0x15 +#define BUTTON_VOL_UP 0x10 +#define BUTTON_VOL_DOWN 0x16 +#define BUTTON_PRG_UP 0x1a +#define BUTTON_PRG_DOWN 0x20 +#define BUTTON_MUTE 0x21 +#define BUTTON_1 0x05 +#define BUTTON_2 0x27 +#define BUTTON_3 0x26 +#define BUTTON_4 0x0b +#define BUTTON_5 0x00 +#define BUTTON_6 0x01 +#define BUTTON_7 0x11 +#define BUTTON_8 0x06 +#define BUTTON_9 0x07 +#define BUTTON_SHIFT 0x17 +#define BUTTON_0 0x0c +#define BUTTON_AV 0x0d +#define BUTTON_MENU 0x1c +#define BUTTON_PIP 0x1d +#define BUTTON_A_B 0x12 +#define BUTTON_16_9 0x13 +#define BUTTON_INFO 0x22 +#define BUTTON_TV1 0x23 +#define BUTTON_TV2 0x18 +#define BUTTON_TV3 0x19 +#define BUTTON_RED 0x28 +#define BUTTON_GREEN 0x29 +#define BUTTON_YELLOW 0x1e +#define BUTTON_BLUE 0x1f +#define BUTTON_TV 0x24 +#define BUTTON_POWER 0x25 #endif