diff --git a/adafruit_pn532/adafruit_pn532.py b/adafruit_pn532/adafruit_pn532.py index 59a08cb..a0e7dd5 100644 --- a/adafruit_pn532/adafruit_pn532.py +++ b/adafruit_pn532/adafruit_pn532.py @@ -195,11 +195,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: @@ -322,7 +322,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 ea7ac6d..88e6501 100644 --- a/examples/pn532_readwrite_mifare.py +++ b/examples/pn532_readwrite_mifare.py @@ -64,8 +64,8 @@ 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() -print("Found PN532 with firmware version: {0}.{1}".format(ver, rev)) +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 pn532.SAM_configuration() diff --git a/examples/pn532_readwrite_ntag2xx.py b/examples/pn532_readwrite_ntag2xx.py index 9554ca6..39ec841 100644 --- a/examples/pn532_readwrite_ntag2xx.py +++ b/examples/pn532_readwrite_ntag2xx.py @@ -60,8 +60,8 @@ 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() -print("Found PN532 with firmware version: {0}.{1}".format(ver, rev)) +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 pn532.SAM_configuration() diff --git a/examples/pn532_simpletest.py b/examples/pn532_simpletest.py index 666b455..643c796 100644 --- a/examples/pn532_simpletest.py +++ b/examples/pn532_simpletest.py @@ -40,8 +40,8 @@ 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() -print("Found PN532 with firmware version: {0}.{1}".format(ver, rev)) +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 pn532.SAM_configuration()