From df6757ce5fbe4f1f701c7e6a65858e83bc217226 Mon Sep 17 00:00:00 2001 From: MichLe Date: Mon, 8 May 2017 14:42:59 +0200 Subject: [PATCH 1/3] Added ability to ignore reset pin to init method. --- pirc522/rfid.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pirc522/rfid.py b/pirc522/rfid.py index 222d3ef..0fc8d47 100644 --- a/pirc522/rfid.py +++ b/pirc522/rfid.py @@ -48,11 +48,12 @@ def __init__(self, bus=0, device=0, speed=1000000, pin_rst=22, self.spi.max_speed_hz = speed GPIO.setmode(pin_mode) - GPIO.setup(pin_rst, GPIO.OUT) + if pin_rst is None: + GPIO.setup(pin_rst, GPIO.OUT) + GPIO.output(pin_rst, 1) GPIO.setup(pin_irq, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.add_event_detect(pin_irq, GPIO.FALLING, callback=self.irq_callback) - GPIO.output(pin_rst, 1) if pin_ce != 0: GPIO.setup(pin_ce, GPIO.OUT) GPIO.output(pin_ce, 1) From 83bd4bd1c169259a8e4c3e7736e2aa610f3a8691 Mon Sep 17 00:00:00 2001 From: MichLe Date: Mon, 8 May 2017 14:49:03 +0200 Subject: [PATCH 2/3] fix typo --- pirc522/rfid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pirc522/rfid.py b/pirc522/rfid.py index 0fc8d47..36ece1d 100644 --- a/pirc522/rfid.py +++ b/pirc522/rfid.py @@ -48,7 +48,7 @@ def __init__(self, bus=0, device=0, speed=1000000, pin_rst=22, self.spi.max_speed_hz = speed GPIO.setmode(pin_mode) - if pin_rst is None: + if pin_rst is not None: GPIO.setup(pin_rst, GPIO.OUT) GPIO.output(pin_rst, 1) GPIO.setup(pin_irq, GPIO.IN, pull_up_down=GPIO.PUD_UP) From a5b7e6f7212dd6af459cd52f0ff612d8b357dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Ondry=C3=A1=C5=A1?= Date: Sat, 17 Jun 2017 20:01:12 +0200 Subject: [PATCH 3/3] Unified pin checking --- pirc522/rfid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pirc522/rfid.py b/pirc522/rfid.py index 36ece1d..3d162d4 100644 --- a/pirc522/rfid.py +++ b/pirc522/rfid.py @@ -48,7 +48,7 @@ def __init__(self, bus=0, device=0, speed=1000000, pin_rst=22, self.spi.max_speed_hz = speed GPIO.setmode(pin_mode) - if pin_rst is not None: + if pin_rst != 0: GPIO.setup(pin_rst, GPIO.OUT) GPIO.output(pin_rst, 1) GPIO.setup(pin_irq, GPIO.IN, pull_up_down=GPIO.PUD_UP)