Generic library for working with PN532-like chips

Fork of PN532 by Seeed

Revision:
10:f959b305a571
Parent:
9:85bfede025da
--- a/NfcAdapter.cpp	Wed Feb 04 16:24:30 2015 +0000
+++ b/NfcAdapter.cpp	Wed Feb 04 19:04:54 2015 +0000
@@ -17,12 +17,12 @@
 
     uint32_t versiondata = shield->getFirmwareVersion();
     if (! versiondata) {
-        DMSG("Didn't find PN53x board");
+        DMSG("Didn't find PN53x board\n");
         while (1); // halt
     }
     
-    DMSG("Found chip PN5%2X\r\n", versiondata >> 24);
-    DMSG("Firmware V%d.%d\r\n", (versiondata >> 16) & 0xFF, (versiondata >> 8) & 0xFF);
+    DMSG("Found chip PN5%2X\n", versiondata >> 24);
+    DMSG("Firmware V%d.%d\n", (versiondata >> 16) & 0xFF, (versiondata >> 8) & 0xFF);
 
     // configure board to read RFID tags
     shield->SAMConfig();
@@ -57,7 +57,7 @@
     if (type == TAG_TYPE_MIFARE_CLASSIC)
     {
         #ifdef NDEF_DEBUG
-        DMSG("Reading Mifare Classic");
+        DMSG("Reading Mifare Classic\n");
         #endif
         MifareClassic mifareClassic = MifareClassic(*shield);
         return mifareClassic.read(uid, uidLength);
@@ -65,14 +65,14 @@
     else if (type == TAG_TYPE_2)
     {
         #ifdef NDEF_DEBUG
-        DMSG("Reading Mifare Ultralight");
+        DMSG("Reading Mifare Ultralight\n");
         #endif
         MifareUltralight ultralight = MifareUltralight(*shield);
         return ultralight.read(uid, uidLength);
     }
     else if (type == TAG_TYPE_UNKNOWN)
     {
-        DMSG("Can not determine tag type");
+        DMSG("Can not determine tag type\n");
         //DMSG("Can not determine tag type for ATQA 0x");
         //Serial.print(atqa, HEX);DMSG(" SAK 0x");DMSG(sak, HEX);
         return NfcTag(uid, uidLength);
@@ -81,6 +81,7 @@
     {
         DMSG("No driver for card type ");
         DMSG_INT(type);
+        DMSG("\n");
         // TODO should set type here
         return NfcTag(uid, uidLength);
     }
@@ -98,7 +99,7 @@
     }
     else
     {
-        DMSG("Ultralight Tag");
+        DMSG("Ultralight Tag\n");
         MifareUltralight mifareUltralight = MifareUltralight(*shield);
         success= mifareUltralight.write(ndefMessage, uid, uidLength);
         //success = false;
@@ -119,8 +120,9 @@
     //  - ATQA 0x44 && SAK 0x0 - Mifare Ultralight NFC Forum Type 2
     //  - ATQA 0x344 && SAK 0x20 - NFC Forum Type 4
     DMSG("Guess type");
-    DMSG("ATQA: 0x");  DMSG_HEX(ATQA);
-    DMSG("SAK: 0x");  DMSG_HEX(SAK);
+    DMSG(" ATQA: 0x");  DMSG_HEX(ATQA);
+    DMSG(" SAK: 0x");  DMSG_HEX(SAK);
+    DMSG("\n");
     /*if (uidLength == 4)
     {
         return TAG_TYPE_MIFARE_CLASSIC;