NfcAuthenticator: Reset PCD every read

Sometimes PCD driver would hang, causing inability to read NFC keys.
This is to fix the issue, increasing loop time only slightly.
This commit is contained in:
Lech 2018-03-28 22:38:45 +02:00 committed by Lech Perczak
parent 51ce0872bb
commit 40ddf07c00
1 changed files with 2 additions and 1 deletions

View File

@ -8,7 +8,6 @@ NfcAuthenticator::NfcAuthenticator(int nfcSlaveSelectPin, int nfcResetPin, const
logger(logger) logger(logger)
{ {
SPI.begin(); SPI.begin();
rfid.PCD_Init();
} }
NfcAuthenticator::~NfcAuthenticator() NfcAuthenticator::~NfcAuthenticator()
@ -29,6 +28,8 @@ Key NfcAuthenticator::getKey()
bool NfcAuthenticator::initializeCard() bool NfcAuthenticator::initializeCard()
{ {
rfid.PCD_Init();
if (!rfid.PICC_IsNewCardPresent()) if (!rfid.PICC_IsNewCardPresent())
return false; return false;