NFC Card Timeout?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ruinsane
 
Posts: 8
Joined: Thu Apr 26, 2012 2:09 pm

NFC Card Timeout?

Post by ruinsane »

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.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: NFC Card Timeout?

Post by adafruit »

using which product?

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: NFC Card Timeout?

Post by ktownsend »

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.

User avatar
scott_42
 
Posts: 130
Joined: Mon May 30, 2011 10:46 am

Re: NFC Card Timeout?

Post by scott_42 »

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.

User avatar
ruinsane
 
Posts: 8
Joined: Thu Apr 26, 2012 2:09 pm

Re: NFC Card Timeout?

Post by ruinsane »

Thanks... that did it. I modified the library code in the way you described and everything is happy and pink now.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: NFC Card Timeout?

Post by ktownsend »

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.

fobi
 
Posts: 1
Joined: Tue Mar 18, 2014 6:20 am

Re: NFC Card Timeout?

Post by fobi »

Hey,

I need the same - can you describe how do you modified the library? Can you post the lib?

Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”