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 
21 #ifndef FANCY_LEDS_H
22 #define FANCY_LEDS_H
23 
24 #include "board_common.h"
25 
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
29 
34 /* Take LED_COLOR as argument, i.e LED0 */
35 #define LED_FADE(led) \
36  volatile int i; \
37  int k, j; \
38  LED_FADE_EXPAND(led)
39 
40 #define LED_FADE_EXPAND(led) \
41  for(k = 0; k < 800; ++k) { \
42  j = k > 400 ? 800 - k : k; \
43  led##_ON; \
44  for(i = 0; i < j; ++i) { \
45  __asm__("nop"); \
46  } \
47  led##_OFF; \
48  for(i = 0; i < 400 - j; ++i) { \
49  __asm__("nop"); \
50  } \
51  }
52 
53 #define LED_RAINBOW() \
54  volatile int i; \
55  int k,j; \
56  LED_FADE_EXPAND(LED3); \
57  LED_FADE_EXPAND(LED0); \
58  LED_FADE_EXPAND(LED4); \
59  LED_FADE_EXPAND(LED2); \
60  LED_FADE_EXPAND(LED1);
61 
63 #ifdef __cplusplus
64 } /* end extern "C" */
65 #endif
66 #endif /* FANCY_LEDS_H */
67 
Support for the RE-Mote boards.