Revert "replace #define by constexpr"

This reverts commit a1d0a1313d.
This commit is contained in:
Rotzbua
2018-10-04 12:54:33 +02:00
parent e1b5c1dafa
commit 4623434bea
15 changed files with 42 additions and 42 deletions

View File

@@ -87,12 +87,12 @@
#define LED_OFF LOW #define LED_OFF LOW
#endif #endif
constexpr uint8_t redLed = 7; // Set Led Pins #define redLed 7 // Set Led Pins
constexpr uint8_t greenLed = 6; #define greenLed 6
constexpr uint8_t blueLed = 5; #define blueLed 5
constexpr uint8_t relay = 4; // Set Relay Pin #define relay 4 // Set Relay Pin
constexpr uint8_t wipeB = 3; // Button pin for WipeMode #define wipeB 3 // Button pin for WipeMode
bool programMode = false; // initialize programming mode to false bool programMode = false; // initialize programming mode to false
@@ -103,9 +103,8 @@ byte readCard[4]; // Stores scanned ID read from RFID Module
byte masterCard[4]; // Stores master card's ID read from EEPROM byte masterCard[4]; // Stores master card's ID read from EEPROM
// Create MFRC522 instance. // Create MFRC522 instance.
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define SS_PIN 10
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); MFRC522 mfrc522(SS_PIN, RST_PIN);
///////////////////////////////////////// Setup /////////////////////////////////// ///////////////////////////////////////// Setup ///////////////////////////////////

View File

@@ -26,13 +26,13 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
/* Set your new UID here! */ /* Set your new UID here! */
byte newUid[] = {0xDE, 0xAD, 0xBE, 0xEF}; #define NEW_UID {0xDE, 0xAD, 0xBE, 0xEF}
MFRC522::MIFARE_Key key; MFRC522::MIFARE_Key key;
@@ -92,6 +92,7 @@ void loop() {
// } // }
// Set new UID // Set new UID
byte newUid[] = NEW_UID;
if ( mfrc522.MIFARE_SetUid(newUid, (byte)4, true) ) { if ( mfrc522.MIFARE_SetUid(newUid, (byte)4, true) ) {
Serial.println(F("Wrote new UID to card.")); Serial.println(F("Wrote new UID to card."));
} }

View File

@@ -36,8 +36,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

View File

@@ -25,8 +25,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

View File

@@ -31,8 +31,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

View File

@@ -29,9 +29,9 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 3 // Configurable, see typical pin layout above
constexpr uint8_t IRQ_PIN = 2; // Configurable, depends on hardware #define IRQ_PIN 2 // Configurable, depends on hardware
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

View File

@@ -12,8 +12,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 //
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 //
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

View File

@@ -23,8 +23,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
@@ -37,7 +37,7 @@ MFRC522::MIFARE_Key key;
// Number of known default keys (hard-coded) // Number of known default keys (hard-coded)
// NOTE: Synchronize the NR_KNOWN_KEYS define with the defaultKeys[] array // NOTE: Synchronize the NR_KNOWN_KEYS define with the defaultKeys[] array
constexpr uint8_t NR_KNOWN_KEYS = 8; #define NR_KNOWN_KEYS 8
// Known keys, see: https://code.google.com/p/mfcuk/wiki/MifareClassicDefaultKeys // Known keys, see: https://code.google.com/p/mfcuk/wiki/MifareClassicDefaultKeys
byte knownKeys[NR_KNOWN_KEYS][MFRC522::MF_KEY_SIZE] = { byte knownKeys[NR_KNOWN_KEYS][MFRC522::MF_KEY_SIZE] = {
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // FF FF FF FF FF FF = factory default {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // FF FF FF FF FF FF = factory default

View File

@@ -30,8 +30,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

View File

@@ -31,8 +31,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define SS_PIN 10
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

View File

@@ -30,11 +30,11 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_1_PIN = 10; // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 2 #define SS_1_PIN 10 // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 2
constexpr uint8_t SS_2_PIN = 8; // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 1 #define SS_2_PIN 8 // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 1
constexpr uint8_t NR_OF_READERS = 2; #define NR_OF_READERS 2
byte ssPins[] = {SS_1_PIN, SS_2_PIN}; byte ssPins[] = {SS_1_PIN, SS_2_PIN};

View File

@@ -27,8 +27,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

View File

@@ -28,14 +28,14 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
// Number of known default keys (hard-coded) // Number of known default keys (hard-coded)
// NOTE: Synchronize the NR_KNOWN_KEYS define with the defaultKeys[] array // NOTE: Synchronize the NR_KNOWN_KEYS define with the defaultKeys[] array
constexpr uint8_t NR_KNOWN_KEYS = 8; #define NR_KNOWN_KEYS 8
// Known keys, see: https://code.google.com/p/mfcuk/wiki/MifareClassicDefaultKeys // Known keys, see: https://code.google.com/p/mfcuk/wiki/MifareClassicDefaultKeys
byte knownKeys[NR_KNOWN_KEYS][MFRC522::MF_KEY_SIZE] = { byte knownKeys[NR_KNOWN_KEYS][MFRC522::MF_KEY_SIZE] = {
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // FF FF FF FF FF FF = factory default {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // FF FF FF FF FF FF = factory default

View File

@@ -22,8 +22,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

View File

@@ -22,8 +22,8 @@
#include <SPI.h> #include <SPI.h>
#include <MFRC522.h> #include <MFRC522.h>
constexpr uint8_t RST_PIN = 9; // Configurable, see typical pin layout above #define RST_PIN 9 // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10; // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance