diff options
Diffstat (limited to 'nuttx/configs/sam3u-ek/include/board.h')
-rwxr-xr-x | nuttx/configs/sam3u-ek/include/board.h | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/nuttx/configs/sam3u-ek/include/board.h b/nuttx/configs/sam3u-ek/include/board.h index 2be5712da..6543acde3 100755 --- a/nuttx/configs/sam3u-ek/include/board.h +++ b/nuttx/configs/sam3u-ek/include/board.h @@ -42,12 +42,15 @@ ************************************************************************************/ #include <nuttx/config.h> +#include "sam3u_internal.h" + #ifndef __ASSEMBLY__ -# include <stdint.h> +# include <stdint.h> +# ifdef CONFIG_GPIO_IRQ +# include <arch/irq.h> +# endif #endif -#include "sam3u_internal.h" - /************************************************************************************ * Definitions ************************************************************************************/ @@ -94,7 +97,12 @@ #define LED_INIRQ 4 /* LED0=XXX LED1=TOG LED2=XXX */ #define LED_SIGNAL 5 /* LED0=XXX LED1=XXX LED2=TOG */ #define LED_ASSERTION 6 /* LED0=TOG LED1=XXX LED2=XXX */ -#define LED_PANIC 7 /* LED0=TOG LED1=XXX LED2=XXX*/ +#define LED_PANIC 7 /* LED0=TOG LED1=XXX LED2=XXX */ + +/* Button definitions ***************************************************************/ + +#define BUTTON1 1 /* Bit 0: Button 1 */ +#define BUTTON2 2 /* Bit 1: Button 2 */ /************************************************************************************ * Public Data @@ -126,20 +134,47 @@ extern "C" { EXTERN void sam3u_boardinitialize(void); /************************************************************************************ - * Button support. + * Name: up_buttoninit * * Description: * up_buttoninit() must be called to initialize button resources. After that, * up_buttons() may be called to collect the state of all buttons. up_buttons() * returns an 8-bit bit set with each bit associated with a button. See the - * BUTTON_* and JOYSTICK_* definitions above for the meaning of each bit. + * BUTTON* definitions above for the meaning of each bit in the returned value. * ************************************************************************************/ #ifdef CONFIG_ARCH_BUTTONS EXTERN void up_buttoninit(void); + +/************************************************************************************ + * Name: up_buttons + * + * Description: + * After up_buttoninit() has been called, up_buttons() may be called to collect + * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit + * associated with a button. See the BUTTON* definitions above for the meaning of + * each bit in the returned value. + * + ************************************************************************************/ + EXTERN uint8_t up_buttons(void); + +/************************************************************************************ + * Name: up_irqbutton1/2 + * + * Description: + * These functions may be called to register an interrupt handler that will be + * called when BUTTON1/2 is depressed. The previous interrupt handler value is + * returned (so that it may restored, if so desired). + * + ************************************************************************************/ + +#ifdef CONFIG_GPIOA_IRQ +EXTERN xcpt_t up_irqbutton1(xcpt_t irqhandler); +EXTERN xcpt_t up_irqbutton2(xcpt_t irqhandler); #endif +#endif /* CONFIG_ARCH_BUTTONS */ #undef EXTERN #if defined(__cplusplus) |