 }
 
 
-
+void resetAll()
+{
+  for(int i=0;i<NUMCOILS;i++)
+  {
+    reset(coilEnable[i]);
+  }
+}
+
+
+void reset(int pinNo)
+{
+    SPI.beginTransaction(SPISettings(SPI_CLOCK_DIV128, MSBFIRST, SPI_MODE2));
+    pinMode(pinNo, OUTPUT);
+    digitalWrite(pinNo,LOW);
+
+    delayMicroseconds(25);
+    SPI.transfer(highByte(0x2100));
+    SPI.transfer(lowByte(0x2100));
+
+    delayMicroseconds(25);
+    pinMode(pinNo, INPUT);
+    SPI.endTransaction();
+    delay(10);
+}
 
 
 void sendFreq(float freq, int pinNo)

// List of commands goes here.
const char cmdFreq[] = "FREQ";
const char cmdRead[] = "READ";

// Set master clock frequency to 6MHz
float f_MCK = 6000000.0;

// Default frequencies for each coil.
// The number of frequencies should match the number of coils
int coilFreqs[NUMCOILS] ={
	20500, // Coil 1
	21500, // Coil 2
	22500, // Coil 3
	23500, // Coil 4
	24500, // Coil 5
	25500, // Coil 6
	26500, // Coil 7
	27500  // Coil 8
};


		cmd = strtok(NULL, " :");
		return processFreqs(cmd);
	}
	else if(!strcmp(cmd, cmdRst)){
		resetAll();
	}
 else{return NACK;}
}


