本文整理汇总了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()