diff --git a/adafruit_pn532/adafruit_pn532.py b/adafruit_pn532/adafruit_pn532.py index b0818bd..4eae888 100644 --- a/adafruit_pn532/adafruit_pn532.py +++ b/adafruit_pn532/adafruit_pn532.py @@ -196,11 +196,11 @@ class PN532: try: self._wakeup() - self.get_firmware_version() # first time often fails, try 2ce + _ = self.firmware_version # first time often fails, try 2ce return except (BusyError, RuntimeError): pass - self.get_firmware_version() + _ = self.firmware_version def _read_data(self, count): # Read raw data from device, not including status bytes: @@ -317,7 +317,8 @@ class PN532: # Return response data. return response[2:] - def get_firmware_version(self): + @property + def firmware_version(self): """Call PN532 GetFirmwareVersion function and return a tuple with the IC, Ver, Rev, and Support values. """ diff --git a/examples/pn532_readwrite_mifare.py b/examples/pn532_readwrite_mifare.py index 254ef3c..6d6ca7a 100644 --- a/examples/pn532_readwrite_mifare.py +++ b/examples/pn532_readwrite_mifare.py @@ -62,7 +62,7 @@ pn532 = PN532_I2C(i2c, debug=False) #uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100) #pn532 = PN532_UART(uart, debug=False) -ic, ver, rev, support = pn532.get_firmware_version() +ic, ver, rev, support = pn532.firmware_version print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev)) # Configure PN532 to communicate with MiFare cards diff --git a/examples/pn532_readwrite_ntag2xx.py b/examples/pn532_readwrite_ntag2xx.py index 2f51777..4c1e15e 100644 --- a/examples/pn532_readwrite_ntag2xx.py +++ b/examples/pn532_readwrite_ntag2xx.py @@ -58,7 +58,7 @@ pn532 = PN532_SPI(spi, cs_pin, debug=False) #uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100) #pn532 = PN532_UART(uart, debug=False) -ic, ver, rev, support = pn532.get_firmware_version() +ic, ver, rev, support = pn532.firmware_version print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev)) # Configure PN532 to communicate with MiFare cards diff --git a/examples/pn532_simpletest.py b/examples/pn532_simpletest.py index ab4b308..4eb5295 100644 --- a/examples/pn532_simpletest.py +++ b/examples/pn532_simpletest.py @@ -38,7 +38,7 @@ pn532 = PN532_I2C(i2c, debug=False, reset=reset_pin, req=req_pin) #uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100) #pn532 = PN532_UART(uart, debug=False) -ic, ver, rev, support = pn532.get_firmware_version() +ic, ver, rev, support = pn532.firmware_version print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev)) # Configure PN532 to communicate with MiFare cards