LUFA Library  120219
Buttons Driver - LUFA/Drivers/Board/Buttons.h

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.


 MICROPENDOUS_A
 

Board specific Button driver header for the Micropendous A (https://code.google.com/p/micropendous/wiki/MicropendousA).


 MICROPENDOUS_1
 

Board specific Button driver header for the Micropendous 1 (https://code.google.com/p/micropendous/wiki/Micropendous1).


 MICROPENDOUS_2
 

Board specific Button driver header for the Micropendous 2 (https://code.google.com/p/micropendous/wiki/Micropendous2).


 MICROPENDOUS_3
 

Board specific Button driver header for the Micropendous 3 (https://code.google.com/p/micropendous/wiki/Micropendous3).


 MICROPENDOUS_4
 

Board specific Button driver header for the Micropendous 4 (https://code.google.com/p/micropendous/wiki/Micropendous4).


 MICROPENDOUS_DIP
 

Board specific Button driver header for the Micropendous DIP (https://code.google.com/p/micropendous/wiki/MicropendousDIP).


 MICROPENDOUS_REV1
 

Board specific Button driver header for the Micropendous Arduino-like Revision 1 (https://code.google.com/p/micropendous/wiki/Micropendous).


 MICROPENDOUS_REV2
 

Board specific Button driver header for the Micropendous Arduino-like Revision 2 (https://code.google.com/p/micropendous/wiki/Micropendous).


 MICROPENDOUS_32U2
 

Board specific Buttons driver header for the Micropendous 32U2.


 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.


 USB2AX_V3
 

Board specific Button driver header for the Paranoid Studio USB2AX revision 3.


 USB2AX
 

Board specific Buttons driver header for the Paranoid Studio USB2AX.


 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.


 A3BU_XPLAINED
 

Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained.


 B1_XPLAINED
 

Board specific Buttons driver header for the Atmel XMEGA B1 Xplained.


Functions

static void Buttons_Init (void)
static void Buttons_Disable (void)
static uint_reg_t Buttons_GetStatus (void) ATTR_WARN_UNUSED_RESULT

Detailed Description

Module Source Dependencies

The following files must be built with any user project that uses this module:

Module Description

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.

Example Usage

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");

Function Documentation

static void Buttons_Disable ( void  ) [inline, static]

Disables the buttons driver, releasing the I/O pins back to their default high-impedence input mode.

static uint_reg_t Buttons_GetStatus ( void  ) [inline, static]

Returns a mask indicating which board buttons are currently pressed.

Returns:
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.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines