add output SAK to dump functions
This commit is contained in:
46
MFRC522.cpp
46
MFRC522.cpp
@@ -1301,23 +1301,11 @@ void MFRC522::PICC_DumpToSerial(Uid *uid ///< Pointer to Uid struct returned fro
|
||||
) {
|
||||
MIFARE_Key key;
|
||||
|
||||
// UID
|
||||
Serial.print(F("Card UID:"));
|
||||
for (byte i = 0; i < uid->size; i++) {
|
||||
if(uid->uidByte[i] < 0x10)
|
||||
Serial.print(F(" 0"));
|
||||
else
|
||||
Serial.print(F(" "));
|
||||
Serial.print(uid->uidByte[i], HEX);
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
// PICC type
|
||||
PICC_Type piccType = PICC_GetType(uid->sak);
|
||||
Serial.print(F("PICC type: "));
|
||||
Serial.println(PICC_GetTypeName(piccType));
|
||||
// Dump UID, SAK and Type
|
||||
PICC_DumpDetailsToSerial(uid);
|
||||
|
||||
// Dump contents
|
||||
PICC_Type piccType = PICC_GetType(uid->sak);
|
||||
switch (piccType) {
|
||||
case PICC_TYPE_MIFARE_MINI:
|
||||
case PICC_TYPE_MIFARE_1K:
|
||||
@@ -1350,6 +1338,34 @@ void MFRC522::PICC_DumpToSerial(Uid *uid ///< Pointer to Uid struct returned fro
|
||||
PICC_HaltA(); // Already done if it was a MIFARE Classic PICC.
|
||||
} // End PICC_DumpToSerial()
|
||||
|
||||
/**
|
||||
* Dumps card info (UID,SAK,Type) about the selected PICC to Serial.
|
||||
*/
|
||||
void MFRC522::PICC_DumpDetailsToSerial(Uid *uid ///< Pointer to Uid struct returned from a successful PICC_Select().
|
||||
) {
|
||||
// UID
|
||||
Serial.print(F("Card UID:"));
|
||||
for (byte i = 0; i < uid->size; i++) {
|
||||
if(uid->uidByte[i] < 0x10)
|
||||
Serial.print(F(" 0"));
|
||||
else
|
||||
Serial.print(F(" "));
|
||||
Serial.print(uid->uidByte[i], HEX);
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
// SAK
|
||||
Serial.print(F("Card SAK: "));
|
||||
if(uid->sak < 0x10)
|
||||
Serial.print(F("0"));
|
||||
Serial.println(uid->sak, HEX);
|
||||
|
||||
// (suggested) PICC type
|
||||
PICC_Type piccType = PICC_GetType(uid->sak);
|
||||
Serial.print(F("PICC type: "));
|
||||
Serial.println(PICC_GetTypeName(piccType));
|
||||
} // End PICC_DumpDetailsToSerial()
|
||||
|
||||
/**
|
||||
* Dumps memory contents of a MIFARE Classic PICC.
|
||||
* On success the PICC is halted after dumping the data.
|
||||
|
||||
Reference in New Issue
Block a user