]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - common/lfdemod.c
added PSK2 to lf simpsk
[proxmark3-svn] / common / lfdemod.c
index 96b187b765ae0561a87600b27e207d58ddfba20b..bee87ece7b5b5c93b10e13472ca1e2708b2abf72 100644 (file)
@@ -25,7 +25,7 @@ uint8_t justNoise(uint8_t *BitStream, size_t size)
 }
 
 //by marshmellow
-//get high and low with passed in fuzz factor. also return noise test = 1 for passed or 0 for only noise
+//get high and low values of a wave with passed in fuzz factor. also return noise test = 1 for passed or 0 for only noise
 int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo)
 {
        *high=0;
@@ -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<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)
Impressum, Datenschutz