Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
fancy_leds.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2014 Freie Universität Berlin
3
* SPDX-FileCopyrightText: 2015 Zolertia SL
4
* SPDX-License-Identifier: LGPL-2.1-only
5
*/
6
7
#pragma once
8
19
#include "
board_common.h
"
20
21
#ifdef __cplusplus
22
extern
"C"
{
23
#endif
24
29
/* Take LED_COLOR as argument, i.e LED0 */
30
#define LED_FADE(led) \
31
volatile int i; \
32
int k, j; \
33
LED_FADE_EXPAND(led)
34
35
#define LED_FADE_EXPAND(led) \
36
for(k = 0; k < 800; ++k) { \
37
j = k > 400 ? 800 - k : k; \
38
led##_ON; \
39
for(i = 0; i < j; ++i) { \
40
__asm__("nop"
); \
41
} \
42
led##_OFF; \
43
for(i = 0; i < 400 - j; ++i) { \
44
__asm__("nop"); \
45
} \
46
}
47
48
#define LED_RAINBOW() \
49
volatile int i; \
50
int k,j; \
51
LED_FADE_EXPAND(LED3); \
52
LED_FADE_EXPAND(LED0); \
53
LED_FADE_EXPAND(LED4); \
54
LED_FADE_EXPAND(LED2); \
55
LED_FADE_EXPAND(LED1);
58
#ifdef __cplusplus
59
}
/* end extern "C" */
60
#endif
board_common.h
Board common definitions for the SODAQ boards.
Generated on Thu Jul 24 2025 16:03:56 by
1.9.1