!GEN is now 1 by default.
[goodfet] / firmware / apps / avr / avr.c
index 1cb67e9..53d9f30 100644 (file)
@@ -11,7 +11,7 @@
 #include <iomacros.h>
 
 #include "avr.h"
-#include "glitch.h"
+//#include "glitch.h"
 
 //! Setup the AVR pins.
 void avrsetup(){
@@ -21,17 +21,21 @@ void avrsetup(){
 //! Initialized an attached AVR.
 void avrconnect(){
   //set I/O pins
-  avrsetup();
+  avrsetup(); //Cut this?
+  
+  SETSS;
+  delay(50);
   
   //Pulse !RST (SS) at least twice while CLK is low.
   CLRCLK;
   CLRSS;
+  delay(5);
 
   SETSS;
   CLRCLK;
-  //delay(5);
+  delay(5);
   CLRSS;
-  //delay(5);
+  delay(5);
   
   //Enable programming
   avr_prgen();
@@ -133,7 +137,6 @@ void avrhandle(unsigned char app,
               unsigned long len){
   unsigned long i;
   unsigned int at;
-  static u8 connected=0;
   
   /*
   if(!avr_isready() && connected)
@@ -151,9 +154,10 @@ void avrhandle(unsigned char app,
     avrsetup();
     txdata(app,verb,0);
     break;
-  case START://returns device code
+  case START:
     avrconnect();
-    //no break here
+    txdata(app,verb,0);
+    break;//Used to fall through here.
   case AVR_PEEKSIG:
     for(i=0;i<4;i++)
       cmddata[i]=avr_sig(i);