X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Flib%2Fmsp430.c;h=db3e56dd8af3c23d4abc5ac76250aeddcea83eb9;hb=473345590445f43c3f5dd8e5c3716c8f69b9b1cf;hp=ec1a5c80a5752bbe72332085927330553069846c;hpb=350c674c6bcd97ec2f883b07e0cf49eb8a480183;p=goodfet diff --git a/firmware/lib/msp430.c b/firmware/lib/msp430.c index ec1a5c8..db3e56d 100644 --- a/firmware/lib/msp430.c +++ b/firmware/lib/msp430.c @@ -16,7 +16,15 @@ 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,13 +32,38 @@ 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. void msp430_init(){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer @@ -39,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