LUFA Library 110528
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 CULV3.


 EVK1101
 

Board specific LED driver header for the Atmel EVK1101.


 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.


 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.


 TEENSY
 

Board specific LED driver header for the PJRC Teensy boards.


 UDIP
 

Board specific LED driver header for the Linnix UDIP.


 UNO
 

Board specific LED driver header for the Arduino Uno.


 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 Atmel XPLAIN.


Defines

#define LEDS_LED1   0
#define LEDS_LED2   0
#define LEDS_LED3   0
#define LEDS_LED4   0

Functions

static void LEDs_Init (void)
static void LEDs_TurnOnLEDs (const uint8_t LEDMask)
static void LEDs_TurnOffLEDs (const uint8_t LEDMask)
static void LEDs_SetAllLEDs (const uint8_t LEDMask)
static void LEDs_ChangeLEDs (const uint8_t LEDMask, const uint8_t ActiveMask)
static void LEDs_ToggleLEDs (const uint8_t LEDMask)
static uint8_t LEDs_GetLEDs (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)

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/Dataflash.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.

      // Initialise 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);

Define Documentation

#define LEDS_LED1   0
#define LEDS_LED2   0
#define LEDS_LED3   0
#define LEDS_LED4   0

Function Documentation

static void LEDs_ChangeLEDs ( const uint8_t  LEDMask,
const uint8_t  ActiveMask 
) [inline, static]
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 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]

Initialises 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_SetAllLEDs ( const uint8_t  LEDMask) [inline, static]
static void LEDs_ToggleLEDs ( const uint8_t  LEDMask) [inline, static]
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 uint8_t  LEDMask) [inline, static]
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).
static void LEDs_TurnOnLEDs ( const uint8_t  LEDMask) [inline, static]