From b86a09792d25455a620c4cdcedf1086aac35ffdb Mon Sep 17 00:00:00 2001 From: Denis Volpato Martins Date: Sun, 21 Aug 2016 19:52:45 -0300 Subject: [PATCH 1/2] Get SPI SS/CS pin automatically --- MFRC522.cpp | 16 ++++++++++++++++ MFRC522.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/MFRC522.cpp b/MFRC522.cpp index 6979b8e..7d86049 100644 --- a/MFRC522.cpp +++ b/MFRC522.cpp @@ -16,6 +16,14 @@ MFRC522::MFRC522() { } // End constructor +/** + * Constructor. + * Prepares the output pins. + */ +MFRC522::MFRC522( byte resetPowerDownPin ///< Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low) + ): MFRC522(SS, resetPowerDownPin) { +} // End constructor + /** * Constructor. * Prepares the output pins. @@ -217,6 +225,14 @@ void MFRC522::PCD_Init() { PCD_AntennaOn(); // Enable the antenna driver pins TX1 and TX2 (they were disabled by the reset) } // End PCD_Init() +/** + * Initializes the MFRC522 chip. + */ +void MFRC522::PCD_Init( byte resetPowerDownPin ///< Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low) + ) { + PCD_Init(SS, resetPowerDownPin); +} // End PCD_Init() + /** * Initializes the MFRC522 chip. */ diff --git a/MFRC522.h b/MFRC522.h index e003451..abb6670 100644 --- a/MFRC522.h +++ b/MFRC522.h @@ -322,6 +322,7 @@ public: // Functions for setting up the Arduino ///////////////////////////////////////////////////////////////////////////////////// MFRC522(); + MFRC522(byte resetPowerDownPin); MFRC522(byte chipSelectPin, byte resetPowerDownPin); ///////////////////////////////////////////////////////////////////////////////////// @@ -340,6 +341,7 @@ public: // Functions for manipulating the MFRC522 ///////////////////////////////////////////////////////////////////////////////////// void PCD_Init(); + void PCD_Init(byte resetPowerDownPin); void PCD_Init(byte chipSelectPin, byte resetPowerDownPin); void PCD_Reset(); void PCD_AntennaOn(); From 4ee20074b23a9f8f5b428b737a6cd0da91c167c7 Mon Sep 17 00:00:00 2001 From: Denis Volpato Martins Date: Wed, 24 Aug 2016 08:55:49 -0300 Subject: [PATCH 2/2] added SS define comment --- MFRC522.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MFRC522.cpp b/MFRC522.cpp index 7d86049..6a4fe2d 100644 --- a/MFRC522.cpp +++ b/MFRC522.cpp @@ -21,7 +21,7 @@ MFRC522::MFRC522() { * Prepares the output pins. */ MFRC522::MFRC522( byte resetPowerDownPin ///< Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low) - ): MFRC522(SS, resetPowerDownPin) { + ): MFRC522(SS, resetPowerDownPin) { // SS is defined in pins_arduino.h } // End constructor /** @@ -230,7 +230,7 @@ void MFRC522::PCD_Init() { */ void MFRC522::PCD_Init( byte resetPowerDownPin ///< Arduino pin connected to MFRC522's reset and power down input (Pin 6, NRSTPD, active low) ) { - PCD_Init(SS, resetPowerDownPin); + PCD_Init(SS, resetPowerDownPin); // SS is defined in pins_arduino.h } // End PCD_Init() /**