X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Flib%2Fmsp430.c;h=19bca37df3aadaedc45ccaf1538fe8533a179f57;hb=c33b056d1a565968e6aca5cffcb4c2b178f8d4d4;hp=3a71e1457b99624a6c1775483544ee6968584e1e;hpb=0fdf6e0b883ba3f7661e555145a3601609729e89;p=goodfet diff --git a/firmware/lib/msp430.c b/firmware/lib/msp430.c index 3a71e14..19bca37 100644 --- a/firmware/lib/msp430.c +++ b/firmware/lib/msp430.c @@ -13,14 +13,31 @@ #include "apps.h" #include "glitch.h" +void led_init() +{ + PLEDDIR |= PLEDPIN; +} + +void led_on() +{ + PLEDOUT |= PLEDPIN; +} +void led_off() +{ + PLEDOUT&=~PLEDPIN; +} +void led_toggle() +{ + PLEDOUT ^= PLEDPIN; +} //! Initialize MSP430 registers and all that jazz. void msp430_init(){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer //LED out and on. - PLEDDIR |= PLEDPIN; - PLEDOUT &= ~PLEDPIN; + led_init(); + led_off(); /* P5.0 out and low; this is chosen for the PIC app (in which P5.0 @@ -63,13 +80,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. */