code style
- remove int-values of enums StatusCode and PICC_Type which are not part of any specification - changed MFRC522::StatusCode to only StatusCode which is better readable, was my fault sry
This commit is contained in:
80
MFRC522.h
80
MFRC522.h
@@ -273,29 +273,29 @@ public:
|
|||||||
|
|
||||||
// PICC types we can detect. Remember to update PICC_GetTypeName() if you add more.
|
// PICC types we can detect. Remember to update PICC_GetTypeName() if you add more.
|
||||||
enum PICC_Type {
|
enum PICC_Type {
|
||||||
PICC_TYPE_UNKNOWN = 0,
|
PICC_TYPE_UNKNOWN ,
|
||||||
PICC_TYPE_ISO_14443_4 = 1, // PICC compliant with ISO/IEC 14443-4
|
PICC_TYPE_ISO_14443_4 , // PICC compliant with ISO/IEC 14443-4
|
||||||
PICC_TYPE_ISO_18092 = 2, // PICC compliant with ISO/IEC 18092 (NFC)
|
PICC_TYPE_ISO_18092 , // PICC compliant with ISO/IEC 18092 (NFC)
|
||||||
PICC_TYPE_MIFARE_MINI = 3, // MIFARE Classic protocol, 320 bytes
|
PICC_TYPE_MIFARE_MINI , // MIFARE Classic protocol, 320 bytes
|
||||||
PICC_TYPE_MIFARE_1K = 4, // MIFARE Classic protocol, 1KB
|
PICC_TYPE_MIFARE_1K , // MIFARE Classic protocol, 1KB
|
||||||
PICC_TYPE_MIFARE_4K = 5, // MIFARE Classic protocol, 4KB
|
PICC_TYPE_MIFARE_4K , // MIFARE Classic protocol, 4KB
|
||||||
PICC_TYPE_MIFARE_UL = 6, // MIFARE Ultralight or Ultralight C
|
PICC_TYPE_MIFARE_UL , // MIFARE Ultralight or Ultralight C
|
||||||
PICC_TYPE_MIFARE_PLUS = 7, // MIFARE Plus
|
PICC_TYPE_MIFARE_PLUS , // MIFARE Plus
|
||||||
PICC_TYPE_TNP3XXX = 8, // Only mentioned in NXP AN 10833 MIFARE Type Identification Procedure
|
PICC_TYPE_TNP3XXX , // Only mentioned in NXP AN 10833 MIFARE Type Identification Procedure
|
||||||
PICC_TYPE_NOT_COMPLETE = 255 // SAK indicates UID is not complete.
|
PICC_TYPE_NOT_COMPLETE // SAK indicates UID is not complete.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return codes from the functions in this class. Remember to update GetStatusCodeName() if you add more.
|
// Return codes from the functions in this class. Remember to update GetStatusCodeName() if you add more.
|
||||||
enum StatusCode {
|
enum StatusCode {
|
||||||
STATUS_OK = 1, // Success
|
STATUS_OK , // Success
|
||||||
STATUS_ERROR = 2, // Error in communication
|
STATUS_ERROR , // Error in communication
|
||||||
STATUS_COLLISION = 3, // Collission detected
|
STATUS_COLLISION , // Collission detected
|
||||||
STATUS_TIMEOUT = 4, // Timeout in communication.
|
STATUS_TIMEOUT , // Timeout in communication.
|
||||||
STATUS_NO_ROOM = 5, // A buffer is not big enough.
|
STATUS_NO_ROOM , // A buffer is not big enough.
|
||||||
STATUS_INTERNAL_ERROR = 6, // Internal error in the code. Should not happen ;-)
|
STATUS_INTERNAL_ERROR , // Internal error in the code. Should not happen ;-)
|
||||||
STATUS_INVALID = 7, // Invalid argument.
|
STATUS_INVALID , // Invalid argument.
|
||||||
STATUS_CRC_WRONG = 8, // The CRC_A does not match
|
STATUS_CRC_WRONG , // The CRC_A does not match
|
||||||
STATUS_MIFARE_NACK = 9 // A MIFARE PICC responded with NAK.
|
STATUS_MIFARE_NACK // A MIFARE PICC responded with NAK.
|
||||||
};
|
};
|
||||||
|
|
||||||
// A struct used for passing the UID of a PICC.
|
// A struct used for passing the UID of a PICC.
|
||||||
@@ -333,7 +333,7 @@ public:
|
|||||||
void setBitMask(unsigned char reg, unsigned char mask);
|
void setBitMask(unsigned char reg, unsigned char mask);
|
||||||
void PCD_SetRegisterBitMask(byte reg, byte mask);
|
void PCD_SetRegisterBitMask(byte reg, byte mask);
|
||||||
void PCD_ClearRegisterBitMask(byte reg, byte mask);
|
void PCD_ClearRegisterBitMask(byte reg, byte mask);
|
||||||
MFRC522::StatusCode PCD_CalculateCRC(byte *data, byte length, byte *result);
|
StatusCode PCD_CalculateCRC(byte *data, byte length, byte *result);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Functions for manipulating the MFRC522
|
// Functions for manipulating the MFRC522
|
||||||
@@ -350,36 +350,36 @@ public:
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Functions for communicating with PICCs
|
// Functions for communicating with PICCs
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
MFRC522::StatusCode PCD_TransceiveData(byte *sendData, byte sendLen, byte *backData, byte *backLen, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
|
StatusCode PCD_TransceiveData(byte *sendData, byte sendLen, byte *backData, byte *backLen, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
|
||||||
MFRC522::StatusCode PCD_CommunicateWithPICC(byte command, byte waitIRq, byte *sendData, byte sendLen, byte *backData = NULL, byte *backLen = NULL, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
|
StatusCode PCD_CommunicateWithPICC(byte command, byte waitIRq, byte *sendData, byte sendLen, byte *backData = NULL, byte *backLen = NULL, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
|
||||||
MFRC522::StatusCode PICC_RequestA(byte *bufferATQA, byte *bufferSize);
|
StatusCode PICC_RequestA(byte *bufferATQA, byte *bufferSize);
|
||||||
MFRC522::StatusCode PICC_WakeupA(byte *bufferATQA, byte *bufferSize);
|
StatusCode PICC_WakeupA(byte *bufferATQA, byte *bufferSize);
|
||||||
MFRC522::StatusCode PICC_REQA_or_WUPA(byte command, byte *bufferATQA, byte *bufferSize);
|
StatusCode PICC_REQA_or_WUPA(byte command, byte *bufferATQA, byte *bufferSize);
|
||||||
MFRC522::StatusCode PICC_Select(Uid *uid, byte validBits = 0);
|
StatusCode PICC_Select(Uid *uid, byte validBits = 0);
|
||||||
MFRC522::StatusCode PICC_HaltA();
|
StatusCode PICC_HaltA();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Functions for communicating with MIFARE PICCs
|
// Functions for communicating with MIFARE PICCs
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
MFRC522::StatusCode PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key *key, Uid *uid);
|
StatusCode PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key *key, Uid *uid);
|
||||||
void PCD_StopCrypto1();
|
void PCD_StopCrypto1();
|
||||||
MFRC522::StatusCode MIFARE_Read(byte blockAddr, byte *buffer, byte *bufferSize);
|
StatusCode MIFARE_Read(byte blockAddr, byte *buffer, byte *bufferSize);
|
||||||
MFRC522::StatusCode MIFARE_Write(byte blockAddr, byte *buffer, byte bufferSize);
|
StatusCode MIFARE_Write(byte blockAddr, byte *buffer, byte bufferSize);
|
||||||
MFRC522::StatusCode MIFARE_Ultralight_Write(byte page, byte *buffer, byte bufferSize);
|
StatusCode MIFARE_Ultralight_Write(byte page, byte *buffer, byte bufferSize);
|
||||||
MFRC522::StatusCode MIFARE_Decrement(byte blockAddr, long delta);
|
StatusCode MIFARE_Decrement(byte blockAddr, long delta);
|
||||||
MFRC522::StatusCode MIFARE_Increment(byte blockAddr, long delta);
|
StatusCode MIFARE_Increment(byte blockAddr, long delta);
|
||||||
MFRC522::StatusCode MIFARE_Restore(byte blockAddr);
|
StatusCode MIFARE_Restore(byte blockAddr);
|
||||||
MFRC522::StatusCode MIFARE_Transfer(byte blockAddr);
|
StatusCode MIFARE_Transfer(byte blockAddr);
|
||||||
MFRC522::StatusCode MIFARE_GetValue(byte blockAddr, long *value);
|
StatusCode MIFARE_GetValue(byte blockAddr, long *value);
|
||||||
MFRC522::StatusCode MIFARE_SetValue(byte blockAddr, long value);
|
StatusCode MIFARE_SetValue(byte blockAddr, long value);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Support functions
|
// Support functions
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
MFRC522::StatusCode PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
|
StatusCode PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
|
||||||
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
|
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
|
||||||
//const char *GetStatusCodeName(byte code);
|
//const char *GetStatusCodeName(byte code);
|
||||||
const __FlashStringHelper *GetStatusCodeName(MFRC522::StatusCode code);
|
const __FlashStringHelper *GetStatusCodeName(StatusCode code);
|
||||||
PICC_Type PICC_GetType(byte sak);
|
PICC_Type PICC_GetType(byte sak);
|
||||||
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
|
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
|
||||||
//const char *PICC_GetTypeName(byte type);
|
//const char *PICC_GetTypeName(byte type);
|
||||||
@@ -402,7 +402,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
byte _chipSelectPin; // Arduino pin connected to MFRC522's SPI slave select input (Pin 24, NSS, active low)
|
byte _chipSelectPin; // Arduino pin connected to MFRC522's SPI slave select input (Pin 24, NSS, active low)
|
||||||
byte _resetPowerDownPin; // Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low)
|
byte _resetPowerDownPin; // Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low)
|
||||||
MFRC522::StatusCode MIFARE_TwoStepHelper(byte command, byte blockAddr, long data);
|
StatusCode MIFARE_TwoStepHelper(byte command, byte blockAddr, long data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user