mirror of
https://github.com/Vale54321/schafkopf-bot.git
synced 2025-12-16 03:39:34 +01:00
added arduino nfcReader files (#42)
This commit is contained in:
committed by
GitHub
parent
76cb0eaf1a
commit
6259d0bef3
45
Arduino/nfcReader/NDEF/NfcAdapter.h
Normal file
45
Arduino/nfcReader/NDEF/NfcAdapter.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#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(boolean verbose=true);
|
||||
boolean tagPresent(unsigned long timeout=0); // tagAvailable
|
||||
NfcTag read();
|
||||
boolean write(NdefMessage& ndefMessage);
|
||||
// erase tag by writing an empty NDEF record
|
||||
boolean erase();
|
||||
// format a tag as NDEF
|
||||
boolean format();
|
||||
// reset tag back to factory state
|
||||
boolean clean();
|
||||
private:
|
||||
PN532* shield;
|
||||
byte uid[7]; // Buffer to store the returned UID
|
||||
unsigned int uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
|
||||
unsigned int guessTagType();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user