MCPcopy Create free account
hub / github.com/SmingHub/Sming / scanNfc

Function scanNfc

samples/Basic_NFC/app/application.cpp:26–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void scanNfc(uint8_t scannerPin)
27{
28 if(!mfrc522.PICC_IsNewCardPresent()) {
29 Serial << _F("Scanning NFC pin #") << scannerPin << _F(" not present") << endl;
30 return;
31 }
32
33 // Select one of the cards
34 if(!mfrc522.PICC_ReadCardSerial()) {
35 Serial << _F("Selecting card #") << scannerPin << _F(" failed...") << endl;
36 } else {
37 // Show some details of the PICC (that is: the tag/card)
38 Serial << _F("Card UID on scanner: ") << scannerPin << endl;
39 m_printHex("UID", mfrc522.uid.uidByte, mfrc522.uid.size);
40 }
41
42 mfrc522.PICC_HaltA();
43
44 // Stop encryption on PCD
45 mfrc522.PCD_StopCrypto1();
46 mfrc522.PCD_Init();
47}
48
49} // namespace
50

Callers 1

sayHelloFunction · 0.85

Calls 6

m_printHexFunction · 0.85
PICC_IsNewCardPresentMethod · 0.80
PICC_ReadCardSerialMethod · 0.80
PICC_HaltAMethod · 0.80
PCD_StopCrypto1Method · 0.80
PCD_InitMethod · 0.80

Tested by

no test coverage detected