+ //if lastval was 1, we have a 1->0 crossing
+ if ( dest[idx-1] ) {
+ n=(n+1) / h2l_crossing_value;
+ } else {// 0->1 crossing
+ n=(n+1) / l2h_crossing_value;
+ }
+ if (n == 0) n = 1;
+
+ if(n < maxConsequtiveBits)
+ {
+ memset(dest+numBits, dest[idx-1] , n);
+ numBits += n;
+ }
+ n=0;
+ lastval=dest[idx];
+ }//end for
+
+ return numBits;
+
+}
+// loop to capture raw HID waveform then FSK demodulate the TAG ID from it
+void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
+{
+ uint8_t *dest = (uint8_t *)BigBuf;
+
+ size_t size=0,idx=0; //, found=0;
+ uint32_t hi2=0, hi=0, lo=0;
+
+ // Configure to go in 125Khz listen mode
+ LFSetupFPGAForADC(0, true);
+
+ while(!BUTTON_PRESS()) {
+