NFC Card Timeout?

Breakout boards, sensors, Drawdio, Game of Life, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

NFC Card Timeout?

Postby RUInsane » Fri May 04, 2012 6:38 pm

Is there a way that I can get this procedure to time-out after some user specified number of seconds -

readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength)

I want to be able to do other stuff should there be no card to read.
RUInsane
 
Posts: 3
Joined: Thu Apr 26, 2012 1:09 pm

Re: NFC Card Timeout?

Postby adafruit » Fri May 04, 2012 10:04 pm

using which product?
User avatar
adafruit
 
Posts: 10548
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: NFC Card Timeout?

Postby ktownsend » Sat May 05, 2012 12:13 am

You'll need to provide more information to offer any helpful response (what are you using and what do you want to do and on what HW), but if you mean provide a timeout on the HW side, no I don't believe you can setup a timeout for the PN532. What you send the command in this function, the PN532 will wait forever until a tag enters the field and then will spit out a response, even if you were in the middle of something else.
ktownsend
 
Posts: 201
Joined: Thu Nov 05, 2009 1:18 am

Re: NFC Card Timeout?

Postby scott-42 » Sat May 05, 2012 11:52 am

RUInsane wrote:Is there a way that I can get this procedure to time-out after some user specified number of seconds -
readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength)
I want to be able to do other stuff should there be no card to read.

Yes you could modify the library code to do this. You will want to configure the MxRtyPassiveActivation field in the RFConfiguration MaxRetries before you call InListPassiveTarget. The default value (0xFF) is try forever. Then you can add in any logic you want to figure out the wait time and how many times to call InListPassiveTarget.

If you are interested in this, I would suggest you read the PN532 User Manual which has all of this information and more.
scott-42
 
Posts: 123
Joined: Mon May 30, 2011 9:46 am
Location: Santa Clara, CA

Re: NFC Card Timeout?

Postby RUInsane » Mon May 14, 2012 9:07 pm

Thanks... that did it. I modified the library code in the way you described and everything is happy and pink now.
RUInsane
 
Posts: 3
Joined: Thu Apr 26, 2012 1:09 pm

Re: NFC Card Timeout?

Postby ktownsend » Thu May 17, 2012 6:16 pm

scott-42 wrote:
RUInsane wrote:Is there a way that I can get this procedure to time-out after some user specified number of seconds -
readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength)
I want to be able to do other stuff should there be no card to read.

Yes you could modify the library code to do this. You will want to configure the MxRtyPassiveActivation field in the RFConfiguration MaxRetries before you call InListPassiveTarget. The default value (0xFF) is try forever. Then you can add in any logic you want to figure out the wait time and how many times to call InListPassiveTarget.

If you are interested in this, I would suggest you read the PN532 User Manual which has all of this information and more.


Scott:

Looks like I need to dig back into the manual myself. :) Thanks for the heads up.
ktownsend
 
Posts: 201
Joined: Thu Nov 05, 2009 1:18 am


Return to Other Adafruit products

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
BeagleBone[23]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]