Skip to content

Commit be3687b

Browse files
Update README.md for interrupt support
1 parent 709ca62 commit be3687b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ Connecting RC522 module to SPI is pretty easy. You can use [this neat website](h
3030
| SCK | 2 | 23 | GPIO11, SCKL |
3131
| MOSI | 3 | 19 | GPIO10, MOSI |
3232
| MISO | 4 | 21 | GPIO9, MISO |
33+
| IRQ | 5 | 18 | GPIO24 |
3334
| GND | 6 | 6, 9, 20, 25 | Ground |
3435
| RST | 7 | 22 | GPIO25 |
35-
| 3.3V | 8 | 1 | 3V3 |
36+
| 3.3V | 8 | 1,17 | 3V3 |
3637

3738
You can also connect the SDA pin to CE1 (GPIO7, pin #26) and call the RFID constructor with *bus=0, device=1*
3839
and you can connect RST pin to any other free GPIO pin and call the constructor with *pin_rst=__BOARD numbering pin__*.
40+
Furthermore, the IRQ pin is configurable by passing *pin_irq=__BOARD numbering pin__*.
3941

4042
__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.
4143

@@ -51,6 +53,7 @@ from pirc522 import RFID
5153
rdr = RFID()
5254

5355
while True:
56+
rdr.wait_for_tag()
5457
(error, tag_type) = rdr.request()
5558
if not error:
5659
print("Tag detected")
@@ -84,6 +87,9 @@ util = rdr.util()
8487
util.debug = True
8588

8689
while True:
90+
# Wait for tag
91+
rdr.wait_for_tag()
92+
8793
# Request tag
8894
(error, data) = rdr.request()
8995
if not error:
@@ -121,6 +127,4 @@ while True:
121127
util.dump()
122128
# We must stop crypto
123129
util.deauth()
124-
125-
time.sleep(1)
126130
```

0 commit comments

Comments
 (0)