Skip to content

Commit 9ba2526

Browse files
authored
Merge pull request ondryaso#26 from soundstorm/master
Variable Pinout definition (BCM/BOARD)
2 parents 3769277 + a30769c commit 9ba2526

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Furthermore, the IRQ pin is configurable by passing *pin_irq=__BOARD numbering p
4141

4242
__NOTE:__ For RPi A+/B+/2/3 with 40 pin connector, SPI1/2 is available on top of SPI0. Kernel 4.4.x or higher and *dtoverlay* configuration is required. For SPI1/2, *pin_ce=__BOARD numbering pin__* is required.
4343

44+
You may change BOARD pinout to BCM py passing *pin_mode=RPi.GPIO.BCM*. Please note, that you then have to define all pins (irq+rst, ce if neccessary). Otherwise they would default to perhaps wrong pins (rst to pin 15/GPIO22, irq to pin 12/GPIO18).
45+
4446
## Usage
4547
The library is split to two classes - **RFID** and **RFIDUtil**. You can use only RFID, RFIDUtil just makes life a little bit better.
4648
You basically want to start with *while True* loop and "poll" the tag state. That's done using *request* method. Most of the methods

pirc522/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import RPi.GPIO as GPIO
55

66

7-
__version__ = "2.1.0"
7+
__version__ = "2.2.0"
88

99

1010
class RFID(object):
@@ -43,7 +43,7 @@ class RFID(object):
4343
irq = threading.Event()
4444

4545
def __init__(self, bus=0, device=0, speed=1000000, pin_rst=22,
46-
pin_ce=0, pin_irq=18):
46+
pin_ce=0, pin_irq=18, pin_mode=GPIO.BOARD):
4747
self.pin_rst = pin_rst
4848
self.pin_ce = pin_ce
4949
self.pin_irq = pin_irq
@@ -52,7 +52,7 @@ def __init__(self, bus=0, device=0, speed=1000000, pin_rst=22,
5252
self.spi.open(bus, device)
5353
self.spi.max_speed_hz = speed
5454

55-
GPIO.setmode(GPIO.BOARD)
55+
GPIO.setmode(pin_mode)
5656
GPIO.setup(pin_rst, GPIO.OUT)
5757
GPIO.setup(pin_irq, GPIO.IN, pull_up_down=GPIO.PUD_UP)
5858
GPIO.add_event_detect(pin_irq, GPIO.FALLING,

0 commit comments

Comments
 (0)