Skip to content

Commit 42192bf

Browse files
authored
Merge pull request #30 from FoamyGuy/master
Change get_firmware_version() function to a property
2 parents d9b547e + 0b8cc7f commit 42192bf

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

adafruit_pn532/adafruit_pn532.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ def __init__(self, *, debug=False, reset=None):
196196

197197
try:
198198
self._wakeup()
199-
self.get_firmware_version() # first time often fails, try 2ce
199+
_ = self.firmware_version # first time often fails, try 2ce
200200
return
201201
except (BusyError, RuntimeError):
202202
pass
203-
self.get_firmware_version()
203+
_ = self.firmware_version
204204

205205
def _read_data(self, count):
206206
# Read raw data from device, not including status bytes:
@@ -317,7 +317,8 @@ def call_function(self, command, response_length=0, params=[], timeout=1): # pyl
317317
# Return response data.
318318
return response[2:]
319319

320-
def get_firmware_version(self):
320+
@property
321+
def firmware_version(self):
321322
"""Call PN532 GetFirmwareVersion function and return a tuple with the IC,
322323
Ver, Rev, and Support values.
323324
"""

examples/pn532_readwrite_mifare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100)
6363
#pn532 = PN532_UART(uart, debug=False)
6464

65-
ic, ver, rev, support = pn532.get_firmware_version()
65+
ic, ver, rev, support = pn532.firmware_version
6666
print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev))
6767

6868
# Configure PN532 to communicate with MiFare cards

examples/pn532_readwrite_ntag2xx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100)
5959
#pn532 = PN532_UART(uart, debug=False)
6060

61-
ic, ver, rev, support = pn532.get_firmware_version()
61+
ic, ver, rev, support = pn532.firmware_version
6262
print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev))
6363

6464
# Configure PN532 to communicate with MiFare cards

examples/pn532_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100)
3939
#pn532 = PN532_UART(uart, debug=False)
4040

41-
ic, ver, rev, support = pn532.get_firmware_version()
41+
ic, ver, rev, support = pn532.firmware_version
4242
print('Found PN532 with firmware version: {0}.{1}'.format(ver, rev))
4343

4444
# Configure PN532 to communicate with MiFare cards

0 commit comments

Comments
 (0)