Paparazzi UAS  v5.15_devel-88-gb3ad7fe
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
led.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2005 Antoine Drouin
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
29 #ifndef LED_H
30 #define LED_H
31 
32 #if defined USE_LED
33 
34 #include "led_hw.h"
35 
39 static inline void led_init(void)
40 {
41 #if USE_LED_1
42  LED_INIT(1);
43  LED_OFF(1);
44 #endif /* LED_1 */
45 
46 #if USE_LED_2
47  LED_INIT(2);
48  LED_OFF(2);
49 #endif /* LED_2 */
50 
51 #if USE_LED_3
52  LED_INIT(3);
53  LED_OFF(3);
54 #endif /* LED_3 */
55 
56 #if USE_LED_4
57  LED_INIT(4);
58  LED_OFF(4);
59 #endif /* LED_4 */
60 
61 #if USE_LED_5
62  LED_INIT(5);
63  LED_OFF(5);
64 #endif /* LED_5 */
65 
66 #if USE_LED_6
67  LED_INIT(6);
68  LED_OFF(6);
69 #endif /* LED_6 */
70 
71 #if USE_LED_7
72  LED_INIT(7);
73  LED_OFF(7);
74 #endif /* LED_7 */
75 
76 #if USE_LED_8
77  LED_INIT(8);
78  LED_OFF(8);
79 #endif /* LED_8 */
80 
81 #if USE_LED_9
82  LED_INIT(9);
83  LED_OFF(9);
84 #endif /* LED_9 */
85 
86 #if USE_LED_10
87  LED_INIT(10);
88  LED_OFF(10);
89 #endif /* LED_10 */
90 
91 #ifdef USE_LED_BODY
92  LED_INIT(BODY);
93  LED_OFF(BODY);
94 #endif /* LED_BODY */
95 
96 #if USE_LED_12
97  LED_INIT(12);
98  LED_OFF(12);
99 #endif /* LED_12 */
100 }
101 
105 static inline void led_disable(void)
106 {
107 #if USE_LED_1
108  LED_DISABLE(1);
109 #endif /* LED_1 */
110 
111 #if USE_LED_2
112  LED_DISABLE(2);
113 #endif /* LED_2 */
114 
115 #if USE_LED_3
116  LED_DISABLE(3);
117 #endif /* LED_3 */
118 
119 #if USE_LED_4
120  LED_DISABLE(4);
121 #endif /* LED_4 */
122 
123 #if USE_LED_5
124  LED_DISABLE(5);
125 #endif /* LED_5 */
126 
127 #if USE_LED_6
128  LED_DISABLE(6);
129 #endif /* LED_6 */
130 
131 #if USE_LED_7
132  LED_DISABLE(7);
133 #endif /* LED_7 */
134 
135 #if USE_LED_8
136  LED_DISABLE(8);
137 #endif /* LED_8 */
138 
139 #if USE_LED_9
140  LED_DISABLE(9);
141 #endif /* LED_9 */
142 
143 #if USE_LED_10
144  LED_DISABLE(10);
145 #endif /* LED_10 */
146 
147 #ifdef USE_LED_BODY
148  LED_DISABLE(BODY);
149 #endif /* LED_BODY */
150 
151 #if USE_LED_12
152  LED_DISABLE(12);
153 #endif /* LED_12 */
154 }
155 
156 #define _LED_AVAILABLE(i) USE_LED_ ## i
157 #define LED_AVAILABLE(i) _LED_AVAILABLE(i)
158 
159 #else /* USE_LED */
160 static inline void led_init(void) {}
161 static inline void led_disable(void) {}
162 #define LED_ON(i) {}
163 #define LED_OFF(i) {}
164 #define LED_TOGGLE(i) {}
165 #define LED_DISABLE(i) {}
166 #define LED_PERIODIC() {}
167 #define LED_AVAILABLE(i) 0
168 #endif /* USE_LED */
169 
170 #endif /* LED_H */
#define LED_OFF(i)
Definition: led_hw.h:52
#define LED_INIT(i)
Definition: led_hw.h:50
static void led_init(void)
Automatic initialization of actived LED Set to OFF at startup.
Definition: led.h:39
static void led_disable(void)
Automatic disabling of activated LED Usually by setting control GPIO in high impedance input mode...
Definition: led.h:105
#define LED_DISABLE(i)
Definition: led_hw.h:54