Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions NfcAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NfcAdapter::~NfcAdapter(void)
delete shield;
}

void NfcAdapter::begin(boolean verbose)
bool NfcAdapter::begin(boolean verbose, boolean halt_on_not_found=true)
{
shield->begin();

Expand All @@ -21,7 +21,11 @@ void NfcAdapter::begin(boolean verbose)
#ifdef NDEF_USE_SERIAL
Serial.print(F("Didn't find PN53x board"));
#endif
while (1); // halt
if (halt_on_not_found) {
while (1); // halt
} else {
return false;
}
}

if (verbose)
Expand All @@ -34,6 +38,7 @@ void NfcAdapter::begin(boolean verbose)
}
// configure board to read RFID tags
shield->SAMConfig();
return true;
}

boolean NfcAdapter::tagPresent(unsigned long timeout)
Expand Down
2 changes: 1 addition & 1 deletion NfcAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class NfcAdapter {
NfcAdapter(PN532Interface &interface);

~NfcAdapter(void);
void begin(boolean verbose=true);
boolean begin(boolean verbose=true, boolean halt_on_not_found=true);
boolean tagPresent(unsigned long timeout=0); // tagAvailable
NfcTag read();
boolean write(NdefMessage& ndefMessage);
Expand Down