-
Notifications
You must be signed in to change notification settings - Fork 118
Added support for ESP32 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ThomasWaldmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR.
Some nitpicky comments from me, I'll try this code soon.
Maybe you could collapse most of your changesets (esp. the ones which all have the same commit comment).
| self.spi.init() | ||
| elif board == 'esp32': | ||
| self.spi = SPI(baudrate=100000, polarity=0, phase=0, sck=self.sck, mosi=self.mosi, miso=self.miso) | ||
| self.spi.init() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you are doing precisely the same thing as 3 lines above, how about just changing line 32 to:
elif board == 'esp8266' or board == 'esp32':
| | mosi | 2 | "GP16" | | | ||
| | miso | 4 | "GP15" | | | ||
| | rst | 5 | "GP22" | | | ||
| | cs | 14 | "GP14" |Labeled SDA on most RFID-RC522 boards | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't have a "cs" on my board.
so, if it really is labelled "sda" for me, keeping that comment seems useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can confirm that cs is labelled sda for me. at least it practically works if i wire it like that.
|
|
||
|
|
||
| def do_read(): | ||
| def do_read(x,y): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8: please have a blank after the comma
also, don't call it x and y, but give good names.
| raise RuntimeError("Unsupported platform") | ||
|
|
||
| print("") | ||
| print('READER %s' %y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8: please have a blank after the percent
|
@wendlers I'll test the code from this PR on my ESP32 soon. Do you think it could be merged after some clean up and this test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i can confirm now, that these kind of changes makes it work on esp32.
I tested the read and write example code (with the pins that worked for me) and both worked.
esp32 wems oled board, rfid-rc522 board from aliexpress.
whether the simple example code needs to support multiple readers is questionable though.
| | mosi | 2 | "GP16" | | | ||
| | miso | 4 | "GP15" | | | ||
| | rst | 5 | "GP22" | | | ||
| | cs | 14 | "GP14" |Labeled SDA on most RFID-RC522 boards | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can confirm that cs is labelled sda for me. at least it practically works if i wire it like that.
| | mosi | 2 | "GP16" | 23 | | ||
| | miso | 4 | "GP15" | 19 | | ||
| | rst | 5 | "GP22" | 4 | | ||
| | cs | 14 | "GP14" | 2 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't have some of these pins on my wems oled esp32 devboard. 16, 5, 26, 25, 4 worked for me.
|
yolo ... sry than for #9
|
|
any updates on this? |
|
Hi Henry, Furthermore u can use the code from @Tasm-Devil 's fork (https://github.com/Tasm-Devil/micropython-mfrc522-esp32) Greetings from Hamburg |
|
Hi, |
Hi,
I added support for ESP32. Since this is my first pull request, I am unsure if I am doing it properly.
Kind regards,
Lennyz