diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-10-17 01:05:14 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-10-17 01:05:14 +0000 |
commit | 0956ec5b471ce98d3ee0bdad3d95e8f55881ccd9 (patch) | |
tree | 81cc0ae390a923757826dd0034d5bdc336ba4622 /nuttx/configs/avr32dev1/include | |
parent | bd71dd5b4ccbb8c51c537e43a5d0bed98f1790b8 (diff) | |
download | px4-nuttx-0956ec5b471ce98d3ee0bdad3d95e8f55881ccd9.tar.gz px4-nuttx-0956ec5b471ce98d3ee0bdad3d95e8f55881ccd9.tar.bz2 px4-nuttx-0956ec5b471ce98d3ee0bdad3d95e8f55881ccd9.zip |
Add button support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3029 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/avr32dev1/include')
-rwxr-xr-x | nuttx/configs/avr32dev1/include/board.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/nuttx/configs/avr32dev1/include/board.h b/nuttx/configs/avr32dev1/include/board.h index 2ef9532f0..c166cae05 100755 --- a/nuttx/configs/avr32dev1/include/board.h +++ b/nuttx/configs/avr32dev1/include/board.h @@ -87,6 +87,12 @@ #define LED_ASSERTION 2 /* ON ON ON OFF */ #define LED_PANIC 2 /* ON ON ON OFF */ +/* Button definitions ***************************************************************/ +/* The AVR32DEV1 board has 3 BUTTONs, two of which can be sensed through GPIO pins. */ + +#define BUTTON1 1 /* Bit 0: Button 1 */ +#define BUTTON2 2 /* Bit 1: Button 2 */ + /************************************************************************************ * Public Types ************************************************************************************/ @@ -120,6 +126,49 @@ extern "C" { EXTERN void avr32_boardinitialize(void); +/************************************************************************************ + * 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* 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_GPIOB_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) } |