Shebang added, fixed typo, executable bit removed

This commit is contained in:
Lukasz Szczesny 2014-07-13 16:51:49 +02:00
parent 22ac7b84b8
commit 3f25de5fc1
4 changed files with 16 additions and 4 deletions

3
Dump.py Executable file → Normal file
View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import MFRC522 import MFRC522
import signal import signal

9
MFRC522.py Executable file → Normal file
View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import spi import spi
import signal import signal
@ -104,7 +107,7 @@ class MFRC522:
serNum = [] 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) spi.openSPI(device=dev,speed=spd)
GPIO.setmode(GPIO.BOARD) GPIO.setmode(GPIO.BOARD)
GPIO.setup(22, GPIO.OUT) GPIO.setup(22, GPIO.OUT)
@ -114,10 +117,10 @@ class MFRC522:
def MFRC522_Reset(self): def MFRC522_Reset(self):
self.Write_MFRC522(self.CommandReg, self.PCD_RESETPHASE) 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)) spi.transfer(((addr<<1)&0x7E,val))
def Read_MFRC522(self,addr): def Read_MFRC522(self, addr):
val = spi.transfer((((addr<<1)&0x7E) | 0x80,0)) val = spi.transfer((((addr<<1)&0x7E) | 0x80,0))
return val[1] return val[1]

5
Read.py Executable file → Normal file
View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import MFRC522 import MFRC522
import signal import signal
@ -53,4 +56,4 @@ while continue_reading:
print "Authentication error" print "Authentication error"
# Make sure to stop scanning for cards # Make sure to stop scanning for cards
continue_reading = false continue_reading = False

3
Write.py Executable file → Normal file
View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import MFRC522 import MFRC522
import signal import signal