X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/2efd63948406db6dc65109c0cd5d79538acdd908..15d4bf3e7822a2b3863f15a2f0d7c5b9f5f76911:/armsrc/pcf7931.c diff --git a/armsrc/pcf7931.c b/armsrc/pcf7931.c index 2b23bc36..58fd5099 100644 --- a/armsrc/pcf7931.c +++ b/armsrc/pcf7931.c @@ -7,9 +7,6 @@ #define T0_PCF 8 //period for the pcf7931 in us #define ALLOC 16 -#define abs(x) ( ((x)<0) ? -(x) : (x) ) -#define max(x,y) ( xPIO_OER = GPIO_SSC_DOUT; //initialization of the timer - AT91C_BASE_PMC->PMC_PCER |= (0x1 << 12) | (0x1 << 13) | (0x1 << 14); + AT91C_BASE_PMC->PMC_PCER |= (0x1 << AT91C_ID_TC0); AT91C_BASE_TCB->TCB_BMR = AT91C_TCB_TC0XC0S_NONE | AT91C_TCB_TC1XC1S_TIOA0 | AT91C_TCB_TC2XC2S_NONE; AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS; // timer disable AT91C_BASE_TC0->TC_CMR = AT91C_TC_CLKS_TIMER_DIV3_CLOCK; //clock at 48/32 MHz @@ -413,27 +411,19 @@ void SendCmdPCF7931(uint32_t * tab){ tempo = AT91C_BASE_TC0->TC_CV; - for(u=0;tab[u]!= 0;u+=3){ - + for( u = 0; tab[u] != 0; u += 3){ // modulate antenna HIGH(GPIO_SSC_DOUT); - while(tempo != tab[u]){ - tempo = AT91C_BASE_TC0->TC_CV; - } + while(tempo != tab[u]) tempo = AT91C_BASE_TC0->TC_CV; // stop modulating antenna LOW(GPIO_SSC_DOUT); - while(tempo != tab[u+1]){ - tempo = AT91C_BASE_TC0->TC_CV; - } - + while(tempo != tab[u+1]) tempo = AT91C_BASE_TC0->TC_CV; // modulate antenna HIGH(GPIO_SSC_DOUT); - while(tempo != tab[u+2]){ - tempo = AT91C_BASE_TC0->TC_CV; - } + while(tempo != tab[u+2]) tempo = AT91C_BASE_TC0->TC_CV; } LED_A_OFF(); @@ -455,7 +445,7 @@ void SendCmdPCF7931(uint32_t * tab){ bool AddBytePCF7931(uint8_t byte, uint32_t * tab, int32_t l, int32_t p){ uint32_t u; - for (u=0; u<8; u++) + for ( u=0; u<8; u++) { if (byte&(1<