当前位置: 首页>>代码示例>>Python>>正文


Python SPI.bpw方法代码示例

本文整理汇总了Python中Adafruit_BBIO.SPI.SPI.bpw方法的典型用法代码示例。如果您正苦于以下问题:Python SPI.bpw方法的具体用法?Python SPI.bpw怎么用?Python SPI.bpw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Adafruit_BBIO.SPI.SPI的用法示例。


在下文中一共展示了SPI.bpw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SPI

# 需要导入模块: from Adafruit_BBIO.SPI import SPI [as 别名]
# 或者: from Adafruit_BBIO.SPI.SPI import bpw [as 别名]
from Adafruit_BBIO.SPI import SPI

spi = SPI(0,0)
spi.open(0,0)
#spi.msh = 100000
spi.bpw = 8
#spi.mode = b00
try:
#while True:
        # set CS bit high, choose first channel to read from

        #channel = 0;
        #adc = spi.xfer([1,8,0])
        #data = ((adc[1]&3) << 8) + adc[2]

        channelSelect = 0xC0
        channelSelect |= 0x18
        channelSelect <<= 3
        fsr = spi.xfer2([channelSelect, 0x00, 0x00])
        #result = spi.readbytes(2)
        #result2 = spi.readbytes(1)

        resultFinal = 0x0000
        resultFinal = 0x0300 & (resultFinal | (fsr[1] << 8 ))
        resultFinal |= ( ( 0x00FF  & fsr[2]) )
        #print (8 + channel ) << 4
        #print resultFinal

	###################################
	####################################
	resultFinal = 1 #temp
开发者ID:bradleysnyder,项目名称:BeagleBoneBlack,代码行数:33,代码来源:methane_test.py

示例2: SPI

# 需要导入模块: from Adafruit_BBIO.SPI import SPI [as 别名]
# 或者: from Adafruit_BBIO.SPI.SPI import bpw [as 别名]
#!/usr/bin/python

from Adafruit_BBIO.SPI import SPI
from time import sleep
spi = SPI(0,0)
spi.bpw = 12
spi.msh = 100000
spi.lsbfirst = False
spi.mode = 0
spi.open

tlc5947_count = 2
tlc5947_channels = 24
# buffer = [0x000] * 48
buffer = [0x000] * (tlc5947_count * tlc5947_channels)

#spi.writebytes(buffer)
#print buffer


spi.writebytes(buffer)


#sleep(1)

spi.close


# CS_0  P9_17 lat
# DO    P9_21 din
# DI    P9_18 n/c
开发者ID:jasonblewis,项目名称:bbb-clock,代码行数:33,代码来源:testspi.py

示例3: RegWrite

# 需要导入模块: from Adafruit_BBIO.SPI import SPI [as 别名]
# 或者: from Adafruit_BBIO.SPI.SPI import bpw [as 别名]
	RegWrite(ADS1248.MUX0, 0b00000001);	# MUX0:  Pos. input: AIN0, Neg. input: AIN1 (Burnout current source off) 
	RegWrite(ADS1248.MUX1, 0b00100000);	# MUX1:  REF0, normal operation
	RegWrite(ADS1248.SYS0, 0b00000000);	# SYS0:  PGA Gain = 1, 5 SPS
	RegWrite(ADS1248.IDAC0,0b00000000);	# IDAC0: off
	RegWrite(ADS1248.IDAC1,0b11001100);	# IDAC1: n.c.
	RegWrite(ADS1248.VBIAS,0b00000000);	# VBIAS: BIAS voltage disabled
 	RegWrite(ADS1248.OFC0, 0b00000000);	# OFC0:  0 => reset offset calibration
	RegWrite(ADS1248.OFC1, 0b00000000);	# OFC1:  0 => reset offset calibration
	RegWrite(ADS1248.OFC2, 0b00000000);	# OFC2:  0 => reset offset calibration
	RegWrite(ADS1248.GPIOCFG, 0b00000000);	# GPIOCFG: all used as analog inputs
	RegWrite(ADS1248.GPIODIR, 0b00000000);	# GPIODIR: -
	RegWrite(ADS1248.GPIODAT, 0b00000000);	# GPIODAT: -
	
spi = SPI(0,0)	#/dev/spidev1.0
spi.msh=10000 # SPI clock set to 100 kHz
spi.bpw = 8  # bits/word
spi.threewire = False
spi.lsbfirst = False
spi.mode = 1 
spi.cshigh = False  # ADS1248 chip select (active low)
spi.open(0,0)

GPIO.setup("P9_14", GPIO.OUT)


# drive START high to start conversion

GPIO.setup(ADS1248.STARTPIN, GPIO.OUT)
GPIO.output(ADS1248.STARTPIN,GPIO.HIGH)

time.sleep(0.02)
开发者ID:donfuge,项目名称:ADS1248,代码行数:33,代码来源:ADS1248_minimal.py


注:本文中的Adafruit_BBIO.SPI.SPI.bpw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。