3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this  
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in  
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting  
  17   documentation, and that the name of the author not be used in  
  18   advertising or publicity pertaining to distribution of the  
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  32  *  \brief Master include file for the board LEDs driver. 
  34  *  This file is the master dispatch header file for the board-specific LED driver, for boards containing user 
  37  *  User code should include this file, which will in turn include the correct LED driver header file for the 
  38  *  currently selected board. 
  40  *  If the BOARD value is set to BOARD_USER, this will include the /Board/LEDs.h file in the user project 
  43  *  For possible BOARD makefile values, see \ref Group_BoardTypes. 
  46 /** \ingroup Group_BoardDrivers 
  47  *  @defgroup Group_LEDs LEDs Driver - LUFA/Drivers/Board/LEDs.h 
  49  *  \section Sec_Dependencies Module Source Dependencies 
  50  *  The following files must be built with any user project that uses this module: 
  53  *  \section Module Description 
  54  *  Hardware LEDs driver. This provides an easy to use driver for the hardware LEDs present on many boards. It 
  55  *  provides an interface to configure, test and change the status of all the board LEDs. 
  57  *  If the BOARD value is set to BOARD_USER, this will include the /Board/Dataflash.h file in the user project 
  58  *  directory. Otherwise, it will include the appropriate built in board driver header file. If the BOARD value 
  59  *  is set to BOARD_NONE, this driver is silently disabled. 
  61  *  For possible BOARD makefile values, see \ref Group_BoardTypes. 
  63  *  \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If 
  64  *        a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect. 
  65  *        If other behaviour is desired, either alias the remaining LED masks to existing LED masks via the -D  
  66  *        switch in the project makefile, or alias them to nothing in the makefile to cause compilation errors when 
  67  *        a non-existing LED is referenced in application code. Note that this means that it is possible to make 
  68  *        compatible code for a board with no LEDs by making a board LED driver (see \ref Page_WritingBoardDrivers) 
  69  *        which contains only stub functions and defines no LEDs. 
  78         #if !defined(__DOXYGEN__) 
  79                 #define __INCLUDE_FROM_LEDS_H 
  80                 #define INCLUDE_FROM_LEDS_H 
  84         #include "../../Common/Common.h" 
  86         #if (BOARD == BOARD_NONE) 
  87                 static inline void LEDs_Init(void) {}; 
  88                 static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask
) {}; 
  89                 static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask
) {}; 
  90                 static inline void LEDs_SetAllLEDs(const uint8_t LEDMask
) {}; 
  91                 static inline void LEDs_ChangeLEDs(const uint8_t LEDMask
, const uint8_t ActiveMask
) {}; 
  92                 static inline void LEDs_ToggleLEDs(const uint8_t LEDMask
) {}; 
  93                 static inline uint8_t LEDs_GetLEDs(void) { return 0; } 
  94         #elif (BOARD == BOARD_USBKEY) 
  95                 #include "USBKEY/LEDs.h" 
  96         #elif (BOARD == BOARD_STK525) 
  97                 #include "STK525/LEDs.h" 
  98         #elif (BOARD == BOARD_STK526) 
  99                 #include "STK526/LEDs.h" 
 100         #elif (BOARD == BOARD_RZUSBSTICK) 
 101                 #include "RZUSBSTICK/LEDs.h" 
 102         #elif (BOARD == BOARD_ATAVRUSBRF01) 
 103                 #include "ATAVRUSBRF01/LEDs.h" 
 104         #elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) 
 105                 #include "XPLAIN/LEDs.h" 
 106         #elif (BOARD == BOARD_BUMBLEB) 
 107                 #include "BUMBLEB/LEDs.h" 
 108         #elif (BOARD == BOARD_EVK527) 
 109                 #include "EVK527/LEDs.h" 
 110         #elif (BOARD == BOARD_TEENSY) 
 111                 #include "TEENSY/LEDs.h" 
 112         #elif (BOARD == BOARD_USBTINYMKII) 
 113                 #include "USBTINYMKII/LEDs.h" 
 114         #elif (BOARD == BOARD_BENITO) 
 115                 #include "BENITO/LEDs.h" 
 116         #elif (BOARD == BOARD_JMDBU2) 
 117                 #include "JMDBU2/LEDs.h" 
 118         #elif (BOARD == BOARD_OLIMEX162) 
 119                 #include "OLIMEX162/LEDs.h" 
 120         #elif (BOARD == BOARD_USBFOO) 
 121                 #include "USBFOO/LEDs.h" 
 122         #elif (BOARD == BOARD_UDIP) 
 123                 #include "UDIP/LEDs.h" 
 124         #elif (BOARD == BOARD_BUI) 
 125                 #include "BUI/LEDs.h" 
 126         #elif (BOARD == BOARD_UNO) 
 127                 #include "UNO/LEDs.h" 
 128         #elif (BOARD == BOARD_USER) 
 129                 #include "Board/LEDs.h" 
 132         #if !defined(LEDS_LED1) 
 136         #if !defined(LEDS_LED2) 
 140         #if !defined(LEDS_LED3) 
 144         #if !defined(LEDS_LED4) 
 148         /* Pseudo-Functions for Doxygen: */ 
 149         #if defined(__DOXYGEN__) 
 150                 /** Initialises the board LED driver so that the LEDs can be controlled. This sets the appropriate port 
 151                  *  I/O pins as outputs, and sets the LEDs to default to off. 
 153                 static inline void LEDs_Init(void); 
 155                 /** Turns on the LEDs specified in the given LED mask. 
 157                  *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). 
 159                 static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask
); 
 161                 /** Turns off the LEDs specified in the given LED mask. 
 163                  *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). 
 165                 static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask
); 
 167                 /** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED 
 170                  *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). 
 172                 static inline void LEDs_SetAllLEDs(const uint8_t LEDMask
); 
 174                 /** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs 
 175                  *  specified in both the LED and active masks. 
 177                  *  \param[in] LEDMask     Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). 
 178                  *  \param[in] ActiveMask  Mask of whether the LEDs in the LED mask should be turned on or off. 
 180                 static inline void LEDs_ChangeLEDs(const uint8_t LEDMask
, 
 181                                                    const uint8_t ActiveMask
); 
 183                 /** Toggles all LEDs in the LED mask, leaving all others in their current states. 
 185                  *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). 
 187                 static inline void LEDs_ToggleLEDs(const uint8_t LEDMask
); 
 189                 /** Returns the status of all the board LEDs; set LED masks in the return value indicate that the 
 190                  *  corresponding LED is on. 
 192                  *  \return Mask of the board LEDs which are currently turned on. 
 194                 static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT
;