MFRC522 RFID Reader 1.0.0
This is a library for the MFRC522 RFID reader.
Loading...
Searching...
No Matches
MFRC522Extended.h
Go to the documentation of this file.
1
6#ifndef MFRC522Extended_h
7#define MFRC522Extended_h
8
9#include <Arduino.h>
10#include "MFRC522.h"
11
12class MFRC522Extended : public MFRC522 {
13
14public:
15 // ISO/IEC 14443-4 bit rates
16 enum TagBitRates : byte {
20 BITRATE_848KBITS = 0x03
21 };
22
23 // Structure to store ISO/IEC 14443-4 ATS
24 typedef struct {
25 byte size;
26 byte fsc; // Frame size for proximity card
27
28 struct {
30 bool sameD; // Only the same D for both directions supported
31 TagBitRates ds; // Send D
32 TagBitRates dr; // Receive D
33 } ta1;
34
35 struct {
36 bool transmitted;
37 byte fwi; // Frame waiting time integer
38 byte sfgi; // Start-up frame guard time integer
39 } tb1;
40
41 struct {
42 bool transmitted;
45 } tc1;
46
47 // Raw data from ATS
48 byte data[FIFO_SIZE - 2]; // ATS cannot be bigger than FSD - 2 bytes (CRC), according to ISO 14443-4 5.2.2
49 } Ats;
50
51 // A struct used for passing the PICC information
52 typedef struct {
53 uint16_t atqa;
56
57 // For Block PCB
59 } TagInfo;
60
61 // A struct used for passing PCB Block
62 typedef struct {
63 struct {
64 byte pcb;
65 byte cid;
66 byte nad;
67 } prologue;
68 struct {
69 byte size;
70 byte *data;
71 } inf;
72 } PcbBlock;
73
74 // Member variables
76
78 // Contructors
81 MFRC522Extended(uint8_t rst) : MFRC522(rst) {};
82 MFRC522Extended(uint8_t ss, uint8_t rst) : MFRC522(ss, rst) {};
83
85 // Functions for communicating with PICCs
87 StatusCode PICC_Select(Uid *uid, byte validBits = 0) override; // overrride
89 StatusCode PICC_PPS(); // PPS command without bitrate parameter
90 StatusCode PICC_PPS(TagBitRates sendBitRate, TagBitRates receiveBitRate); // Different D values
91
93 // Functions for communicating with ISO/IEC 14433-4 cards
95 StatusCode TCL_Transceive(PcbBlock *send, PcbBlock *back);
96 StatusCode TCL_Transceive(TagInfo * tag, byte *sendData, byte sendLen, byte *backData = NULL, byte *backLen = NULL);
97 StatusCode TCL_TransceiveRBlock(TagInfo *tag, bool ack, byte *backData = NULL, byte *backLen = NULL);
98 StatusCode TCL_Deselect(TagInfo *tag);
99
101 // Support functions
103 static PICC_Type PICC_GetType(TagInfo *tag);
104 using MFRC522::PICC_GetType;// // make old PICC_GetType(byte sak) available, otherwise would be hidden by PICC_GetType(TagInfo *tag)
105
106 // Support functions for debuging
107 void PICC_DumpToSerial(TagInfo *tag);
108 using MFRC522::PICC_DumpToSerial; // make old PICC_DumpToSerial(Uid *uid) available, otherwise would be hidden by PICC_DumpToSerial(TagInfo *tag)
109 void PICC_DumpDetailsToSerial(TagInfo *tag);
110 using MFRC522::PICC_DumpDetailsToSerial; // make old PICC_DumpDetailsToSerial(Uid *uid) available, otherwise would be hidden by PICC_DumpDetailsToSerial(TagInfo *tag)
111 void PICC_DumpISO14443_4(TagInfo *tag);
112
114 // Convenience functions - does not add extra functionality
116 bool PICC_IsNewCardPresent() override; // overrride
117 bool PICC_ReadCardSerial() override; // overrride
118};
119
120#endif
Definition: MFRC522Extended.h:12
MFRC522Extended()
Definition: MFRC522Extended.h:80
StatusCode PICC_Select(Uid *uid, byte validBits=0) override
Definition: MFRC522Extended.cpp:31
void PICC_DumpToSerial(TagInfo *tag)
Definition: MFRC522Extended.cpp:988
StatusCode PICC_RequestATS(Ats *ats)
Definition: MFRC522Extended.cpp:345
StatusCode TCL_Deselect(TagInfo *tag)
Definition: MFRC522Extended.cpp:923
MFRC522Extended(uint8_t ss, uint8_t rst)
Definition: MFRC522Extended.h:82
void PICC_DumpDetailsToSerial(TagInfo *tag)
Definition: MFRC522Extended.cpp:1036
TagBitRates
Definition: MFRC522Extended.h:16
@ BITRATE_212KBITS
Definition: MFRC522Extended.h:18
@ BITRATE_106KBITS
Definition: MFRC522Extended.h:17
@ BITRATE_848KBITS
Definition: MFRC522Extended.h:20
@ BITRATE_424KBITS
Definition: MFRC522Extended.h:19
void PICC_DumpISO14443_4(TagInfo *tag)
Definition: MFRC522Extended.cpp:1075
StatusCode TCL_Transceive(PcbBlock *send, PcbBlock *back)
Definition: MFRC522Extended.cpp:663
TagInfo tag
Definition: MFRC522Extended.h:75
StatusCode PICC_PPS()
Definition: MFRC522Extended.cpp:532
MFRC522Extended(uint8_t rst)
Definition: MFRC522Extended.h:81
static PICC_Type PICC_GetType(TagInfo *tag)
Definition: MFRC522Extended.cpp:958
bool PICC_ReadCardSerial() override
Definition: MFRC522Extended.cpp:1151
StatusCode TCL_TransceiveRBlock(TagInfo *tag, bool ack, byte *backData=NULL, byte *backLen=NULL)
Definition: MFRC522Extended.cpp:862
bool PICC_IsNewCardPresent() override
Definition: MFRC522Extended.cpp:1102
Definition: MFRC522.h:78
static constexpr byte FIFO_SIZE
Definition: MFRC522.h:81
void PICC_DumpDetailsToSerial(Uid *uid)
Definition: MFRC522.cpp:1418
void PICC_DumpToSerial(Uid *uid)
Definition: MFRC522.cpp:1373
StatusCode
Definition: MFRC522.h:242
PICC_Type
Definition: MFRC522.h:226
static PICC_Type PICC_GetType(byte sak)
Definition: MFRC522.cpp:1300
Uid uid
Definition: MFRC522.h:267
Definition: MFRC522.h:255
Definition: MFRC522Extended.h:24
byte size
Definition: MFRC522Extended.h:25
bool supportsNAD
Definition: MFRC522Extended.h:44
TagBitRates dr
Definition: MFRC522Extended.h:32
bool sameD
Definition: MFRC522Extended.h:30
bool transmitted
Definition: MFRC522Extended.h:29
bool supportsCID
Definition: MFRC522Extended.h:43
byte fwi
Definition: MFRC522Extended.h:37
byte sfgi
Definition: MFRC522Extended.h:38
TagBitRates ds
Definition: MFRC522Extended.h:31
byte fsc
Definition: MFRC522Extended.h:26
byte nad
Definition: MFRC522Extended.h:66
byte * data
Definition: MFRC522Extended.h:70
byte pcb
Definition: MFRC522Extended.h:64
byte size
Definition: MFRC522Extended.h:69
byte cid
Definition: MFRC522Extended.h:65
Definition: MFRC522Extended.h:52
Uid uid
Definition: MFRC522Extended.h:54
uint16_t atqa
Definition: MFRC522Extended.h:53
Ats ats
Definition: MFRC522Extended.h:55
bool blockNumber
Definition: MFRC522Extended.h:58