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

LED board hardware driver. More...

Modules

 A3BU_XPLAINED
 Board specific LED driver header for the Atmel XMEGA A3BU Xplained.
 
 ADAFRUITU4
 Board specific LED driver header for the Adafruit U4 Breakout board.
 
 ATAVRUSBRF01
 Board specific LED driver header for the Atmel ATAVRUSBRF01.
 
 B1_XPLAINED
 Board specific LED driver header for the Atmel XMEGA B1 Xplained.
 
 BENITO
 Board specific LED driver header for the Tempusdictum Benito.
 
 BIGMULTIO
 Board specific LED driver header for the Bitwizard Big-Multio.
 
 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.
 
 C3_XPLAINED
 Board specific LED driver header for the Atmel XMEGA C3 Xplained.
 
 CULV3
 Board specific LED driver header for the Busware CUL V3.
 
 DUCE
 Board specific LED driver header for the DorkbotPDX Duce.
 
 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.
 
 EVK527
 Board specific LED driver header for the Atmel EVK527.
 
 JMDBU2
 Board specific LED driver header for the Mattairtech JM-DB-U2.
 
 LEONARDO
 Board specific LED driver header for the Arduino Leonardo board.
 
 MAXIMUS
 Board specific LED driver header for the Maximus.
 
 MICRO
 Board specific LED driver header for the Arduino Micro board.
 
 MICROPENDOUS_32U2
 Board specific LED driver header for the Micropendous-32U2.
 
 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).
 
 MICROSIN162
 Board specific LED driver header for the Microsin AVR-USB162 board.
 
 MINIMUS
 Board specific LED driver header for the MINIMUS.
 
 MULTIO
 Board specific LED driver header for the Bitwizard Multio.
 
 OLIMEX162
 Board specific LED driver header for the Olimex AVR-USB-162.
 
 OLIMEX32U4
 Board specific LED driver header for the Olimex AVR-USB-32U4.
 
 OLIMEXISPMK2
 Board specific LED driver header for the Olimex AVR-ISP-MK2.
 
 OLIMEXT32U4
 Board specific LED driver header for the Olimex AVR-USB-T32U4.
 
 RZUSBSTICK
 Board specific LED driver header for the Atmel RZUSBSTICK.
 
 SPARKFUN8U2
 Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board.
 
 STANGE_ISP
 Board specific LED driver header for the Dimex Stange-ISP board.
 
 STK525
 Board specific LED driver header for the Atmel STK525.
 
 STK526
 Board specific LED driver header for the Atmel STK526.
 
 TEENSY
 Board specific LED driver header for the PJRC Teensy 1.x/2.x boards.
 
 TEENSY2
 Board specific LED driver header for the PJRC Teensy 2 boards.
 
 TUL
 Board specific LED driver header for the Busware TUL.
 
 U2S
 Board specific LED driver header for the U2S.
 
 UC3A3_XPLAINED
 Board specific LED driver header for the Atmel UC3-A3 Xplained.
 
 UDIP
 Board specific LED driver header for the Linnix UDIP.
 
 UNO
 Board specific LED driver header for the Arduino Uno.
 
 USB2AX
 Board specific LED driver header for the Xevelabs USB2AX revisions 1 and 2.
 
 USB2AX_V3
 Board specific LED driver header for the Xevelabs USB2AX revision 3.
 
 USB2AX_V31
 Board specific LED driver header for the Xevelabs USB2AX revision 3.1.
 
 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
 Board specific LED driver header for the original Atmel XPLAIN.
 
 XPLAINED_MINI
 Board specific LED driver header for the Atmel Xplained-MINI series kits.
 
 XPLAIN_REV1
 Board specific LED driver header for the original Atmel XPLAIN, revision 1.
 
 YUN
 Board specific LED driver header for the Arduino Yun board.
 

Functions

static void LEDs_ChangeLEDs (const uint_reg_t LEDMask, const uint_reg_t ActiveMask)
 
static void LEDs_Disable (void)
 
static uint_reg_t LEDs_GetLEDs (void) ATTR_WARN_UNUSED_RESULT
 
static void LEDs_Init (void)
 
static void LEDs_SetAllLEDs (const uint_reg_t LEDMask)
 
static void LEDs_ToggleLEDs (const uint_reg_t LEDMask)
 
static void LEDs_TurnOffLEDs (const uint_reg_t LEDMask)
 
static void LEDs_TurnOnLEDs (const uint_reg_t LEDMask)
 

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 behavior 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
// Turn on each of the four LEDs in turn
Delay_MS(500);
Delay_MS(500);
Delay_MS(500);
Delay_MS(500);
// Turn on all LEDs
Delay_MS(1000);
// Turn on LED 1, turn off LED 2, leaving LEDs 3 and 4 in their current state
#define LEDS_ALL_LEDS
Definition: LEDs.h:75
#define LEDS_LED2
Definition: LEDs.h:66
#define LEDS_LED1
Definition: LEDs.h:63
#define LEDS_LED4
Definition: LEDs.h:72
#define LEDS_LED3
Definition: LEDs.h:69
static void Delay_MS(uint16_t Milliseconds) ATTR_ALWAYS_INLINE
Definition: Common.h:266
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_Init(void)

Function Documentation

◆ LEDs_ChangeLEDs()

static void LEDs_ChangeLEDs ( const uint_reg_t  LEDMask,
const uint_reg_t  ActiveMask 
)
inlinestatic

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.

◆ LEDs_Disable()

static void LEDs_Disable ( void  )
inlinestatic

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

◆ LEDs_GetLEDs()

static uint_reg_t LEDs_GetLEDs ( void  )
inlinestatic

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 LEDS_LED* constants indicating which of the board LEDs are currently turned on.

◆ LEDs_Init()

static void LEDs_Init ( void  )
inlinestatic

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.

This must be called before any LED driver functions are used.

◆ LEDs_SetAllLEDs()

static void LEDs_SetAllLEDs ( const uint_reg_t  LEDMask)
inlinestatic

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).

◆ LEDs_ToggleLEDs()

static void LEDs_ToggleLEDs ( const uint_reg_t  LEDMask)
inlinestatic

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).

◆ LEDs_TurnOffLEDs()

static void LEDs_TurnOffLEDs ( const uint_reg_t  LEDMask)
inlinestatic

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).

◆ LEDs_TurnOnLEDs()

static void LEDs_TurnOnLEDs ( const uint_reg_t  LEDMask)
inlinestatic

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).