+ case (PN532_ERROR_PREAMBLEMISMATCH):
+ // Frame should start with 0x00 0x00 0xFF!
+ printf("Response frame doesn't start with expected preamble (00 00 FF)%s", CFG_PRINTF_NEWLINE);
+ break;
+ case (PN532_ERROR_APPLEVELERROR):
+ printf("Application level error reported by PN532%s", CFG_PRINTF_NEWLINE);
+ break;
+ case (PN532_ERROR_LENCHECKSUMMISMATCH):
+ printf("Frame length check/checksum mismatch%s", CFG_PRINTF_NEWLINE);
+ break;
+ default:
+ // Other errors handled below
+ break;
+ }
+
+ // Print the card details if possible
+ if (!error)
+ {
+ /* Response for ISO14443A 106KBPS (Mifare Classic, etc.)
+ See UM0701-02 section 7.3.5 for more information
+
+ byte Description
+ ------------- ------------------------------------------
+ b7 Tags Found
+ b8 Tag Number (only one used in this example)
+ b9..10 SENS_RES
+ b11 SEL_RES
+ b12 NFCID Length
+ b13..NFCIDLen NFCID
+
+ SENS_RES SEL_RES Manufacturer/Card Type NFCID Len
+ -------- ------- ----------------------- ---------
+ 00 04 08 NXP Mifare Classic 1K 4 bytes */
+
+ printf("%-12s: %d %s", "Tags Found", response[7], CFG_PRINTF_NEWLINE);
+ printf("%-12s: %02X %02X %s", "SENS_RES", response[9], response[10], CFG_PRINTF_NEWLINE);
+ printf("%-12s: %02X %s", "SEL_RES", response[11], CFG_PRINTF_NEWLINE);
+ printf("%-12s: ", "NFCID");
+ size_t pos;
+ for (pos=0; pos < response[12]; pos++)
+ {
+ printf("%02x ", response[13 + pos]);
+ }
+ printf(CFG_PRINTF_NEWLINE);
+ if ((response[9] == 0x00) && (response[10] == 0x04) && (response[11] == 0x08))
+ {
+ printf("Seems to be a Mifare Classic 1K Card%s", CFG_PRINTF_NEWLINE);
+ }
+ }
+ else
+ {
+ // Oops .... something bad happened. Check 'error'
+ printf("Ooops! Error %02X %s", error, CFG_PRINTF_NEWLINE);