From 8ecb98cfd5d69d62fd5c6b2e662408488801cd65 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Sun, 31 Jan 2016 23:48:24 +0100 Subject: [PATCH] tweak enum save flash --- MFRC522.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MFRC522.h b/MFRC522.h index 6c3da7f..57ca216 100644 --- a/MFRC522.h +++ b/MFRC522.h @@ -272,8 +272,8 @@ public: }; // PICC types we can detect. Remember to update PICC_GetTypeName() if you add more. - // last value set to 255, hints compiler to use byte instead of default integer, works for arduino ide to save ram and flash - enum PICC_Type { + // last value set to 0xff, then compiler uses less ram, it seems some optimisations are triggered + enum PICC_Type : byte { PICC_TYPE_UNKNOWN , PICC_TYPE_ISO_14443_4 , // PICC compliant with ISO/IEC 14443-4 PICC_TYPE_ISO_18092 , // PICC compliant with ISO/IEC 18092 (NFC) @@ -283,12 +283,12 @@ public: PICC_TYPE_MIFARE_UL , // MIFARE Ultralight or Ultralight C PICC_TYPE_MIFARE_PLUS , // MIFARE Plus 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 = 0xff // SAK indicates UID is not complete. }; // Return codes from the functions in this class. Remember to update GetStatusCodeName() if you add more. - // last value set to 255, hints compiler to use byte instead of default integer, works for arduino ide to save ram and flash - enum StatusCode { + // last value set to 0xff, then compiler uses less ram, it seems some optimisations are triggered + enum StatusCode : byte { STATUS_OK , // Success STATUS_ERROR , // Error in communication STATUS_COLLISION , // Collission detected @@ -297,7 +297,7 @@ public: STATUS_INTERNAL_ERROR , // Internal error in the code. Should not happen ;-) STATUS_INVALID , // Invalid argument. STATUS_CRC_WRONG , // The CRC_A does not match - STATUS_MIFARE_NACK = 255 // A MIFARE PICC responded with NAK. + STATUS_MIFARE_NACK = 0xff // A MIFARE PICC responded with NAK. }; // A struct used for passing the UID of a PICC.