![]() |
LUFA Library
111009
|
Digital button board hardware driver. More...
Modules | |
ATAVRUSBRF01 | |
Board specific Buttons driver header for the Atmel ATAVRUSBRF01. | |
BENITO | |
Board specific Buttons driver header for the Tempusdictum Benito. | |
BUMBLEB | |
Board specific Buttons driver header for the Fletchtronics BUMBLEB. | |
CULV3 | |
Board specific Buttons driver header for the Busware CULV3. | |
EVK527 | |
Board specific Buttons driver header for the Atmel EVK527. | |
JMDBU2 | |
Board specific Buttons driver header for the Mattairtech JM-DB-U2. | |
MICROSIN162 | |
Board specific Buttons driver header for the Microsin AVR-USB162 board. | |
MINIMUS | |
Board specific Buttons driver header for the MINIMUS. | |
OLIMEX162 | |
Board specific Buttons driver header for the Olimex AVR-USB-162 Development Board. | |
STK525 | |
Board specific Buttons driver header for the Atmel STK525. | |
STK526 | |
Board specific Buttons driver header for the Atmel STK526. | |
TUL | |
Board specific Buttons driver header for the TUL. | |
UDIP | |
Board specific Buttons driver header for the UDIP. | |
USBFOO | |
Board specific Buttons driver header for the Kernel Concepts USBFOO. | |
USBKEY | |
Board specific Buttons driver header for the Atmel USBKEY. | |
USBTINYMKII | |
Board specific Buttons driver header for Tom's USBTINY MKII. | |
EVK1100 | |
Board specific Buttons driver header for the Atmel EVK1100. | |
EVK1101 | |
Board specific Buttons driver header for the Atmel EVK1101. | |
EVK1104 | |
Board specific Buttons driver header for the Atmel EVK1104. | |
Functions | |
static void | Buttons_Init (void) |
static uint_reg_t | Buttons_GetStatus (void) ATTR_WARN_UNUSED_RESULT |
The following files must be built with any user project that uses this module:
Hardware buttons driver. This provides an easy to use driver for the hardware buttons present on many boards. It provides a way to easily configure and check the status of all the buttons on the board so that appropriate actions can be taken.
If the BOARD
value is set to BOARD_USER
, this will include the /Board/Buttons
.h file in the user project directory. Otherwise, it will include the appropriate built in board driver header file.
For possible BOARD
makefile values, see Board Types.
The following snippet is an example of how this module may be used within a typical application.
// Initialize the button driver before first use Buttons_Init(); printf("Waiting for button press...\r\n"); // Loop until a board button has been pressed uint8_t ButtonPress; while (!(ButtonPress = Buttons_GetStatus())) {}; // Display which button was pressed (assuming two board buttons) printf("Button pressed: %s\r\n", (ButtonPress == BUTTONS_BUTTON1) ? "Button 1" : "Button 2");
static uint_reg_t Buttons_GetStatus | ( | void | ) | [inline, static] |
Returns a mask indicating which board buttons are currently pressed.
static void Buttons_Init | ( | void | ) | [inline, static] |
Initializes the BUTTONS driver, so that the current button position can be read. This sets the appropriate I/O pins to an inputs with pull-ups enabled.
This must be called before any Button driver functions are used.