Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ For the ESP8266 there are multiple solutions to do that. E.g. use the

I used the following pins for my setup:

| Signal | GPIO ESP8266 | GPIO WiPy | Note |
| --------- | ------------ | -------------- | ------------------------------------ |
| sck | 0 | "GP14" | |
| mosi | 2 | "GP16" | |
| miso | 4 | "GP15" | |
| rst | 5 | "GP22" | |
| cs | 14 | "GP14" |Labeled SDA on most RFID-RC522 boards |
| Signal | GPIO ESP8266 | GPIO ESP32 | GPIO WiPy | Note |
| --------- | ------------ | ---------- | -------------- | ------------------------------------ |
| sck | 0 | 14 | "GP14" | |
| mosi | 2 | 13 | "GP16" | |
| miso | 4 | 12 | "GP15" | |
| rst | 5 | 27 | "GP22" | |
| cs | 14 | 15 | "GP14" |Labeled SDA on most RFID-RC522 boards |

Now enter the REPL you could run one of the two exmaples:

Expand Down
2 changes: 2 additions & 0 deletions examples/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def do_read():
rdr = mfrc522.MFRC522("GP14", "GP16", "GP15", "GP22", "GP17")
elif uname()[0] == 'esp8266':
rdr = mfrc522.MFRC522(0, 2, 4, 5, 14)
elif uname()[0] == 'esp32':
rdr = mfrc522.MFRC522(14, 13, 12, 27, 15)
else:
raise RuntimeError("Unsupported platform")

Expand Down
2 changes: 2 additions & 0 deletions examples/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def do_write():
rdr = mfrc522.MFRC522("GP14", "GP16", "GP15", "GP22", "GP17")
elif uname()[0] == 'esp8266':
rdr = mfrc522.MFRC522(0, 2, 4, 5, 14)
elif uname()[0] == 'esp32':
rdr = mfrc522.MFRC522(14, 13, 12, 27, 15)
else:
raise RuntimeError("Unsupported platform")

Expand Down
2 changes: 1 addition & 1 deletion mfrc522.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, sck, mosi, miso, rst, cs):
if board == 'WiPy' or board == 'LoPy' or board == 'FiPy':
self.spi = SPI(0)
self.spi.init(SPI.MASTER, baudrate=1000000, pins=(self.sck, self.mosi, self.miso))
elif board == 'esp8266':
elif board == 'esp8266' or board == 'esp32':
self.spi = SPI(baudrate=100000, polarity=0, phase=0, sck=self.sck, mosi=self.mosi, miso=self.miso)
self.spi.init()
else:
Expand Down