PN532 NFC library for Seeed Studio's NFC Shield
Fork of PN532 by
Diff: PN532.cpp
- Revision:
- 2:f618fb2169c4
- Parent:
- 1:b8cab5222fd0
- Child:
- 3:4189a10038e6
--- a/PN532.cpp Thu Oct 17 06:37:26 2013 +0000 +++ b/PN532.cpp Thu Oct 17 06:51:32 2013 +0000 @@ -2,7 +2,6 @@ /*! @file PN532.cpp @author Adafruit Industries & Seeed Technology Inc. - @license BSD (see license.txt) NXP's PN532 NFC/13.56MHz RFID Transceiver @@ -293,7 +292,7 @@ @returns 1 if everything executed properly, 0 for an error */ /**************************************************************************/ -bool PN532::readPassiveTargetID(uint8_t cardbaudrate, uint8_t *uid, uint8_t *uidLength) +bool PN532::readPassiveTargetID(uint8_t cardbaudrate, uint8_t *uid, uint8_t *uidLength, uint16_t timeout) { pn532_packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET; pn532_packetbuffer[1] = 1; // max 1 cards at once (we can set this to 2 later) @@ -304,7 +303,9 @@ } // read data packet - HAL(readResponse)(pn532_packetbuffer, sizeof(pn532_packetbuffer)); + if (HAL(readResponse)(pn532_packetbuffer, sizeof(pn532_packetbuffer), timeout) < 0) { + return 0x0; + } // check some basic stuff /* ISO14443A card response should be in the following format: