Contiki 2.5
leds-arch.c
1 #include "contiki-conf.h"
2 #include "dev/models.h"
3 #include "dev/leds.h"
4 
5 #include "cc2430_sfr.h"
6 
7 /*
8  * Sensinode v1.0 HW products have 2 red LEDs, LED1 is mapped to the Contiki
9  * LEDS_RED and LED2 is mapped to LEDS_GREEN.
10  */
11 
12 /*---------------------------------------------------------------------------*/
13 void
15 {
16  P0DIR |= 0x30;
17 }
18 /*---------------------------------------------------------------------------*/
19 unsigned char
20 leds_arch_get(void)
21 {
22  unsigned char l = 0;
23 
24  if(LED1_PIN) {
25  l |= LEDS_RED;
26  }
27  if(LED2_PIN) {
28  l |= LEDS_GREEN;
29  }
30  return l;
31 }
32 /*---------------------------------------------------------------------------*/
33 void
34 leds_arch_set(unsigned char leds)
35 {
36  if(leds & LEDS_RED) {
37  LED1_PIN = 1;
38  } else {
39  LED1_PIN = 0;
40  }
41 
42  if(leds & LEDS_GREEN) {
43  LED2_PIN = 1;
44  } else {
45  LED2_PIN = 0;
46  }
47 
48 }
49 /*---------------------------------------------------------------------------*/