X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/8e21541e77dd0909a99a1ed1106a6df87d34a247..36b1cdd1b4064e1a506b5bab0d00e61b91cb10b2:/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: