本文整理汇总了Python中spi.openSPI函数的典型用法代码示例。如果您正苦于以下问题:Python openSPI函数的具体用法?Python openSPI怎么用?Python openSPI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了openSPI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,spd=1000000):
spi.openSPI(speed=spd)
#GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
GPIO.setup(self.NRSTPD, GPIO.OUT)
GPIO.output(self.NRSTPD, GPIO.HIGH)
self.MFRC522_Init()
开发者ID:02047788a,项目名称:SignInRPI,代码行数:7,代码来源:MFRC522.py
示例2: main
def main():
# Open file descriptor for
# spi device 0 using the CE0 pin for chip select
device_0 = spi.openSPI(device="/dev/spidev0.0",
mode=0,
speed=1000000)
# Open file descriptor for
# spi device 0 using the CE1 pin for chip select
device_1 = spi.openSPI(device="/dev/spidev0.1",
mode=0,
speed=1000000)
# Transact data
data_out = (0xFF, 0x00, 0xFF)
# This is not necessary, not just demonstrate loop-back
data_in = (0x00, 0x00, 0x00)
data_in = spi.transfer(device_0, data_out)
print("Received from device 0:")
print(data_in)
data_in = (0x00, 0x00, 0x00)
data_in = spi.transfer(device_1, data_out)
print("Received from device 1:")
print(data_in)
# Close file descriptors
spi.closeSPI(device_0)
spi.closeSPI(device_1)
开发者ID:lthiery,项目名称:SPI-Py,代码行数:30,代码来源:test_script.py
示例3: __init__
def __init__(self, *args, **kargs):
GPIO.setmode(GPIO.BOARD)
# pin15=GPIO22 is linked to MAX3420 -RST
GPIO.setup(15, GPIO.OUT)
GPIO.output(15,GPIO.LOW)
GPIO.output(15,GPIO.HIGH)
spi.openSPI(speed=26000000)
开发者ID:BastilleResearch,项目名称:goodfet,代码行数:7,代码来源:GoodFET.py
示例4: __init__
def __init__(self,spd=1000000):
spi.openSPI(speed=spd)
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(22, GPIO.OUT)
GPIO.output(self.NRSTPD, 1)
self.MFRC522_Init()
开发者ID:Jipolie01,项目名称:TheQuestToTheBestWorkout,代码行数:7,代码来源:MFRC522.py
示例5: __init__
def __init__(self, *args, **kargs):
# GPIO.setmode(GPIO.BOARD)
# # pin15=GPIO22 is linked to MAX3420 -RST
# GPIO.setup(15, GPIO.OUT)
# GPIO.output(15,GPIO.LOW)
# GPIO.output(15,GPIO.HIGH)
spi.openSPI(device="/dev/spidev1.0", speed=26000000)
开发者ID:dominicgs,项目名称:BeagleDancer,代码行数:7,代码来源:GoodFET.py
示例6: __init__
def __init__(self, dev='/dev/spidev0.1', 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()
开发者ID:peter-volkov,项目名称:RackTrack,代码行数:7,代码来源:MFRC522.py
示例7: __init__
def __init__(self, dev='/dev/spidev0.0', spd=1000000):
spi.openSPI(device=dev,speed=spd)
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.NRSTPD, GPIO.OUT)
GPIO.output(self.NRSTPD, 0)
GPIO.setup(self.SDA, GPIO.OUT)
GPIO.output(self.SDA, 0)
self.MFRC522_Init()
开发者ID:MakerSpaceLeiden,项目名称:AccesSystem,代码行数:8,代码来源:MFRC522.py
示例8: lcd_cmd
def lcd_cmd(cmd):
stat = spi.openSPI(SPI_DEVICE,speed=SPI_SPEED,bits=8)
# print "LCD CMD(1)=%X, SPI_open=" % (cmd) , stat
spi.transfer((0,cmd>>8,0x00ff&cmd,0x11)) # 0x11 - CMD_BE const from ili9341.c
spi.closeSPI()
# time.sleep(0.0001) # 100us
stat = spi.openSPI(SPI_DEVICE,speed=SPI_SPEED,bits=8)
# print "LCD CMD(2)=%X, SPI_open=" % (cmd) , stat
spi.transfer((0,cmd>>8,0x00ff&cmd,0x1B)) # x01B - CMD_AF const from ili9341.c
spi.closeSPI()
return
开发者ID:FREEWING-JP,项目名称:rpi-spi-lcd35-kedei,代码行数:11,代码来源:lcd.py
示例9: lcd_data
def lcd_data(data):
stat = spi.openSPI(SPI_DEVICE,speed=SPI_SPEED,bits=8)
# print "LCD DATA(1)=%X, SPI_open=" % (data) , stat
spi.transfer((0,data>>8,0x00ff&data,0x15)) # 0x15 - DATA_BE const from ili9341.c (BE is short form "before")
spi.closeSPI()
# time.sleep(0.00001) # 10us
stat = spi.openSPI(SPI_DEVICE,speed=SPI_SPEED,bits=8)
# print "LCD DATA(2)=%X, SPI_open=" % (data) , stat
spi.transfer((0,data>>8,0x00ff&data,0x1F)) # 0x1F - DATA_AF const from ili9341.c (AF is short form "after")
spi.closeSPI()
return
开发者ID:FREEWING-JP,项目名称:rpi-spi-lcd35-kedei,代码行数:11,代码来源:lcd.py
示例10: issue_setup
def issue_setup(self, data):
"""
Sets up the Raspdancer to communicate with the MAX324x.
"""
# pin15=GPIO22 is linked to MAX3420 -RST
GPIO.setup(15, GPIO.OUT)
GPIO.output(15,GPIO.LOW)
GPIO.output(15,GPIO.HIGH)
spi.openSPI(speed=26000000)
return b''
开发者ID:travisgoodspeed,项目名称:goodfet,代码行数:12,代码来源:Raspdancer.py
示例11: __init__
def __init__(self,spd=1000000, NRSTPDpin = 25, GPIO = None):
spi.openSPI(speed=spd)
if not GPIO:
import RPi.GPIO as GPIO
self.GPIO = GPIO
self.GPIO.setmode(GPIO.BCM)
self.NRSTPD = NRSTPDpin;
self.GPIO.setup(self.NRSTPD, GPIO.OUT)
self.GPIO.output(self.NRSTPD, 1)
self.MFRC522_Init()
开发者ID:KrishJoshi,项目名称:Raspberry-Pi-Attendance-System,代码行数:12,代码来源:MFRC522.py
示例12: lcd_reset
def lcd_reset():
# for reset I use slow clock - just my habit
stat = spi.openSPI(SPI_DEVICE,speed=1000000,bits=8)
# print "LCD RESET(1), SPI_open=",stat
spi.transfer((0,0,0,0)) # set 0 on U1-Q2
spi.closeSPI()
time.sleep(0.05) # 50ms reset
# unreset
stat = spi.openSPI(SPI_DEVICE,speed=1000000,bits=8)
# print "LCD RESET(2), SPI_open=",stat
spi.transfer((0,0,0,2)) # set 1 on U1-Q2
spi.closeSPI()
time.sleep(0.1) # 100ms after reset
return
开发者ID:FREEWING-JP,项目名称:rpi-spi-lcd35-kedei,代码行数:14,代码来源:lcd.py
示例13: __init__
def __init__(self, dev='/dev/spidev0.0', speed=1000000, pin_rst=22):
self.pin_rst = pin_rst
SPI.openSPI(device=dev, speed=speed)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin_rst, GPIO.OUT)
GPIO.output(pin_rst, 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)
开发者ID:GeorgN,项目名称:pi-rc522,代码行数:15,代码来源:RFID.py
示例14: __init__
def __init__(self):
self.xDefault = 148
self.yDefault = 176
self.xMin = 128
self.xMax = 168
self.yMin = 136
self.yMax = 216
self.devMaxX = None
self.devMinX = None
self.devMaxY = None
self.devMinY = None
spi.openSPI(speed=1000000, mode=0)
开发者ID:politeauthority,项目名称:chair_bot,代码行数:15,代码来源:chair_controller.py
示例15: __init__
def __init__(self, name, bus, channel, _3wire=True):
self.serial = name
device = "/dev/spidev%s.%s" % (bus, channel)
spi.openSPI(speed=100000, mode=1, device=device)
self.config = REG_CONF_VBIAS_ON | REG_CONF_50HZ_FILTER | REG_CONF_CONVERSION_MODE_AUTO
if(_3wire):
self.config |= REG_CONF_3WIRE_RTD
self.__write__(REG_CONFIGURATION, self.config | REG_CONF_FAULT_STATUS_AUTO_CLEAR)
self.__write__(REG_LF_MSB, 0x00)
self.__write__(REG_LF_LSB, 0x00)
self.__write__(REG_HF_MSB, 0xFF)
self.__write__(REG_HF_LSB, 0xFF)
开发者ID:junkyalleycat,项目名称:py-max31865,代码行数:15,代码来源:max31865.py
示例16: __init__
def __init__(self, devMaxX, devMinX, devMaxY, devMinY):
self.xDefault = 148
self.yDefault = 176
self.xMin = 128
self.xMax = 168
self.yMin = 146
self.yMax = 206
self.devMaxX = devMaxX
self.devMinX = devMinX
self.devMaxY = devMinY
self.devMinY = devMaxY
spi.openSPI(speed=1000000, mode=0)
开发者ID:bemcculley,项目名称:chair_bot,代码行数:16,代码来源:chair_controller.py
示例17: __init__
def __init__(self, speed, a0_port):
import RPi.GPIO as GPIO
import spi
self.a0_port = a0_port
self.spi_device = spi.openSPI(speed=speed)
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.a0_port, GPIO.OUT)
开发者ID:cfaessler,项目名称:python_st7565_driver,代码行数:8,代码来源:devices.py
示例18: __init__
def __init__(self, dev=None, spd=1000000):
if dev is None:
self._dev = '/dev/spidev0.0'
else:
self._dev = dev
self._spd = spd
self._ret = spi.openSPI(device=self._dev, speed=self._spd)
self.MFRC522_Init()
开发者ID:azdkj532,项目名称:MFRC522-python,代码行数:8,代码来源:MFRC522.py
示例19: init
def init():
status = spi.openSPI(speed=1000000)
print "SPI configuration = ", status
send_byte(MAX7219_REG_SCANLIMIT, 7) # show all 8 digits
send_byte(MAX7219_REG_DECODEMODE, 0) # using a LED matrix (not digits)
send_byte(MAX7219_REG_DISPLAYTEST, 0) # no display test
clear()
brightness(7) # character intensity: range: 0..15
send_byte(MAX7219_REG_SHUTDOWN, 1) # not in shutdown mode (i.e start it up)
开发者ID:Andreyjktl,项目名称:max7219,代码行数:10,代码来源:led.py
示例20: __init__
def __init__(self):
# Mode 0, default speed
spi.openSPI()
self.temperature = 0
self.pump_led = 0
self.heater_led = 0
self.heat_led = 0
self.light_led = 0
self.temp_led = 0
self.temperature_led = 0
self.curTemp = 0
self.setPoint = 0
self.clients = {}
self.MAX_TEMP = 40
self.COOL_TEMP = 30
# Setup the threading callback
self.refreshThreadStop = Event()
self.refreshThread = Thread(target = self.refreshThread, args=(self.refreshThreadStop,))
self.refreshThread.start()
开发者ID:pwschuurman,项目名称:hottub_controller,代码行数:21,代码来源:hottubapi.py
注:本文中的spi.openSPI函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论