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