upd firmware_check example
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* Example sketch/program to test your firmware.
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
* This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
|
* This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
|
||||||
* for further details and other examples.
|
* for further details and other examples.
|
||||||
@@ -7,8 +9,6 @@
|
|||||||
* documented in MFRC522.cpp. Please read it.
|
* documented in MFRC522.cpp. Please read it.
|
||||||
*
|
*
|
||||||
* Released into the public domain.
|
* Released into the public domain.
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
* Example sketch/program showing how to test your firmware.
|
|
||||||
*
|
*
|
||||||
* Typical pin layout used:
|
* Typical pin layout used:
|
||||||
* -----------------------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------------------
|
||||||
@@ -21,6 +21,8 @@
|
|||||||
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
|
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
|
||||||
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
|
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
|
||||||
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
|
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
|
||||||
|
*
|
||||||
|
* @author Rotzbua
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
@@ -40,7 +42,7 @@ void setup() {
|
|||||||
Serial.println(F("*****************************"));
|
Serial.println(F("*****************************"));
|
||||||
Serial.println(F("MFRC522 Digital self test"));
|
Serial.println(F("MFRC522 Digital self test"));
|
||||||
Serial.println(F("*****************************"));
|
Serial.println(F("*****************************"));
|
||||||
ShowReaderDetails(); // Show details of PCD - MFRC522 Card Reader details
|
ShowReaderVersion(); // Show version of PCD - MFRC522 Card Reader
|
||||||
Serial.println(F("Performing test..."));
|
Serial.println(F("Performing test..."));
|
||||||
bool result = mfrc522.PCD_PerformSelfTest();
|
bool result = mfrc522.PCD_PerformSelfTest();
|
||||||
Serial.println(F("-----------------------------"));
|
Serial.println(F("-----------------------------"));
|
||||||
@@ -48,7 +50,7 @@ void setup() {
|
|||||||
if (result)
|
if (result)
|
||||||
Serial.println(F("OK"));
|
Serial.println(F("OK"));
|
||||||
else
|
else
|
||||||
Serial.println(F("defect or unknown"));
|
Serial.println(F("DEFECT or UNKNOWN"));
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,12 +59,14 @@ void loop() {} // nothing to do
|
|||||||
/**
|
/**
|
||||||
* Helper to print MFRC522 module info
|
* Helper to print MFRC522 module info
|
||||||
*/
|
*/
|
||||||
void ShowReaderDetails() {
|
void ShowReaderVersion() {
|
||||||
// Get the MFRC522 firmware version
|
// Get the MFRC522 firmware version
|
||||||
byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
|
byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
|
||||||
Serial.print(F("Firmware Version: 0x"));
|
Serial.print(F("Firmware Version: 0x"));
|
||||||
Serial.print(v, HEX);
|
Serial.print(v, HEX);
|
||||||
if (v == 0x90)
|
if (v == 0x88)
|
||||||
|
Serial.print(F(" = (clone)"));
|
||||||
|
else if (v == 0x90)
|
||||||
Serial.print(F(" = v0.0"));
|
Serial.print(F(" = v0.0"));
|
||||||
else if (v == 0x91)
|
else if (v == 0x91)
|
||||||
Serial.print(F(" = v1.0"));
|
Serial.print(F(" = v1.0"));
|
||||||
|
|||||||
Reference in New Issue
Block a user