X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fgoodfet.c;h=b9c500c8ca388f7482f5cd3e7046a2bec7afdaf9;hp=a3f3587624c41e2690980ef61a0ed0b2ef6b76d9;hb=dea6bf631cff92a6682f8898ec17315de1a305de;hpb=854dba571fe62948dfb23a396be3299225fcbb05 diff --git a/firmware/goodfet.c b/firmware/goodfet.c index a3f3587..b9c500c 100644 --- a/firmware/goodfet.c +++ b/firmware/goodfet.c @@ -18,10 +18,6 @@ //! Initialize registers and all that jazz. void init() { -#ifdef DAC12IR - int i; -#endif - WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer //LED out and on. @@ -61,7 +57,7 @@ void init() #ifdef DAC12IR //glitchvoltages(0xfff,0xfff); ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on - for(i=0;i!=0xFFFF;i++) asm("nop"); + //for(i=0;i!=0xFFFF;i++) asm("nop"); //DO NOT UNCOMMENT, breaks GCC4 DAC12_0CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1 DAC12_0DAT = 0xFFF; //Max voltage 0xfff DAC12_1CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1 @@ -85,37 +81,40 @@ void init() //Enable Interrupts. //eint(); - #ifdef INITPLATFORM - INITPLATFORM; - #endif +#ifdef INITPLATFORM + INITPLATFORM +#endif } //! Handle a command. void handle(uint8_t const app, - uint8_t const verb, - uint32_t const len){ - int i; - - //debugstr("GoodFET"); - PLEDOUT&=~PLEDPIN; - - // find the app and call the handle fn - for(i = 0; i < num_apps; i++){ - if(apps[i]->app == app){ - // call the app's handle fn - (*(apps[i]->handle))(app, verb, len); - - // exit early - return; - } - } - - // if we get here, then the desired app is not copiled in - // this firmware - debugstr("App missing."); - debughex(app); - txdata(app, NOK, 0); + uint8_t const verb, + uint32_t const len) +{ + int i; + + //debugstr("GoodFET"); + PLEDOUT&=~PLEDPIN; + + // find the app and call the handle fn + for(i = 0; i < num_apps; i++) + { + if(apps[i]->app == app) + { + // call the app's handle fn + (*(apps[i]->handle))(app, verb, len); + + // exit early + return; + } + } + + // if we get here, then the desired app is not copiled in + // this firmware + debugstr("App missing."); + debughex(app); + txdata(app, NOK, 0); }