From ff4f51f38bbbb92f61364a779ac01ee49de21d58 Mon Sep 17 00:00:00 2001 From: heziegl Date: Sun, 14 Jan 2018 13:04:01 +0100 Subject: [PATCH 1/5] fix #293 #324 #347, hang of PCD_Init() on ESP8266 boards (#354) On the Wemos D1 mini ESP8266 board the RST pin was LOW all the time and the MFRC522::PCD_Init() didn't reset the MFRC522 because of a non working digitalWrite, resulting in a endless loop. --- src/MFRC522.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MFRC522.cpp b/src/MFRC522.cpp index 7800e24..0038a51 100644 --- a/src/MFRC522.cpp +++ b/src/MFRC522.cpp @@ -198,11 +198,12 @@ void MFRC522::PCD_Init() { digitalWrite(_chipSelectPin, HIGH); // If a valid pin number has been set, pull device out of power down / reset state. - if (_resetPowerDownPin != UINT8_MAX) { - // Set the resetPowerDownPin as digital output, do not reset or power down. - pinMode(_resetPowerDownPin, OUTPUT); + if (_resetPowerDownPin != UNUSED_PIN) { + // First set the resetPowerDownPin as digital input, to check the MFRC522 power down mode. + pinMode(_resetPowerDownPin, INPUT); if (digitalRead(_resetPowerDownPin) == LOW) { // The MFRC522 chip is in power down mode. + pinMode(_resetPowerDownPin, OUTPUT); // Now set the resetPowerDownPin as digital output. digitalWrite(_resetPowerDownPin, HIGH); // Exit power down mode. This triggers a hard reset. // Section 8.8.2 in the datasheet says the oscillator start-up time is the start up time of the crystal + 37,74μs. Let us be generous: 50ms. delay(50); From 296772ea5ffe94aa899bf0554179e0b6ededb09a Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Fri, 13 Apr 2018 13:11:21 +0200 Subject: [PATCH 2/5] replace UINT8_MAX by UNUSED_PIN --- src/MFRC522.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MFRC522.h b/src/MFRC522.h index 7fa6288..0aa9de8 100644 --- a/src/MFRC522.h +++ b/src/MFRC522.h @@ -142,6 +142,8 @@ class MFRC522 { public: // Size of the MFRC522 FIFO static const byte FIFO_SIZE = 64; // The FIFO is 64 bytes. + // Default value for unused pin + static constexpr uint8_t UNUSED_PIN = UINT8_MAX; // MFRC522 registers. Described in chapter 9 of the datasheet. // When using SPI all addresses are shifted one bit left in the "SPI address byte" (section 8.1.2.3) From 4b27d4fb5f0c0cab7b4f28196587e4f57326fe12 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Fri, 13 Apr 2018 15:55:14 +0200 Subject: [PATCH 3/5] deprecate MIFARE_SetAccessBits --- src/MFRC522.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MFRC522.h b/src/MFRC522.h index 0aa9de8..69152cb 100644 --- a/src/MFRC522.h +++ b/src/MFRC522.h @@ -410,6 +410,7 @@ public: void PICC_DumpMifareUltralightToSerial(); // Advanced functions for MIFARE + DEPRECATED_MSG("name will change in next version") 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); From cf5e0429eb92f1a69af3423f78a951596a00948f Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Fri, 13 Apr 2018 17:09:27 +0200 Subject: [PATCH 4/5] bump version to 1.4.0 --- changes.txt | 7 +++++-- library.json | 2 +- library.properties | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changes.txt b/changes.txt index f3f866a..30b3020 100644 --- a/changes.txt +++ b/changes.txt @@ -1,7 +1,10 @@ -- Add changes to unreleased tag until we make a release. -unreleased -- +13 Apr 2018, v1.4.0 +- Replaced UINT8_MAX by UNUSED_PIN @Rotzbua +- Fixed hang PCD_Init() on non-arduino boards @heziegl +- deprecate MIFARE_SetAccessBits @Rotzbua +- IMPORTANT: v1.4.X will be last version under license "unlicense" 22 Mar 2017, v1.3.6 - Added deprecate and compiler warnings @Rotzbua diff --git a/library.json b/library.json index d67064c..62dc6d9 100644 --- a/library.json +++ b/library.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/miguelbalboa/rfid.git" }, - "version": "1.3.6", + "version": "1.4.0", "exclude": "doc", "frameworks": "arduino", "platforms": ["atmelavr", "ststm32", "teensy", "espressif8266"] diff --git a/library.properties b/library.properties index e96d951..a01a672 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=MFRC522 -version=1.3.6 +version=1.4.0 author=GithubCommunity maintainer=miguelbalboa sentence=Arduino RFID Library for MFRC522 (SPI) From d88dd248c4eca13d7a4b981505eb3cb28ffdb6fe Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Fri, 13 Apr 2018 21:15:51 +0200 Subject: [PATCH 5/5] add doc about dependencies fix #364 --- README.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.rst b/README.rst index 03701df..f83a693 100644 --- a/README.rst +++ b/README.rst @@ -271,6 +271,26 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to https://unlicense.org/ +.. _dependency: +Dependency +---------- + +* **Arduino.h** + + * From: Arduino IDE / target specific + * License: (target: Arduino) GNU Lesser General Public License 2.1 + +* **SPI.h** + + * From: Arduino IDE / target specific + * License: (target: Arduino) GNU Lesser General Public License 2.1 + +* **stdint.h** + + * From: Arduino IDE / Compiler and target specific + * License: different + + History -------