- if(active || active_select)
- {
- c.arg[0] |= ISO14A_CONNECT;
- if(active)
- c.arg[0] |= ISO14A_NO_SELECT;
- }
+ if(crc && datalen>0 && datalen<sizeof(data)-2)
+ {
+ uint8_t first, second;
+ if (topazmode) {
+ ComputeCrc14443(CRC_14443_B, data, datalen, &first, &second);
+ } else {
+ ComputeCrc14443(CRC_14443_A, data, datalen, &first, &second);
+ }
+ data[datalen++] = first;
+ data[datalen++] = second;
+ }
+
+ if(active || active_select)
+ {
+ c.arg[0] |= ISO14A_CONNECT;
+ if(active)
+ c.arg[0] |= ISO14A_NO_SELECT;
+ }