本文整理匯總了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()