//! Initialize registers and all that jazz.
void init()
{
-#ifdef DAC12IR
- int i;
-#endif
-
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
//LED out and on.
#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
//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);
}