Skip to content

Commit dbdf417

Browse files
committed
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
1 parent 8016aa7 commit dbdf417

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

MFRC522.h

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -273,29 +273,29 @@ class MFRC522 {
273273

274274
// PICC types we can detect. Remember to update PICC_GetTypeName() if you add more.
275275
enum PICC_Type {
276-
PICC_TYPE_UNKNOWN = 0,
277-
PICC_TYPE_ISO_14443_4 = 1, // PICC compliant with ISO/IEC 14443-4
278-
PICC_TYPE_ISO_18092 = 2, // PICC compliant with ISO/IEC 18092 (NFC)
279-
PICC_TYPE_MIFARE_MINI = 3, // MIFARE Classic protocol, 320 bytes
280-
PICC_TYPE_MIFARE_1K = 4, // MIFARE Classic protocol, 1KB
281-
PICC_TYPE_MIFARE_4K = 5, // MIFARE Classic protocol, 4KB
282-
PICC_TYPE_MIFARE_UL = 6, // MIFARE Ultralight or Ultralight C
283-
PICC_TYPE_MIFARE_PLUS = 7, // MIFARE Plus
284-
PICC_TYPE_TNP3XXX = 8, // Only mentioned in NXP AN 10833 MIFARE Type Identification Procedure
285-
PICC_TYPE_NOT_COMPLETE = 255 // SAK indicates UID is not complete.
276+
PICC_TYPE_UNKNOWN ,
277+
PICC_TYPE_ISO_14443_4 , // PICC compliant with ISO/IEC 14443-4
278+
PICC_TYPE_ISO_18092 , // PICC compliant with ISO/IEC 18092 (NFC)
279+
PICC_TYPE_MIFARE_MINI , // MIFARE Classic protocol, 320 bytes
280+
PICC_TYPE_MIFARE_1K , // MIFARE Classic protocol, 1KB
281+
PICC_TYPE_MIFARE_4K , // MIFARE Classic protocol, 4KB
282+
PICC_TYPE_MIFARE_UL , // MIFARE Ultralight or Ultralight C
283+
PICC_TYPE_MIFARE_PLUS , // MIFARE Plus
284+
PICC_TYPE_TNP3XXX , // Only mentioned in NXP AN 10833 MIFARE Type Identification Procedure
285+
PICC_TYPE_NOT_COMPLETE // SAK indicates UID is not complete.
286286
};
287287

288288
// Return codes from the functions in this class. Remember to update GetStatusCodeName() if you add more.
289289
enum StatusCode {
290-
STATUS_OK = 1, // Success
291-
STATUS_ERROR = 2, // Error in communication
292-
STATUS_COLLISION = 3, // Collission detected
293-
STATUS_TIMEOUT = 4, // Timeout in communication.
294-
STATUS_NO_ROOM = 5, // A buffer is not big enough.
295-
STATUS_INTERNAL_ERROR = 6, // Internal error in the code. Should not happen ;-)
296-
STATUS_INVALID = 7, // Invalid argument.
297-
STATUS_CRC_WRONG = 8, // The CRC_A does not match
298-
STATUS_MIFARE_NACK = 9 // A MIFARE PICC responded with NAK.
290+
STATUS_OK , // Success
291+
STATUS_ERROR , // Error in communication
292+
STATUS_COLLISION , // Collission detected
293+
STATUS_TIMEOUT , // Timeout in communication.
294+
STATUS_NO_ROOM , // A buffer is not big enough.
295+
STATUS_INTERNAL_ERROR , // Internal error in the code. Should not happen ;-)
296+
STATUS_INVALID , // Invalid argument.
297+
STATUS_CRC_WRONG , // The CRC_A does not match
298+
STATUS_MIFARE_NACK // A MIFARE PICC responded with NAK.
299299
};
300300

301301
// A struct used for passing the UID of a PICC.
@@ -333,7 +333,7 @@ class MFRC522 {
333333
void setBitMask(unsigned char reg, unsigned char mask);
334334
void PCD_SetRegisterBitMask(byte reg, byte mask);
335335
void PCD_ClearRegisterBitMask(byte reg, byte mask);
336-
MFRC522::StatusCode PCD_CalculateCRC(byte *data, byte length, byte *result);
336+
StatusCode PCD_CalculateCRC(byte *data, byte length, byte *result);
337337

338338
/////////////////////////////////////////////////////////////////////////////////////
339339
// Functions for manipulating the MFRC522
@@ -350,36 +350,36 @@ class MFRC522 {
350350
/////////////////////////////////////////////////////////////////////////////////////
351351
// Functions for communicating with PICCs
352352
/////////////////////////////////////////////////////////////////////////////////////
353-
MFRC522::StatusCode PCD_TransceiveData(byte *sendData, byte sendLen, byte *backData, byte *backLen, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
354-
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);
355-
MFRC522::StatusCode PICC_RequestA(byte *bufferATQA, byte *bufferSize);
356-
MFRC522::StatusCode PICC_WakeupA(byte *bufferATQA, byte *bufferSize);
357-
MFRC522::StatusCode PICC_REQA_or_WUPA(byte command, byte *bufferATQA, byte *bufferSize);
358-
MFRC522::StatusCode PICC_Select(Uid *uid, byte validBits = 0);
359-
MFRC522::StatusCode PICC_HaltA();
353+
StatusCode PCD_TransceiveData(byte *sendData, byte sendLen, byte *backData, byte *backLen, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
354+
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);
355+
StatusCode PICC_RequestA(byte *bufferATQA, byte *bufferSize);
356+
StatusCode PICC_WakeupA(byte *bufferATQA, byte *bufferSize);
357+
StatusCode PICC_REQA_or_WUPA(byte command, byte *bufferATQA, byte *bufferSize);
358+
StatusCode PICC_Select(Uid *uid, byte validBits = 0);
359+
StatusCode PICC_HaltA();
360360

361361
/////////////////////////////////////////////////////////////////////////////////////
362362
// Functions for communicating with MIFARE PICCs
363363
/////////////////////////////////////////////////////////////////////////////////////
364-
MFRC522::StatusCode PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key *key, Uid *uid);
364+
StatusCode PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key *key, Uid *uid);
365365
void PCD_StopCrypto1();
366-
MFRC522::StatusCode MIFARE_Read(byte blockAddr, byte *buffer, byte *bufferSize);
367-
MFRC522::StatusCode MIFARE_Write(byte blockAddr, byte *buffer, byte bufferSize);
368-
MFRC522::StatusCode MIFARE_Ultralight_Write(byte page, byte *buffer, byte bufferSize);
369-
MFRC522::StatusCode MIFARE_Decrement(byte blockAddr, long delta);
370-
MFRC522::StatusCode MIFARE_Increment(byte blockAddr, long delta);
371-
MFRC522::StatusCode MIFARE_Restore(byte blockAddr);
372-
MFRC522::StatusCode MIFARE_Transfer(byte blockAddr);
373-
MFRC522::StatusCode MIFARE_GetValue(byte blockAddr, long *value);
374-
MFRC522::StatusCode MIFARE_SetValue(byte blockAddr, long value);
366+
StatusCode MIFARE_Read(byte blockAddr, byte *buffer, byte *bufferSize);
367+
StatusCode MIFARE_Write(byte blockAddr, byte *buffer, byte bufferSize);
368+
StatusCode MIFARE_Ultralight_Write(byte page, byte *buffer, byte bufferSize);
369+
StatusCode MIFARE_Decrement(byte blockAddr, long delta);
370+
StatusCode MIFARE_Increment(byte blockAddr, long delta);
371+
StatusCode MIFARE_Restore(byte blockAddr);
372+
StatusCode MIFARE_Transfer(byte blockAddr);
373+
StatusCode MIFARE_GetValue(byte blockAddr, long *value);
374+
StatusCode MIFARE_SetValue(byte blockAddr, long value);
375375

376376
/////////////////////////////////////////////////////////////////////////////////////
377377
// Support functions
378378
/////////////////////////////////////////////////////////////////////////////////////
379-
MFRC522::StatusCode PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
379+
StatusCode PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
380380
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
381381
//const char *GetStatusCodeName(byte code);
382-
const __FlashStringHelper *GetStatusCodeName(MFRC522::StatusCode code);
382+
const __FlashStringHelper *GetStatusCodeName(StatusCode code);
383383
PICC_Type PICC_GetType(byte sak);
384384
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
385385
//const char *PICC_GetTypeName(byte type);
@@ -402,7 +402,7 @@ class MFRC522 {
402402
private:
403403
byte _chipSelectPin; // Arduino pin connected to MFRC522's SPI slave select input (Pin 24, NSS, active low)
404404
byte _resetPowerDownPin; // Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low)
405-
MFRC522::StatusCode MIFARE_TwoStepHelper(byte command, byte blockAddr, long data);
405+
StatusCode MIFARE_TwoStepHelper(byte command, byte blockAddr, long data);
406406
};
407407

408408
#endif

0 commit comments

Comments
 (0)