00001 /* 00002 button.h 00003 00004 Nicolas Williamson - July 2009 00005 */ 00006 00007 #ifndef __H_BUTTON__ 00008 #define __H_BUTTON__ 00009 00010 unsigned int button_pushed(unsigned int button); 00011 unsigned int button_0(void); 00012 unsigned int button_1(void); 00013 unsigned int button_2(void); 00014 unsigned int button_3(void); 00015 unsigned int button_4(void); 00016 unsigned int button_5(void); 00017 00018 /* HARDWARE SETUP 00019 00020 // ******************************************************************************* 00021 // Initialize Buttons 00022 // ******************************************************************************* 00023 PINSEL0 &= ~(3<<24); //Button 1: P0.12 as GPIO 00024 PINSEL0 &= ~(3<<26); //Button 2: P0.13 as GPIO 00025 PINSEL1 &= ~(3<<24); //Button 3: P0.28 as GPIO 00026 PINSEL1 &= ~(3<<28); //Button 5: P0.30 as GPIO 00027 PINSEL2 &= ~(1<<3); //Buttons 0 & 4: P1.18 and P1.16 GPIO (P1.16-25 GPIO) 00028 //set pins as inputs 00029 FIO0DIR &= ~(1<<12); 00030 FIO0DIR &= ~(1<<13); 00031 FIO0DIR &= ~(1<<28); 00032 FIO0DIR &= ~(1<<30); 00033 FIO1DIR &= ~(1<<16); 00034 FIO1DIR &= ~(1<<18); 00035 00036 */ 00037 00038 #endif