Merge branch 'wybczu-master'
This commit is contained in:
commit
9129dad7eb
4 changed files with 17 additions and 5 deletions
3
Dump.py
Executable file → Normal file
3
Dump.py
Executable file → Normal file
|
@ -1,3 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import MFRC522
|
||||
import signal
|
||||
|
|
13
MFRC522.py
Executable file → Normal file
13
MFRC522.py
Executable file → Normal file
|
@ -1,3 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import spi
|
||||
import signal
|
||||
|
@ -104,8 +107,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)
|
||||
|
@ -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]
|
||||
|
||||
|
@ -390,4 +393,4 @@ class MFRC522:
|
|||
|
||||
self.Write_MFRC522(self.TxAutoReg, 0x40)
|
||||
self.Write_MFRC522(self.ModeReg, 0x3D)
|
||||
self.AntennaOn()
|
||||
self.AntennaOn()
|
||||
|
|
3
Read.py
Executable file → Normal file
3
Read.py
Executable file → Normal file
|
@ -1,3 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import MFRC522
|
||||
import signal
|
||||
|
|
3
Write.py
Executable file → Normal file
3
Write.py
Executable file → Normal file
|
@ -1,3 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import MFRC522
|
||||
import signal
|
||||
|
|
Loading…
Reference in a new issue