Skip to content
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

Cleanups #78

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Cleanups #78

wants to merge 8 commits into from

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