00001 /* buttons.h -- Button Module for EBCS 00002 Copyright 2001 Free Software Foundation, Inc. 00003 Written by Stephane Carrez (stcarrez@worldnet.fr) 00004 00005 This file is part of EBCS. 00006 00007 EBCS is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2, or (at your option) 00010 any later version. 00011 00012 EBCS is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with EBCS; see the file COPYING. If not, write to 00019 the Free Software Foundation, 59 Temple Place - Suite 330, 00020 Boston, MA 02111-1307, USA. */ 00021 00022 #ifndef _EBCS_BUTTONS_H 00023 #define _EBCS_BUTTONS_H 00024 00025 #include <sys/param.h> 00026 #include <gel/event.h> 00027 #include <gel/timer.h> 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00037 00039 enum button 00040 { 00041 BUTTON_1 = 0, 00042 BUTTON_2 = 1, 00043 BUTTON_3 = 2, 00044 BUTTON_4 = 3 00045 }; 00046 typedef unsigned short button_t; 00047 00048 #ifndef GEL_MAX_BUTTONS 00049 # define GEL_MAX_BUTTONS 4 00050 #endif 00051 00052 #if GEL_MAX_BUTTONS <= 8 00053 typedef unsigned char button_mask_t; 00054 #elif GEL_MAX_BUTTONS <= 16 00055 typedef unsigned short button_mask_t; 00056 #else 00057 typedef unsigned long button_mask_t; 00058 #endif 00059 00060 enum key_mode 00061 { 00062 KEY_PRESS, 00063 KEY_RELEASE 00064 }; 00065 00066 typedef struct 00067 { 00068 unsigned long button_press_count; 00069 } button_stat_t; 00070 00078 extern void button_initialize (void); 00079 00084 extern button_mask_t button_get_pressed (void); 00085 00099 extern void button_enable (void); 00100 00111 extern void button_disable (void); 00112 00117 extern int button_is_enabled (void); 00118 00124 extern struct event_def button_change_event; 00125 00128 #ifdef __cplusplus 00129 }; 00130 #endif 00131 00132 #endif