From 22ac7b84b85f129466e5600a9ccf7e89ffd9103d Mon Sep 17 00:00:00 2001 From: Lukasz Szczesny Date: Sun, 13 Jul 2014 16:36:22 +0200 Subject: [PATCH 1/2] Added 'dev' parameter --- MFRC522.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MFRC522.py b/MFRC522.py index 30575bf..b18d0ff 100755 --- a/MFRC522.py +++ b/MFRC522.py @@ -104,8 +104,8 @@ class MFRC522: serNum = [] - def __init__(self,spd=1000000): - spi.openSPI(speed=spd) + def __init__(self,dev='/dev/spidev0.0',spd=1000000): + spi.openSPI(device=dev,speed=spd) GPIO.setmode(GPIO.BOARD) GPIO.setup(22, GPIO.OUT) GPIO.output(self.NRSTPD, 1) @@ -390,4 +390,4 @@ class MFRC522: self.Write_MFRC522(self.TxAutoReg, 0x40) self.Write_MFRC522(self.ModeReg, 0x3D) - self.AntennaOn() \ No newline at end of file + self.AntennaOn() From 3f25de5fc1d8cbfc7d788d13eaac18fc043ce901 Mon Sep 17 00:00:00 2001 From: Lukasz Szczesny Date: Sun, 13 Jul 2014 16:51:49 +0200 Subject: [PATCH 2/2] Shebang added, fixed typo, executable bit removed --- Dump.py | 3 +++ MFRC522.py | 9 ++++++--- Read.py | 5 ++++- Write.py | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) mode change 100755 => 100644 Dump.py mode change 100755 => 100644 MFRC522.py mode change 100755 => 100644 Read.py mode change 100755 => 100644 Write.py diff --git a/Dump.py b/Dump.py old mode 100755 new mode 100644 index 49e6122..ba7333a --- a/Dump.py +++ b/Dump.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + import RPi.GPIO as GPIO import MFRC522 import signal diff --git a/MFRC522.py b/MFRC522.py old mode 100755 new mode 100644 index b18d0ff..6f157c2 --- a/MFRC522.py +++ b/MFRC522.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + import RPi.GPIO as GPIO import spi import signal @@ -104,7 +107,7 @@ class MFRC522: serNum = [] - def __init__(self,dev='/dev/spidev0.0',spd=1000000): + def __init__(self, dev='/dev/spidev0.0', spd=1000000): spi.openSPI(device=dev,speed=spd) GPIO.setmode(GPIO.BOARD) GPIO.setup(22, GPIO.OUT) @@ -114,10 +117,10 @@ class MFRC522: def MFRC522_Reset(self): self.Write_MFRC522(self.CommandReg, self.PCD_RESETPHASE) - def Write_MFRC522(self,addr,val): + def Write_MFRC522(self, addr, val): spi.transfer(((addr<<1)&0x7E,val)) - def Read_MFRC522(self,addr): + def Read_MFRC522(self, addr): val = spi.transfer((((addr<<1)&0x7E) | 0x80,0)) return val[1] diff --git a/Read.py b/Read.py old mode 100755 new mode 100644 index 16517f2..c90e213 --- a/Read.py +++ b/Read.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + import RPi.GPIO as GPIO import MFRC522 import signal @@ -53,4 +56,4 @@ while continue_reading: print "Authentication error" # Make sure to stop scanning for cards - continue_reading = false + continue_reading = False diff --git a/Write.py b/Write.py old mode 100755 new mode 100644 index 154da67..d754463 --- a/Write.py +++ b/Write.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + import RPi.GPIO as GPIO import MFRC522 import signal