adafruit / Adafruit_CircuitPython_PN532

CircuitPython driver for the PN532 NFC/RFID Breakout and PN532 NFC/RFID Shield
MIT License
91 stars 47 forks source link

Change UART timeout to seconds in examples #63

Closed caternuson closed 1 year ago

caternuson commented 1 year ago

Fixes #44. And possibly #46. Also, #58 is similar, but using Pyserial via an FTDI cable, which the example do not directly cover.

Looks like the timeout value used for UART in several of the examples was being set in milliseconds instead of seconds. So the read was waiting 100 seconds. May still be a response length mismatch issue, but relying on the timeout to end the read seems to work based on pn532_simpletest example in UART mode:

Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather M4 Express with samd51j19
>>> import pn532_simpletest
Found PN532 with firmware version: 1.6
Waiting for RFID/NFC card...
......Found card with UID: ['0x56', '0x58', '0x8f', '0x7c']
.Found card with UID: ['0x56', '0x58', '0x8f', '0x7c']
.Found card with UID: ['0x56', '0x58', '0x8f', '0x7c']
.Found card with UID: ['0x56', '0x58', '0x8f', '0x7c']
.Found card with UID: ['0x56', '0x58', '0x8f', '0x7c']