leds-arch.c

00001 #include "contiki-conf.h"
00002 #include "dev/models.h"
00003 #include "dev/leds.h"
00004 
00005 #include "cc2430_sfr.h"
00006 
00007 /*
00008  * Sensinode v1.0 HW products have 2 red LEDs, LED1 is mapped to the Contiki
00009  * LEDS_RED and LED2 is mapped to LEDS_GREEN.
00010  */
00011 
00012 /*---------------------------------------------------------------------------*/
00013 void
00014 leds_arch_init(void)
00015 {
00016   P0DIR |= 0x30;
00017 }
00018 /*---------------------------------------------------------------------------*/
00019 unsigned char
00020 leds_arch_get(void)
00021 {
00022   unsigned char l = 0;
00023 
00024   if(LED1_PIN) {
00025     l |= LEDS_RED;
00026   }
00027   if(LED2_PIN) {
00028     l |= LEDS_GREEN;
00029   }
00030   return l;
00031 }
00032 /*---------------------------------------------------------------------------*/
00033 void
00034 leds_arch_set(unsigned char leds)
00035 {
00036   if(leds & LEDS_RED) {
00037     LED1_PIN = 1;
00038   } else {
00039     LED1_PIN = 0;
00040   }
00041 
00042   if(leds & LEDS_GREEN) {
00043     LED2_PIN = 1;
00044   } else {
00045     LED2_PIN = 0;
00046   }
00047 
00048 }
00049 /*---------------------------------------------------------------------------*/

Generated on Mon Apr 11 14:23:37 2011 for Contiki 2.5 by  doxygen 1.6.1