NFC library using PN532 to read/write NDEF Messages to NFC tags
Dependents: Seeed_NFC_Shield_write Nucleo_test_nfc
Fork of PN532 by
NfcAdapter.h
00001 #ifndef NfcAdapter_h 00002 #define NfcAdapter_h 00003 00004 #include <PN532Interface.h> 00005 #include <PN532.h > 00006 #include <NfcTag.h> 00007 #include <Ndef.h> 00008 00009 // Drivers 00010 #include <MifareClassic.h> 00011 #include <MifareUltralight.h> 00012 00013 #define TAG_TYPE_MIFARE_CLASSIC (0) 00014 #define TAG_TYPE_1 (1) 00015 #define TAG_TYPE_2 (2) 00016 #define TAG_TYPE_3 (3) 00017 #define TAG_TYPE_4 (4) 00018 #define TAG_TYPE_UNKNOWN (99) 00019 00020 #define IRQ (2) 00021 #define RESET (3) // Not connected by default on the NFC Shield 00022 00023 class NfcAdapter { 00024 public: 00025 NfcAdapter(PN532Interface &interface); 00026 00027 ~NfcAdapter(void); 00028 void begin(void); 00029 bool tagPresent(); // tagAvailable 00030 NfcTag read(); 00031 bool write(NdefMessage& ndefMessage); 00032 // FUTURE bool share(NdefMessage& ndefMessage); 00033 // FUTURE bool unshare(); 00034 // FUTURE bool erase(); 00035 // FUTURE bool format(); 00036 private: 00037 PN532* shield; 00038 uint8_t uid[7]; // Buffer to store the returned UID 00039 unsigned int uidLength; // Length of the UID (4 or 7 uint8_ts depending on ISO14443A card type) 00040 unsigned int guessTagType(); 00041 }; 00042 00043 #endif
Generated on Tue Jul 12 2022 21:59:39 by 1.7.2