Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Passive Mode #115

Merged
merged 1 commit into from
Jul 5, 2021
Merged
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
18 changes: 18 additions & 0 deletions PN532/PN532.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,24 @@ bool PN532::setRFField(uint8_t autoRFCA, uint8_t rFOnOff)

/***** ISO14443A Commands ******/

/**************************************************************************/
/*!
Puts PN532 into passive detection state with IRQ while waiting for an ISO14443A target

@param cardBaudRate Baud rate of the card

@returns 1 if everything executed properly, 0 for an error
*/
bool PN532::startPassiveTargetIDDetection(uint8_t cardbaudrate) {
pn532_packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET;
pn532_packetbuffer[1] = 1; // max 1 cards at once (we can set this to 2 later)
pn532_packetbuffer[2] = cardbaudrate;

if (HAL(writeCommand)(pn532_packetbuffer, 3)) {
return 0x0; // command failed
}
}

/**************************************************************************/
/*!
Waits for an ISO14443A target to enter the field
Expand Down
1 change: 1 addition & 0 deletions PN532/PN532.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class PN532

// ISO14443A functions
bool inListPassiveTarget();
bool startPassiveTargetIDDetection(uint8_t cardbaudrate);
bool readPassiveTargetID(uint8_t cardbaudrate, uint8_t *uid, uint8_t *uidLength, uint16_t timeout = 1000, bool inlist = false);
bool inDataExchange(uint8_t *send, uint8_t sendLength, uint8_t *response, uint8_t *responseLength);

Expand Down