mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
Add button support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3029 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user