ondryaso / pi-rc522

Raspberry Pi Python library for SPI RFID RC522 module
MIT License
417 stars 149 forks source link

Updated code to allow usage of SPI1/2 on RPi A+/B+/2/3 for python3 #3

Closed faultylee closed 8 years ago

faultylee commented 8 years ago

Hi @ondryaso I've been using your code on my Raspberry Pi B and been working for a while. Recently I upgraded to Pi 2 and added touch screen. The cable length of the touch controller requires a much slower SPI speed to get it working properly, hence I switch the RFID module to using SPI1. But I ran into issue that SPI1/2 doesn't control CE pin natively.

Hence I made the changes to have pin_ce configuration and toggle from code. By default pin_ce=0 so it will allow hardware SPI to have control though only works in SPI0.

Since I'm using python3, I've adopted the code for that as well, just minor changes on print()

Also, the usage example is missing select_tag() before calling card_auth()

Hope this is useful for you and anyone else in the future

ondryaso commented 8 years ago

Thank you very much! I'll look into it and most probably merge it soon.