NFC Shield interupt

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
mickpah
 
Posts: 1
Joined: Sun Mar 03, 2013 4:18 pm

NFC Shield interupt

Post by mickpah »

Hi
I'm making a NFC reader and I want to add a web configuration page to the project.
However all the examples have the sketch waiting for a card event, which means I can't service web requests

i.e.
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

if (success) {......

I have tried adding an if .. else to this but it appears the call to nfc.readPassiveTargetID causes the sketch to sit and wait for a NFC event.
It appears that library makes use of an interrupt so it should be able to do other tasks while waiting ??

anyone got so hints for me ?
thanks

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: NFC Shield interupt

Post by adafruit_support_rick »

The library does not use an interrupt. As you've noticed, it simply blocks at a busy wait.

However, the IRQ line is brought out to the arduino. You can either poll it yourself, or set up an interrupt on it. Only call readPassiveTargetID when you see that the IRQ (i.e. "busy") line is set.

If you use an interrupt, I wouldn't call readPassiveTargetID from the ISR. instead, flag an event and handle it at the sketch level (which doesn't end up being a whole lot different different from simply polling the IRQ line :wink: ).

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

Return to “Other Products from Adafruit”