changes to the GUI to allow for better loading and writing as well as tested our...
[goodfet] / firmware / lib / msp430.c
index 1684f59..db3e56d 100644 (file)
 void led_init()
 {
        PLEDDIR |= PLEDPIN;
+       #ifdef PLED2OUT
+       PLED2DIR |= PLED2PIN;
+       #endif
+       #ifdef PLED3OUT
+       PLED3DIR |= PLED3PIN;
+       #endif
 }
+
+//TODO define differently if needed for telos/apimote
 void led_on()
 {
        PLEDOUT |= PLEDPIN;
@@ -24,10 +32,36 @@ void led_on()
 void led_off()
 {
   PLEDOUT&=~PLEDPIN;
-
 }
 void led_toggle()
 {
+       PLEDOUT ^= PLEDPIN;
+}
+
+//LED2 and LED3 are only used by the telosb and apimote for now
+void led2_on()
+{
+#ifdef PLED2OUT
+    PLED2OUT &= ~PLED2PIN;
+#endif
+}
+void led2_off()
+{
+#ifdef PLED2OUT
+    PLED2OUT |= PLED2PIN;
+#endif
+}
+void led3_on()
+{
+#ifdef PLED3OUT
+    PLED3OUT &= ~PLED3PIN;
+#endif
+}
+void led3_off()
+{
+#ifdef PLED3OUT
+    PLED3OUT |= PLED3PIN;
+#endif
 }
 
 //! Initialize MSP430 registers and all that jazz.
@@ -38,7 +72,6 @@ void msp430_init(){
        led_init();
        led_off();
 
-
        /* P5.0 out and low; this is chosen for the PIC app (in which P5.0
         is !MCLR) to ensure that an attached PIC chip, if present, is
         immediately driven to reset state. A brief explanation of why this
@@ -79,13 +112,13 @@ void msp430_init(){
 #endif
 
        /** FIXME
-         
+
          This part is really ugly.  GSEL (P5.7) must be high to select
          normal voltage, but a lot of applications light to swing it low
          to be a nuissance.  To get around this, we assume that anyone
          with a glitching FET will also have a DAC, then we set that DAC
          to a high voltage.
-         
+
          At some point, each target must be sanitized to show that it
          doesn't clear P5OUT or P5DIR.
        */