PN532 NFC library for Seeed Studio's NFC Shield

Fork of PN532 by Yihui Xiong

Revision:
3:4189a10038e6
Child:
5:51f820fbd18a
diff -r f618fb2169c4 -r 4189a10038e6 NfcAdapter.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NfcAdapter.h	Thu Nov 21 04:30:49 2013 +0000
@@ -0,0 +1,43 @@
+#ifndef NfcAdapter_h
+#define NfcAdapter_h
+
+#include <PN532Interface.h>
+#include <PN532.h>
+#include <NfcTag.h>
+#include <Ndef.h>
+
+// Drivers
+#include <MifareClassic.h>
+#include <MifareUltralight.h>
+
+#define TAG_TYPE_MIFARE_CLASSIC (0)
+#define TAG_TYPE_1 (1)
+#define TAG_TYPE_2 (2)
+#define TAG_TYPE_3 (3)
+#define TAG_TYPE_4 (4)
+#define TAG_TYPE_UNKNOWN (99)
+
+#define IRQ   (2)
+#define RESET (3)  // Not connected by default on the NFC Shield
+
+class NfcAdapter {
+    public:
+        NfcAdapter(PN532Interface &interface);
+
+        ~NfcAdapter(void);
+        void begin(void);
+        bool tagPresent(); // tagAvailable
+        NfcTag read();
+        bool write(NdefMessage& ndefMessage);
+        // FUTURE bool share(NdefMessage& ndefMessage);
+        // FUTURE bool unshare();
+        // FUTURE bool erase();
+        // FUTURE bool format();
+    private:
+        PN532* shield;
+        uint8_t uid[7];    // Buffer to store the returned UID
+        unsigned int uidLength; // Length of the UID (4 or 7 uint8_ts depending on ISO14443A card type)
+        unsigned int guessTagType();
+};
+
+#endif