I found that when using the library as it is, it is not possible to avoid a slight delay while trying to read tags, due to read_passive_target needing to have a timeout. This is problematic if you are also trying to simultaneously perform another task, like updating neopixels. This delay prevents the neopixels from looking as smooth as they otherwise could.
I worked on tweaking the library slightly to allow, if needed, the ability to separate sending the listen command to the PN532, from reading a tag. None of the other functions are affected and the read_passive_target function is also still available and would still be the 'normal' way to read a tag. This additional functionality could be an option if you wanted a way to listen for a tag, while also avoiding any delay.
The idea would be:
Start listening
Check if a tag is present (by checking IRQ for instance)
If no tag is found, perform other tasks
Repeat 2 & 3 until a tag is found
Read the UID of the tag
It would be similar to how it is currently done, but since checking IRQ is quite quick, you avoid any delay. This would allow other tasks to be run, basically uninterrupted while you wait for a tag.
Any questions or suggestions are welcome! Let me know what you think!
I found that when using the library as it is, it is not possible to avoid a slight delay while trying to read tags, due to
read_passive_target
needing to have a timeout. This is problematic if you are also trying to simultaneously perform another task, like updating neopixels. This delay prevents the neopixels from looking as smooth as they otherwise could.I worked on tweaking the library slightly to allow, if needed, the ability to separate sending the listen command to the PN532, from reading a tag. None of the other functions are affected and the
read_passive_target
function is also still available and would still be the 'normal' way to read a tag. This additional functionality could be an option if you wanted a way to listen for a tag, while also avoiding any delay.The idea would be:
It would be similar to how it is currently done, but since checking IRQ is quite quick, you avoid any delay. This would allow other tasks to be run, basically uninterrupted while you wait for a tag.
Any questions or suggestions are welcome! Let me know what you think!