diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-01-23 03:05:05 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-01-23 03:05:05 +0000 |
commit | 82c299159a50c72fc530abbd2210f084b5bcd938 (patch) | |
tree | f9169bd45dc5766382e6f0fd9efb63e7ca027e93 /nuttx/configs/sam3u-ek/include | |
parent | dfddbfc5b48b54ccfdc5a6a6d096898a6ffdd027 (diff) | |
download | px4-nuttx-82c299159a50c72fc530abbd2210f084b5bcd938.tar.gz px4-nuttx-82c299159a50c72fc530abbd2210f084b5bcd938.tar.bz2 px4-nuttx-82c299159a50c72fc530abbd2210f084b5bcd938.zip |
Misc fixes, add button support, GPIO interrupt support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2523 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/sam3u-ek/include')
-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) |