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

LED board hardware driver. More...

Modules

 ADAFRUITU4
 

Board specific LED driver header for the Adafruit U4 Breakout board.


 ATAVRUSBRF01
 

Board specific LED driver header for the Atmel ATAVRUSBRF01.


 BENITO
 

Board specific LED driver header for the Tempusdictum Benito.


 BLACKCAT
 

Board specific LED driver header for the BLACKCAT USB JTAG.


 BUI
 

Board specific LED driver header for the Busware BUI.


 BUMBLEB
 

Board specific LED driver header for the Fletchtronics BUMBLEB.


 CULV3
 

Board specific LED driver header for the Busware CUL V3.


 EVK527
 

Board specific LED driver header for the Atmel EVK527.


 JMDBU2
 

Board specific LED driver header for the Mattairtech JM-DB-U2.


 MAXIMUS
 

Board specific LED driver header for the Maximus.


 MICROPENDOUS_REV1
 

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


 MICROPENDOUS_REV2
 

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


 MICROPENDOUS_32U2
 

Board specific LED driver header for the Micropendous 32U2.


 MICROSIN162
 

Board specific LED driver header for the Microsin AVR-USB162 board.


 MINIMUS
 

Board specific LED driver header for the MINIMUS.


 OLIMEX162
 

Board specific LED driver header for the Olimex AVR-USB-162.


 RZUSBSTICK
 

Board specific LED driver header for the Atmel RZUSBSTICK.


 SPARKFUN8U2
 

Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board.


 STK525
 

Board specific LED driver header for the Atmel STK525.


 STK526
 

Board specific LED driver header for the Atmel STK526.


 TEENSY2
 

Board specific LED driver header for the PJRC Teensy 2 boards.


 TEENSY
 

Board specific LED driver header for the PJRC Teensy 1.x/2.x boards.


 TUL
 

Board specific LED driver header for the Busware TUL.


 UDIP
 

Board specific LED driver header for the Linnix UDIP.


 UNO
 

Board specific LED driver header for the Arduino Uno.


 USB2AX_V3
 

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


 USB2AX
 

Board specific LED driver header for the Paranoid Studio USB2AX.


 USBFOO
 

Board specific LED driver header for the Kernel Concepts USBFOO.


 USBKEY
 

Board specific LED driver header for the Atmel USBKEY.


 USBTINYMKII
 

Board specific LED driver header for Tom's USBTINY MKII.


 XPLAIN_REV1
 

Board specific LED driver header for the original Atmel XPLAIN, revision 1.


 XPLAIN
 

Board specific LED driver header for the original Atmel XPLAIN.


 EVK1100
 

Board specific LED driver header for the Atmel EVK1100.


 EVK1101
 

Board specific LED driver header for the Atmel EVK1101.


 EVK1104
 

Board specific LED driver header for the Atmel EVK1104.


 A3BU_XPLAINED
 

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


 B1_XPLAINED
 

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


Functions

static void LEDs_Init (void)
static void LEDs_Disable (void)
static void LEDs_TurnOnLEDs (const uint_reg_t LEDMask)
static void LEDs_TurnOffLEDs (const uint_reg_t LEDMask)
static void LEDs_SetAllLEDs (const uint_reg_t LEDMask)
static void LEDs_ChangeLEDs (const uint_reg_t LEDMask, const uint_reg_t ActiveMask)
static void LEDs_ToggleLEDs (const uint_reg_t LEDMask)
static uint_reg_t LEDs_GetLEDs (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 LEDs driver. This provides an easy to use driver for the hardware LEDs present on many boards. It provides an interface to configure, test and change the status of all the board LEDs.

If the BOARD value is set to BOARD_USER, this will include the /Board/LEDs.h file in the user project directory. Otherwise, it will include the appropriate built in board driver header file. If the BOARD value is set to BOARD_NONE, this driver is silently disabled.

For possible BOARD makefile values, see Board Types.

Note:
To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect. If other behaviour is desired, either alias the remaining LED masks to existing LED masks via the -D switch in the project makefile, or alias them to nothing in the makefile to cause compilation errors when a non-existing LED is referenced in application code. Note that this means that it is possible to make compatible code for a board with no LEDs by making a board LED driver (see Writing LUFA Board Drivers) which contains only stub functions and defines no LEDs.

Example Usage

The following snippet is an example of how this module may be used within a typical application.

      // Initialize the board LED driver before first use
      LEDs_Init();

      // Turn on each of the four LEDs in turn
      LEDs_SetAllLEDs(LEDS_LED1);
      Delay_MS(500);
      LEDs_SetAllLEDs(LEDS_LED1);
      Delay_MS(500);
      LEDs_SetAllLEDs(LEDS_LED1);
      Delay_MS(500);
      LEDs_SetAllLEDs(LEDS_LED1);
      Delay_MS(500);

      // Turn on all LEDs
      LEDs_SetAllLEDs(LEDS_ALL_LEDS);
      Delay_MS(1000);

      // Turn on LED 1, turn off LED 2, leaving LEDs 3 and 4 in their current state
      LEDs_ChangeLEDs((LEDS_LED1 | LEDS_LED2), LEDS_LED1);

Function Documentation

static void LEDs_ChangeLEDs ( const uint_reg_t  LEDMask,
const uint_reg_t  ActiveMask 
) [inline, static]

Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs specified in both the LED and active masks.

Parameters:
[in]LEDMaskMask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
[in]ActiveMaskMask of whether the LEDs in the LED mask should be turned on or off.
static void LEDs_Disable ( void  ) [inline, static]

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

static uint_reg_t LEDs_GetLEDs ( void  ) [inline, static]

Returns the status of all the board LEDs; set LED masks in the return value indicate that the corresponding LED is on.

Returns:
Mask of the board LEDs which are currently turned on.
static void LEDs_Init ( void  ) [inline, static]

Initializes the board LED driver so that the LEDs can be controlled. This sets the appropriate port I/O pins as outputs, and sets the LEDs to default to off.

static void LEDs_SetAllLEDs ( const uint_reg_t  LEDMask) [inline, static]

Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED mask.

Parameters:
[in]LEDMaskMask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
static void LEDs_ToggleLEDs ( const uint_reg_t  LEDMask) [inline, static]

Toggles all LEDs in the LED mask, leaving all others in their current states.

Parameters:
[in]LEDMaskMask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
static void LEDs_TurnOffLEDs ( const uint_reg_t  LEDMask) [inline, static]

Turns off the LEDs specified in the given LED mask.

Parameters:
[in]LEDMaskMask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
static void LEDs_TurnOnLEDs ( const uint_reg_t  LEDMask) [inline, static]

Turns on the LEDs specified in the given LED mask.

Parameters:
[in]LEDMaskMask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines