Removing the ugliest of hacks.
[goodfet] / firmware / apps / glitch / glitch.c
index 9077245..2242448 100644 (file)
@@ -64,19 +64,14 @@ void glitchsetupdac(){
 interrupt(TIMERA0_VECTOR) Timer_A (void)
 {
 #ifdef DAC12IR
-  debugstr("Glitching.");
-  DAC12_0DAT = 0;//glitchL;
-  asm("nop");/*
+  //debugstr("Glitching.");
+  DAC12_0DAT = glitchL;
   asm("nop");
   asm("nop");
   asm("nop");
   asm("nop");
   asm("nop");
-  asm("nop");
-  asm("nop");
-  asm("nop");
-  asm("nop");*/
-  //DAC12_0DAT = glitchH;
+  DAC12_0DAT = glitchH;
   //DAC12_0DAT = glitchL;
   /*
   switch(glitchstate){
@@ -117,6 +112,7 @@ void glitchvoltages(u16 low, u16 high){
   glitchH=high;
   glitchL=low;
   
+  //debugstr("Set glitching voltages.");
   
   #ifdef DAC12IR
   ADC12CTL0 = REF2_5V + REFON;                  // Internal 2.5V ref on
@@ -133,7 +129,6 @@ void glitchrate(u16 rate){
   glitchcount=rate;
 }
 
-
 //! Handles a monitor command.
 void glitchhandle(unsigned char app,
                  unsigned char verb,
@@ -153,6 +148,20 @@ void glitchhandle(unsigned char app,
     glitchprime();
     handle(cmddata[0],cmddata[1],0);
     break;
+  case GLITCHTIME:
+    _DINT();//disable interrupts
+    TACTL=0; //clear dividers
+    TACTL|=TACLR; //clear config
+    TACTL|=TASSEL_SMCLK| //smclk source
+      MC_2; //continuout mode.
+    
+    //perform the function
+    silent++;//Don't want the function to return anything.
+    handle(cmddata[0],cmddata[1],0);
+    silent--;
+    cmddataword[0]=TAR; //Return counter.
+    txdata(app,verb,2);
+    break;
   case START:
   case STOP:
   case GLITCHAPP: