-#define HANDLE_BIT_IF_BODY \
- if(triggered && tracing) {\
- uint8_t parity[MAX_PARITY_SIZE];\
- GetParity(receivedCmd, Uart.byteCnt, parity);\
- LogTrace(receivedCmd,Uart.byteCnt,samples, samples,parity,TRUE);\
- if(!tracing) {\
- DbpString("Reached trace limit");\
- break;\
- }\
- }\
- /* And ready to receive another command. */ \
- memset(&Uart, 0, sizeof(Uart)); \
- Uart.output = receivedCmd; \
- Uart.byteCntMax = 100; \
- Uart.state = STATE_UNSYNCD; \
- /* And also reset the demod code, which might have been */ \
- /* false-triggered by the commands from the reader. */ \
- memset(&Demod, 0, sizeof(Demod)); \
- Demod.output = receivedResponse; \
- Demod.state = DEMOD_UNSYNCD; \
-
- if(Handle14443UartBit(ci & 1)) {
- HANDLE_BIT_IF_BODY
- }
+ if(Handle14443UartBit(ci & 1)) {
+ if(triggered && tracing) {
+ GetParity(Uart.output, Uart.byteCnt, parity);
+ LogTrace(Uart.output,Uart.byteCnt,samples, samples,parity,TRUE);
+ }
+ if(Uart.byteCnt==0) Dbprintf("[1] Error, Uart.byteCnt==0, Uart.bitCnt=%d", Uart.bitCnt);
+
+ /* And ready to receive another command. */
+ UartReset();
+ /* And also reset the demod code, which might have been */
+ /* false-triggered by the commands from the reader. */
+ DemodReset();
+ }