Skip to content

Conversation

@ukleinek
Copy link

@ukleinek ukleinek commented Aug 5, 2019

I tried to make use of this project on a non-rpi hardware with python3. These are the cleanups I applied for it.

I didn't include the bits to make it run on my platform as this probably breaks on rpi then :-)

Only adaptions to print statments were needed
They are not needed and to use them is unpythonic
MFRC522.py was the only file in this project with DOS line endings
MFRC522_Init is only ever called from MFRC522's __init__ function. Move all
of the former into the latter function dropping a duplicate call to
GPIO.output(self.NRSTPD, 1).
Instead of letting the users of an MFRC522 instance clean up the resources
of RPi.GPIO, do this in the __del__ method of the instance. Also only clean
up the channel used as a complete cleanup might interfere with other parts
of a program that uses RPi.GPIO also for other stuff.
Depending on the state of the GPIO used for NRSTPD calling

	GPIO.setup(self.NRSTPD, GPIO.OUT)

might drive the line to its low level until

	GPIO.output(self.NRSTPD, 1)

is called. To prevent this spike combine these two calls into a single call
to setup specifying an initial value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant