本文整理汇总了Python中spidev.SpiDev.max_speed_hz方法的典型用法代码示例。如果您正苦于以下问题:Python SpiDev.max_speed_hz方法的具体用法?Python SpiDev.max_speed_hz怎么用?Python SpiDev.max_speed_hz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spidev.SpiDev
的用法示例。
在下文中一共展示了SpiDev.max_speed_hz方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SpiDev
# 需要导入模块: from spidev import SpiDev [as 别名]
# 或者: from spidev.SpiDev import max_speed_hz [as 别名]
import Adafruit_BBIO.GPIO as GPIO
from spidev import SpiDev
import time
import datetime
spi = SpiDev(1, 0)
spi.mode = 3
spi.max_speed_hz = 200000
#spi.xfer2([0x0])
GPIO.setup("P9_11", GPIO.OUT) # A0 sipm select bit0
GPIO.setup("P9_12", GPIO.OUT) # A1 sipm select bit1
GPIO.setup("P9_13", GPIO.OUT) # A2 sipm select bit2
GPIO.setup("P9_14", GPIO.OUT) # A3 sipm select bit3
GPIO.setup("P9_15", GPIO.OUT) # A5 chip select bit0
GPIO.setup("P9_16", GPIO.OUT) # A6 chip select bit1
#chip select map
# 0: nc
# 1: pga
# 2: temp
# 3: mem
GPIO.output("P9_11", GPIO.LOW)
GPIO.output("P9_12", GPIO.LOW)
GPIO.output("P9_13", GPIO.LOW)
GPIO.output("P9_14", GPIO.LOW)
GPIO.output("P9_15", GPIO.LOW)
示例2: range
# 需要导入模块: from spidev import SpiDev [as 别名]
# 或者: from spidev.SpiDev import max_speed_hz [as 别名]
print "read eeprom"
cmd = [0x03, 0] + [0 for i in range(8*16)]
res = spi.xfer2(cmd)
print res
if __name__ == "__main__":
GPIO.setup("P9_11", GPIO.OUT)
GPIO.setup("P9_12", GPIO.OUT)
GPIO.setup("P9_13", GPIO.OUT)
GPIO.setup("P9_14", GPIO.OUT)
GPIO.setup("P9_15", GPIO.OUT)
#spi = SPI()
#spi.open(0, 0)
#spi.msh = 0
spi = SpiDev(1,0)
spi.mode = 3
spi.max_speed_hz = 100000
check_eeprom_status()
write_eeprom(3, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
GPIO.cleanup()
spi.close()