From: marshmellow42 Date: Sun, 22 Feb 2015 03:54:52 +0000 (-0500) Subject: added PSK2 to lf simpsk X-Git-Tag: show~6^2~16 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/3bc66a96fe60139015ddaa0b8fb12259675ff897?ds=sidebyside;hp=872e3d4d6f6dd1ae01ef67e4ad8255243f1e24ec added PSK2 to lf simpsk testing still ongoing. --- diff --git a/client/cmdlf.c b/client/cmdlf.c index b2372101..d3ea8eea 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -28,6 +28,7 @@ #include "cmdlft55xx.h" #include "cmdlfpcf7931.h" #include "cmdlfio.h" +#include "lfdemod.h" static int CmdHelp(const char *Cmd); @@ -853,13 +854,20 @@ int CmdLFpskSim(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; diff --git a/common/lfdemod.c b/common/lfdemod.c index 79252dd9..bee87ece 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -1068,6 +1068,23 @@ void psk1TOpsk2(uint8_t *BitStream, size_t size) 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