Skip to content

Commit b949e87

Browse files
authored
Merge pull request #24 from tgikal/tgikal-SPI-read_passive_target-timeout
SPI read_passive_target timeout
2 parents 949a5c6 + 5c75384 commit b949e87

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

adafruit_pn532/spi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ def _wait_ready(self, timeout=1):
8181
status = bytearray([reverse_bit(_SPI_STATREAD), 0])
8282

8383
timestamp = time.monotonic()
84-
while (time.monotonic() - timestamp) < timeout:
85-
with self._spi as spi:
84+
with self._spi as spi:
85+
while (time.monotonic() - timestamp) < timeout:
8686
time.sleep(0.02) # required
8787
spi.write_readinto(status, status) #pylint: disable=no-member
88-
if reverse_bit(status[1]) == 0x01: # LSB data is read in MSB
89-
return True # Not busy anymore!
90-
else:
91-
time.sleep(0.01) # pause a bit till we ask again
88+
if reverse_bit(status[1]) == 0x01: # LSB data is read in MSB
89+
return True # Not busy anymore!
90+
else:
91+
time.sleep(0.01) # pause a bit till we ask again
9292
# We timed out!
9393
return False
9494

0 commit comments

Comments
 (0)