From 7cd29b7d775cbf527dea3690201e986802eb7f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9opold=20Gravier?= Date: Thu, 15 Feb 2024 19:08:00 +0100 Subject: [PATCH] Removed unused variable key from examples --- examples/ChangeUID/ChangeUID.ino | 7 ------- examples/FixBrickedUID/FixBrickedUID.ino | 7 ------- examples/MinimalInterrupt/MinimalInterrupt.ino | 2 -- examples/ReadNUID/ReadNUID.ino | 8 -------- 4 files changed, 24 deletions(-) diff --git a/examples/ChangeUID/ChangeUID.ino b/examples/ChangeUID/ChangeUID.ino index eb7b8c8..82c5665 100644 --- a/examples/ChangeUID/ChangeUID.ino +++ b/examples/ChangeUID/ChangeUID.ino @@ -35,19 +35,12 @@ MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance /* Set your new UID here! */ #define NEW_UID {0xDE, 0xAD, 0xBE, 0xEF} -MFRC522::MIFARE_Key key; - void setup() { Serial.begin(9600); // Initialize serial communications with the PC while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4) SPI.begin(); // Init SPI bus mfrc522.PCD_Init(); // Init MFRC522 card Serial.println(F("Warning: this example overwrites the UID of your UID changeable card, use with care!")); - - // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory. - for (byte i = 0; i < 6; i++) { - key.keyByte[i] = 0xFF; - } } // Setting the UID can be as simple as this: diff --git a/examples/FixBrickedUID/FixBrickedUID.ino b/examples/FixBrickedUID/FixBrickedUID.ino index 8530d41..d1f3654 100644 --- a/examples/FixBrickedUID/FixBrickedUID.ino +++ b/examples/FixBrickedUID/FixBrickedUID.ino @@ -32,19 +32,12 @@ MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance -MFRC522::MIFARE_Key key; - void setup() { Serial.begin(9600); // Initialize serial communications with the PC while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4) SPI.begin(); // Init SPI bus mfrc522.PCD_Init(); // Init MFRC522 card Serial.println(F("Warning: this example clears your mifare UID, use with care!")); - - // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory. - for (byte i = 0; i < 6; i++) { - key.keyByte[i] = 0xFF; - } } void loop() { diff --git a/examples/MinimalInterrupt/MinimalInterrupt.ino b/examples/MinimalInterrupt/MinimalInterrupt.ino index 37ec436..23273cf 100644 --- a/examples/MinimalInterrupt/MinimalInterrupt.ino +++ b/examples/MinimalInterrupt/MinimalInterrupt.ino @@ -37,8 +37,6 @@ MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. -MFRC522::MIFARE_Key key; - volatile bool bNewInt = false; byte regVal = 0x7F; void activateRec(MFRC522 mfrc522); diff --git a/examples/ReadNUID/ReadNUID.ino b/examples/ReadNUID/ReadNUID.ino index ffc924e..8e7fd0e 100644 --- a/examples/ReadNUID/ReadNUID.ino +++ b/examples/ReadNUID/ReadNUID.ino @@ -38,8 +38,6 @@ MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class -MFRC522::MIFARE_Key key; - // Init array that will store new NUID byte nuidPICC[4]; @@ -48,13 +46,7 @@ void setup() { SPI.begin(); // Init SPI bus rfid.PCD_Init(); // Init MFRC522 - for (byte i = 0; i < 6; i++) { - key.keyByte[i] = 0xFF; - } - Serial.println(F("This code scan the MIFARE Classsic NUID.")); - Serial.print(F("Using the following key:")); - printHex(key.keyByte, MFRC522::MF_KEY_SIZE); } void loop() {