Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
led.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Freie Universität Berlin
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
32
#ifndef LED_H
33
#define LED_H
34
35
#include "board.h"
36
37
#ifdef __cplusplus
38
extern
"C"
{
39
#endif
40
45
#ifndef LED0_ON
46
#define LED0_ON
47
#define LED0_OFF
48
#define LED0_TOGGLE
49
#else
50
#define LED0_IS_PRESENT
51
#endif
52
53
#ifndef LED1_ON
54
#define LED1_ON
55
#define LED1_OFF
56
#define LED1_TOGGLE
57
#else
58
#define LED1_IS_PRESENT
59
#endif
60
61
#ifndef LED2_ON
62
#define LED2_ON
63
#define LED2_OFF
64
#define LED2_TOGGLE
65
#else
66
#define LED2_IS_PRESENT
67
#endif
68
69
#ifndef LED3_ON
70
#define LED3_ON
71
#define LED3_OFF
72
#define LED3_TOGGLE
73
#else
74
#define LED3_IS_PRESENT
75
#endif
76
77
#ifndef LED4_ON
78
#define LED4_ON
79
#define LED4_OFF
80
#define LED4_TOGGLE
81
#else
82
#define LED4_IS_PRESENT
83
#endif
84
85
#ifndef LED5_ON
86
#define LED5_ON
87
#define LED5_OFF
88
#define LED5_TOGGLE
89
#else
90
#define LED5_IS_PRESENT
91
#endif
92
93
#ifndef LED6_ON
94
#define LED6_ON
95
#define LED6_OFF
96
#define LED6_TOGGLE
97
#else
98
#define LED6_IS_PRESENT
99
#endif
100
101
#ifndef LED7_ON
102
#define LED7_ON
103
#define LED7_OFF
104
#define LED7_TOGGLE
105
#else
106
#define LED7_IS_PRESENT
107
#endif
108
112
#if defined(LED7_IS_PRESENT)
113
#define LED_NUMOF 8
114
#elif defined(LED6_IS_PRESENT)
115
#define LED_NUMOF 7
116
#elif defined(LED5_IS_PRESENT)
117
#define LED_NUMOF 6
118
#elif defined(LED4_IS_PRESENT)
119
#define LED_NUMOF 5
120
#elif defined(LED3_IS_PRESENT)
121
#define LED_NUMOF 4
122
#elif defined(LED2_IS_PRESENT)
123
#define LED_NUMOF 3
124
#elif defined(LED1_IS_PRESENT)
125
#define LED_NUMOF 2
126
#elif defined(LED0_IS_PRESENT)
127
#define LED_NUMOF 1
128
#else
129
#define LED_NUMOF 0
130
#endif
131
138
#define LED_ON(id) LED ## id ##_ON
139
#define LED_OFF(id) LED ## id ## _OFF
140
#define LED_TOGGLE(id) LED ## id ##_TOGGLE
149
static
inline
void
led_on
(
unsigned
id
)
150
{
151
switch
(
id
) {
152
case
0:
LED0_ON
;
break
;
153
case
1:
LED1_ON
;
break
;
154
case
2:
LED2_ON
;
break
;
155
case
3:
LED3_ON
;
break
;
156
case
4:
LED4_ON
;
break
;
157
case
5:
LED5_ON
;
break
;
158
case
6:
LED6_ON
;
break
;
159
case
7:
LED7_ON
;
break
;
160
}
161
}
162
170
static
inline
void
led_off
(
unsigned
id
)
171
{
172
switch
(
id
) {
173
case
0:
LED0_OFF
;
break
;
174
case
1:
LED1_OFF
;
break
;
175
case
2:
LED2_OFF
;
break
;
176
case
3:
LED3_OFF
;
break
;
177
case
4:
LED4_OFF
;
break
;
178
case
5:
LED5_OFF
;
break
;
179
case
6:
LED6_OFF
;
break
;
180
case
7:
LED7_OFF
;
break
;
181
}
182
}
183
191
static
inline
void
led_toggle
(
unsigned
id
)
192
{
193
switch
(
id
) {
194
case
0:
LED0_TOGGLE
;
break
;
195
case
1:
LED1_TOGGLE
;
break
;
196
case
2:
LED2_TOGGLE
;
break
;
197
case
3:
LED3_TOGGLE
;
break
;
198
case
4:
LED4_TOGGLE
;
break
;
199
case
5:
LED5_TOGGLE
;
break
;
200
case
6:
LED6_TOGGLE
;
break
;
201
case
7:
LED7_TOGGLE
;
break
;
202
}
203
}
204
207
#ifdef __cplusplus
208
}
209
#endif
210
211
#endif
/* LED_H */
LED3_TOGGLE
#define LED3_TOGGLE
defined empty
Definition
led.h:72
LED3_OFF
#define LED3_OFF
defined empty
Definition
led.h:71
LED4_ON
#define LED4_ON
defined empty
Definition
led.h:78
led_on
static void led_on(unsigned id)
Turn on an LED.
Definition
led.h:149
LED0_ON
#define LED0_ON
defined empty
Definition
led.h:46
LED1_TOGGLE
#define LED1_TOGGLE
defined empty
Definition
led.h:56
LED7_TOGGLE
#define LED7_TOGGLE
defined empty
Definition
led.h:104
LED1_OFF
#define LED1_OFF
defined empty
Definition
led.h:55
LED7_OFF
#define LED7_OFF
defined empty
Definition
led.h:103
LED4_OFF
#define LED4_OFF
defined empty
Definition
led.h:79
LED5_TOGGLE
#define LED5_TOGGLE
defined empty
Definition
led.h:88
LED6_OFF
#define LED6_OFF
defined empty
Definition
led.h:95
LED6_ON
#define LED6_ON
defined empty
Definition
led.h:94
LED4_TOGGLE
#define LED4_TOGGLE
defined empty
Definition
led.h:80
led_off
static void led_off(unsigned id)
Turn off an LED.
Definition
led.h:170
LED5_OFF
#define LED5_OFF
defined empty
Definition
led.h:87
LED1_ON
#define LED1_ON
defined empty
Definition
led.h:54
LED2_ON
#define LED2_ON
defined empty
Definition
led.h:62
LED2_OFF
#define LED2_OFF
defined empty
Definition
led.h:63
LED3_ON
#define LED3_ON
defined empty
Definition
led.h:70
LED2_TOGGLE
#define LED2_TOGGLE
defined empty
Definition
led.h:64
LED7_ON
#define LED7_ON
defined empty
Definition
led.h:102
LED0_TOGGLE
#define LED0_TOGGLE
defined empty
Definition
led.h:48
led_toggle
static void led_toggle(unsigned id)
Toggle an LED.
Definition
led.h:191
LED0_OFF
#define LED0_OFF
defined empty
Definition
led.h:47
LED5_ON
#define LED5_ON
defined empty
Definition
led.h:86
LED6_TOGGLE
#define LED6_TOGGLE
defined empty
Definition
led.h:96
Generated on Sat Nov 23 2024 16:31:08 by
1.9.8