Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
fancy_leds.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Freie Universität Berlin
3
* Copyright (C) 2015 Zolertia SL
4
*
5
* This file is subject to the terms and conditions of the GNU Lesser General
6
* Public License v2.1. See the file LICENSE in the top level directory for more
7
* details.
8
*/
9
20
#ifndef FANCY_LEDS_H
21
#define FANCY_LEDS_H
22
23
#include "
board_common.h
"
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
33
/* Take LED_COLOR as argument, i.e LED0 */
34
#define LED_FADE(led) \
35
volatile int i; \
36
int k, j; \
37
LED_FADE_EXPAND(led)
38
39
#define LED_FADE_EXPAND(led) \
40
for(k = 0; k < 800; ++k) { \
41
j = k > 400 ? 800 - k : k; \
42
led##_ON; \
43
for(i = 0; i < j; ++i) { \
44
__asm__("nop"); \
45
} \
46
led##_OFF; \
47
for(i = 0; i < 400 - j; ++i) { \
48
__asm__("nop"); \
49
} \
50
}
51
52
#define LED_RAINBOW() \
53
volatile int i; \
54
int k,j; \
55
LED_FADE_EXPAND(LED3); \
56
LED_FADE_EXPAND(LED0); \
57
LED_FADE_EXPAND(LED4); \
58
LED_FADE_EXPAND(LED2); \
59
LED_FADE_EXPAND(LED1);
62
#ifdef __cplusplus
63
}
/* end extern "C" */
64
#endif
65
#endif
/* FANCY_LEDS_H */
board_common.h
Board common definitions for the SODAQ boards.
Generated on Sat Nov 23 2024 01:58:06 by
1.9.8