本文整理匯總了Python中spi.openSPI方法的典型用法代碼示例。如果您正苦於以下問題:Python spi.openSPI方法的具體用法?Python spi.openSPI怎麽用?Python spi.openSPI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類spi
的用法示例。
在下文中一共展示了spi.openSPI方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
def __init__(self, dev='/dev/spidev0.0', speed=1000000, pin_rst=22, pin_ce=0):
self.pin_rst = pin_rst
self.pin_ce = pin_ce
SPI.openSPI(device=dev, speed=speed)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin_rst, GPIO.OUT)
GPIO.output(pin_rst, 1)
if pin_ce != 0:
GPIO.setup(pin_ce, GPIO.OUT)
GPIO.output(pin_ce, 1)
self.reset()
self.dev_write(0x2A, 0x8D)
self.dev_write(0x2B, 0x3E)
self.dev_write(0x2D, 30)
self.dev_write(0x2C, 0)
self.dev_write(0x15, 0x40)
self.dev_write(0x11, 0x3D)
self.set_antenna(True)
示例2: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
def __init__(self, dev='/dev/spidev0.0', speed=1000000, pin_rst=25, pin_ce=8):
self.pin_rst = pin_rst
self.pin_ce = pin_ce
SPI.openSPI(device=dev, speed=speed)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(pin_rst, GPIO.OUT)
GPIO.output(pin_rst, 1)
if pin_ce != 0:
GPIO.setup(pin_ce, GPIO.OUT)
GPIO.output(pin_ce, 1)
self.reset()
self.dev_write(0x2A, 0x8D)
self.dev_write(0x2B, 0x3E)
self.dev_write(0x2D, 30)
self.dev_write(0x2C, 0)
self.dev_write(0x15, 0x40)
self.dev_write(0x11, 0x3D)
self.set_antenna(True)
示例3: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
def __init__(self, dev='/dev/spidev1.0', spd=1000000):
spi.openSPI(device=dev,speed=spd)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(22, GPIO.OUT)
GPIO.output(self.NRSTPD, 1)
self.MFRC522_Init()
示例4: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
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)
self.MFRC522_Init()
示例5: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
def __init__(self,spd=1000000):
spi.openSPI(speed=spd)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(22, GPIO.OUT)
GPIO.output(self.NRSTPD, 1)
self.MFRC522_Init()
示例6: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
def __init__(self, dev='/dev/spidev0.0', spd=1000000):
spi.openSPI(device=dev,speed=spd)
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.OUT)
GPIO.output(self.NRSTPD, 1)
self.MFRC522_Init()
示例7: __init__
# 需要導入模塊: import spi [as 別名]
# 或者: from spi import openSPI [as 別名]
def __init__(self, dev='/dev/spidev0.0', spd=1000000, SDA=8, SCK=11, MOSI=10, MISO=9, RST=25):
# When / if we decide to change this to BCM mode use SDA=8, SCK=11, MOSI=10, MISO=9, RST=25
self.__SDA = SDA
self.__SCK = SCK
self.__MOSI = MOSI
self.__MISO = MISO
self.__RST = RST
self.NRSTPD = self.__RST
spi.openSPI(device=dev, speed=spd)
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.__RST, GPIO.OUT)
GPIO.output(self.NRSTPD, 1)
self.MFRC522_Init()