diff --git a/src/MFRC522.h b/src/MFRC522.h index 09c72fc..7fa6288 100644 --- a/src/MFRC522.h +++ b/src/MFRC522.h @@ -75,6 +75,8 @@ #ifndef MFRC522_h #define MFRC522_h +#include "require_cpp11.h" +#include "deprecated.h" // Enable integer limits #define __STDC_LIMIT_MACROS #include @@ -329,6 +331,7 @@ public: // Functions for setting up the Arduino ///////////////////////////////////////////////////////////////////////////////////// MFRC522(); + DEPRECATED_MSG("use MFRC522(byte chipSelectPin, byte resetPowerDownPin)") MFRC522(byte resetPowerDownPin); MFRC522(byte chipSelectPin, byte resetPowerDownPin); @@ -347,6 +350,7 @@ public: // Functions for manipulating the MFRC522 ///////////////////////////////////////////////////////////////////////////////////// void PCD_Init(); + DEPRECATED_MSG("use PCD_Init(byte chipSelectPin, byte resetPowerDownPin)") void PCD_Init(byte resetPowerDownPin); void PCD_Init(byte chipSelectPin, byte resetPowerDownPin); void PCD_Reset(); @@ -405,8 +409,11 @@ public: // Advanced functions for MIFARE void MIFARE_SetAccessBits(byte *accessBitBuffer, byte g0, byte g1, byte g2, byte g3); + DEPRECATED_MSG("will move to extra class in next version") bool MIFARE_OpenUidBackdoor(bool logErrors); + DEPRECATED_MSG("will move to extra class in next version") bool MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors); + DEPRECATED_MSG("will move to extra class in next version") bool MIFARE_UnbrickUidSector(bool logErrors); ///////////////////////////////////////////////////////////////////////////////////// diff --git a/src/deprecated.h b/src/deprecated.h new file mode 100644 index 0000000..cba2cf2 --- /dev/null +++ b/src/deprecated.h @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2016 by Ludwig Grill (www.rotzbua.de) + * Simple deprecated workaround for Arduino IDE + * IDE 1.6.8 use gcc 4.8 which do not support c++14 [[deprecated]] + * Later versions should support c++14, then use c++14 syntax + */ +#ifndef DEPRECATED_H +#define DEPRECATED_H + +#ifdef __has_cpp_attribute +#if __has_cpp_attribute(deprecated) +#define DEPRECATED [[deprecated]] +#define DEPRECATED_MSG(msg) [[deprecated(msg)]] +#endif // __has_cpp_attribute(deprecated) +#else +#define DEPRECATED __attribute__((deprecated)) +#define DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) +#endif // __has_cpp_attribute + +#endif // DEPRECATED_H diff --git a/src/require_cpp11.h b/src/require_cpp11.h new file mode 100644 index 0000000..6561cd8 --- /dev/null +++ b/src/require_cpp11.h @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2016 by Ludwig Grill (www.rotzbua.de) + * Throws error if c++11 is not supported + */ +#ifndef REQUIRE_CPP11_H +#define REQUIRE_CPP11_H + +#if __cplusplus < 201103L +#error "This library needs at least a C++11 compliant compiler, maybe compiler argument for C++11 support is missing or if you use Arduino IDE upgrade to version >=1.6.6" +#endif + +#endif // REQUIRE_CPP11_H