testing still ongoing.
#include "cmdlft55xx.h"
#include "cmdlfpcf7931.h"
#include "cmdlfio.h"
+#include "lfdemod.h"
static int CmdHelp(const char *Cmd);
}
if (dataLen == 0){ //using DemodBuffer
if (clk==0) clk = GetPskClock(NULL, FALSE, FALSE);
- if (!carrier) carrier = GetPskCarrier(NULL, FALSE, FALSE);
+ if (!carrier) carrier = GetPskCarrier(NULL, FALSE, FALSE);
} else {
setDemodBuf(data, dataLen, 0);
}
if (clk <= 0) clk = 32;
if (carrier == 0) carrier = 2;
-
+ if (pskType != 1){
+ if (pskType == 2){
+ //need to convert psk2 to psk1 data before sim
+ psk2TOpsk1(DemodBuffer, DemodBufferLen);
+ } else {
+ PrintAndLog("Sorry, PSK3 not yet available");
+ }
+ }
uint16_t arg1, arg2;
arg1 = clk << 8 | carrier;
arg2 = invert;
return;
}
+// by marshmellow
+// convert psk2 demod to psk1 demod
+// from only transition waves are 1s to phase shifts change bit
+void psk2TOpsk1(uint8_t *BitStream, size_t size)
+{
+ size_t i;
+ uint8_t phase=BitStream[0];
+ //uint8_t lastBit=BitStream[0];
+ for (i=1; i<size; i++){
+ if (phase!=BitStream[i]){
+ phase ^=1;
+ }
+ BitStream[i]=phase;
+ }
+ return;
+}
+
// redesigned by marshmellow adjusted from existing decode functions
// indala id decoding - only tested on 26 bit tags, but attempted to make it work for more
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert)
uint32_t bytebits_to_byte(uint8_t* src, size_t numbits);
int nrzRawDemod(uint8_t *dest, size_t *size, int *clk, int *invert, int maxErr);
void psk1TOpsk2(uint8_t *BitStream, size_t size);
+void psk2TOpsk1(uint8_t *BitStream, size_t size);
int DetectNRZClock(uint8_t dest[], size_t size, int clock);
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert);
void pskCleanWave(uint8_t *bitStream, size_t size);