Rename Drivers/AT90USBXXX to Drivers/Peripheral.
[pub/USBasp.git] / LUFA / Drivers / Board / LEDs.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 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.
20
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
28 this software.
29 */
30
31 /** \file
32 *
33 * This file is the master dispatch header file for the board-specific LED driver, for boards containing user
34 * controllable LEDs.
35 *
36 * User code should include this file, which will in turn include the correct LED driver header file for the
37 * currently selected board.
38 *
39 * If the BOARD value is set to BOARD_USER, this will include the /Board/LEDs.h file in the user project
40 * directory.
41 */
42
43 /** \ingroup Group_BoardDrivers
44 * @defgroup Group_LEDs LEDs Driver - LUFA/Drivers/Board/LEDs.h
45 *
46 * Functions, macros, variables, enums and types related to the control of board LEDs.
47 *
48 * @{
49 */
50
51 #ifndef __LEDS_H__
52 #define __LEDS_H__
53
54 /* Macros: */
55 #if !defined(__DOXYGEN__)
56 #define INCLUDE_FROM_LEDS_H
57 #define INCLUDE_FROM_BOARD_DRIVER
58 #endif
59
60 /* Includes: */
61 #include "../../Common/Common.h"
62
63 #if !defined(BOARD)
64 #error BOARD must be set in makefile to a value specified in BoardTypes.h.
65 #elif (BOARD == BOARD_USBKEY)
66 #include "USBKEY/LEDs.h"
67 #elif (BOARD == BOARD_STK525)
68 #include "STK525/LEDs.h"
69 #elif (BOARD == BOARD_STK526)
70 #include "STK526/LEDs.h"
71 #elif (BOARD == BOARD_RZUSBSTICK)
72 #include "RZUSBSTICK/LEDs.h"
73 #elif (BOARD == BOARD_ATAVRUSBRF01)
74 #include "ATAVRUSBRF01/LEDs.h"
75 #elif (BOARD == BOARD_USER)
76 #include "Board/LEDs.h"
77 #endif
78
79 /* Pseudo-Functions for Doxygen: */
80 #if defined(__DOXYGEN__)
81 /** Initializes the board LED driver so that the LEDs can be controlled. This sets the appropriate port
82 * I/O pins as outputs, and sets the LEDs to default to off.
83 */
84 static inline void LEDs_Init(void);
85
86 /** Turns on the LEDs specified in the given LED mask.
87 *
88 * \param LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)
89 */
90 static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask);
91
92 /** Turns off the LEDs specified in the given LED mask.
93 *
94 * \param LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)
95 */
96 static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask);
97
98 /** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED
99 * mask.
100 *
101 * \param LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)
102 */
103 static inline void LEDs_SetAllLEDs(const uint8_t LEDMask);
104
105 /** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs
106 * specified in both the LED and active masks.
107 *
108 * \param LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)
109 * \param ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off
110 */
111 static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask);
112
113 /** Returns the status of all the board LEDs; set LED masks in the return value indicate that the
114 * corresponding LED is on.
115 *
116 * \return Mask of the board LEDs which are currently turned on
117 */
118 static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
119 #endif
120
121 #endif
122
123 /** @} */