-void SetLogFilename(char *fn)
-{
- logfilename = fn;
-}
-
-int manchester_decode( int * data, const size_t len, uint8_t * dataout){
-
- int bitlength = 0;
- int i, clock, high, low, startindex;
- low = startindex = 0;
- high = 1;
- uint8_t bitStream[len];
-
- memset(bitStream, 0x00, len);
-
- /* Detect high and lows */
- for (i = 0; i < len; i++) {
- if (data[i] > high)
- high = data[i];
- else if (data[i] < low)
- low = data[i];
- }
-
- /* get clock */
- clock = GetT55x7Clock( data, len, high );
- startindex = DetectFirstTransition(data, len, high);
-
- PrintAndLog(" Clock : %d", clock);
- PrintAndLog(" startindex : %d", startindex);
-
- if (high != 1)
- bitlength = ManchesterConvertFrom255(data, len, bitStream, high, low, clock, startindex);
- else
- bitlength= ManchesterConvertFrom1(data, len, bitStream, clock, startindex);
-
- if ( bitlength > 0 )
- PrintPaddedManchester(bitStream, bitlength, clock);
-
- memcpy(dataout, bitStream, bitlength);
-
- free(bitStream);
- return bitlength;