Satisfy black formatting
This commit is contained in:
parent
e9dbe2d4fb
commit
7d7e3ce45f
4 changed files with 6 additions and 6 deletions
|
@ -343,12 +343,12 @@ class PN532:
|
||||||
hard power down is performed, if not, a soft power down is performed
|
hard power down is performed, if not, a soft power down is performed
|
||||||
instead. Returns True if the PN532 was powered down successfully or
|
instead. Returns True if the PN532 was powered down successfully or
|
||||||
False if not."""
|
False if not."""
|
||||||
if self._reset_pin: # Hard Power Down if the reset pin is connected
|
if self._reset_pin: # Hard Power Down if the reset pin is connected
|
||||||
self._reset_pin.value = False
|
self._reset_pin.value = False
|
||||||
self.low_power = True
|
self.low_power = True
|
||||||
else:
|
else:
|
||||||
# Soft Power Down otherwise. Enable wakeup on I2C, SPI, UART
|
# Soft Power Down otherwise. Enable wakeup on I2C, SPI, UART
|
||||||
response = self.call_function(_COMMAND_POWERDOWN, params=[0xb0, 0x00])
|
response = self.call_function(_COMMAND_POWERDOWN, params=[0xB0, 0x00])
|
||||||
self.low_power = response[0] == 0x00
|
self.low_power = response[0] == 0x00
|
||||||
time.sleep(0.005)
|
time.sleep(0.005)
|
||||||
return self.low_power
|
return self.low_power
|
||||||
|
|
|
@ -71,7 +71,7 @@ class PN532_I2C(PN532):
|
||||||
self._req.value = True
|
self._req.value = True
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
self.low_power = False
|
self.low_power = False
|
||||||
self.SAM_configuration() # Put the PN532 back in normal mode
|
self.SAM_configuration() # Put the PN532 back in normal mode
|
||||||
|
|
||||||
def _wait_ready(self, timeout=1):
|
def _wait_ready(self, timeout=1):
|
||||||
"""Poll PN532 if status byte is ready, up to `timeout` seconds"""
|
"""Poll PN532 if status byte is ready, up to `timeout` seconds"""
|
||||||
|
|
|
@ -79,7 +79,7 @@ class PN532_SPI(PN532):
|
||||||
spi.write(bytearray([0x00])) # pylint: disable=no-member
|
spi.write(bytearray([0x00])) # pylint: disable=no-member
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
self.low_power = False
|
self.low_power = False
|
||||||
self.SAM_configuration() # Put the PN532 back in normal mode
|
self.SAM_configuration() # Put the PN532 back in normal mode
|
||||||
|
|
||||||
def _wait_ready(self, timeout=1):
|
def _wait_ready(self, timeout=1):
|
||||||
"""Poll PN532 if status byte is ready, up to `timeout` seconds"""
|
"""Poll PN532 if status byte is ready, up to `timeout` seconds"""
|
||||||
|
|
|
@ -61,7 +61,7 @@ class PN532_UART(PN532):
|
||||||
self.low_power = False
|
self.low_power = False
|
||||||
self._uart.write(
|
self._uart.write(
|
||||||
b"\x55\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
b"\x55\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||||
) # wake up!
|
) # wake up!
|
||||||
self.SAM_configuration()
|
self.SAM_configuration()
|
||||||
|
|
||||||
def _wait_ready(self, timeout=1):
|
def _wait_ready(self, timeout=1):
|
||||||
|
@ -69,7 +69,7 @@ class PN532_UART(PN532):
|
||||||
timestamp = time.monotonic()
|
timestamp = time.monotonic()
|
||||||
while (time.monotonic() - timestamp) < timeout:
|
while (time.monotonic() - timestamp) < timeout:
|
||||||
if self._uart.in_waiting > 0:
|
if self._uart.in_waiting > 0:
|
||||||
return True # No Longer Busy
|
return True # No Longer Busy
|
||||||
time.sleep(0.01) # lets ask again soon!
|
time.sleep(0.01) # lets ask again soon!
|
||||||
# Timed out!
|
# Timed out!
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in a new issue