PN532_SPI._wait_ready polls the status until ready. However, the command to be sent is overwritten by the response received. Hence, if the device is not ready at the first request, we might send the wrong command for subsequent polling:
while (time.monotonic() - timestamp) < timeout:
time.sleep(0.02) # required
spi.write_readinto(status, status) #pylint: disable=no-member
if reverse_bit(status[1]) == 0x01: # LSB data is read in MSB
return True # Not busy anymore!
else:
time.sleep(0.01) # pause a bit till we ask again
PN532_SPI._wait_ready
polls the status until ready. However, the command to be sent is overwritten by the response received. Hence, if the device is not ready at the first request, we might send the wrong command for subsequent polling:the command in
status
is overwritten.