X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/d5810937bdf7fd5aab2629c58740eecac1ac3b7c..refs/pull/392/head:/armsrc/iso14443b.c diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index 82e5dd6a..22227e74 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -547,15 +547,20 @@ static RAMFUNC int Handle14443bSamplesDemod(int ci, int cq) } */ // Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq))) + + //note: couldn't we just use MAX(ABS(ci),ABS(cq)) + (MIN(ABS(ci),ABS(cq))/2) from common.h - marshmellow #define CHECK_FOR_SUBCARRIER() { \ + v = MAX(ABS(ci),ABS(cq)) + (MIN(ABS(ci),ABS(cq))/2); \ + } + /* if(ci < 0) { \ - if(cq < 0) { /* ci < 0, cq < 0 */ \ + if(cq < 0) { \ // ci < 0, cq < 0 if (cq < ci) { \ v = -cq - (ci >> 1); \ } else { \ v = -ci - (cq >> 1); \ } \ - } else { /* ci < 0, cq >= 0 */ \ + } else { \ // ci < 0, cq >= 0 if (cq < -ci) { \ v = -ci + (cq >> 1); \ } else { \ @@ -563,13 +568,13 @@ static RAMFUNC int Handle14443bSamplesDemod(int ci, int cq) } \ } \ } else { \ - if(cq < 0) { /* ci >= 0, cq < 0 */ \ + if(cq < 0) { \ // ci >= 0, cq < 0 if (-cq < ci) { \ v = ci - (cq >> 1); \ } else { \ v = -cq + (ci >> 1); \ } \ - } else { /* ci >= 0, cq >= 0 */ \ + } else { \ // ci >= 0, cq >= 0 if (cq < ci) { \ v = ci + (cq >> 1); \ } else { \ @@ -578,6 +583,7 @@ static RAMFUNC int Handle14443bSamplesDemod(int ci, int cq) } \ } \ } + */ switch(Demod.state) { case DEMOD_UNSYNCD: