當前位置: 首頁>>代碼示例>>Python>>正文


Python SPI.msh方法代碼示例

本文整理匯總了Python中Adafruit_BBIO.SPI.SPI.msh方法的典型用法代碼示例。如果您正苦於以下問題:Python SPI.msh方法的具體用法?Python SPI.msh怎麽用?Python SPI.msh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Adafruit_BBIO.SPI.SPI的用法示例。


在下文中一共展示了SPI.msh方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from Adafruit_BBIO.SPI import SPI [as 別名]
# 或者: from Adafruit_BBIO.SPI.SPI import msh [as 別名]
	def __init__(self, bus):
		# Use Adafruit_BBIO.SPI to initialize the cap
		# and the spi bus configuration
		s = SPI(bus, self.__DEVICE)
		s.msh = self.__SPEED
		s.mode = self.__MODE
		s.close()

		# Use normal file for writing bytes
		dev = '/dev/spidev%s.%s' % (bus + 1, self.__DEVICE)
		self.spi = open(dev, 'wb')
		print 'Opened %s, Freq: %sHz' % (dev, self.__SPEED)
開發者ID:flaub,項目名稱:tikitank,代碼行數:14,代碼來源:leds.py

示例2: SPI

# 需要導入模塊: from Adafruit_BBIO.SPI import SPI [as 別名]
# 或者: from Adafruit_BBIO.SPI.SPI import msh [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: print

# 需要導入模塊: from Adafruit_BBIO.SPI import SPI [as 別名]
# 或者: from Adafruit_BBIO.SPI.SPI import msh [as 別名]
### New Python Template File
### H27 Mar 16

import os, sys
import time
import Adafruit_BBIO.GPIO as GPIO
from Adafruit_BBIO.SPI import SPI

GPIO.setup("P9_12",GPIO.OUT)
GPIO.output("P9_12",GPIO.HIGH)
print("GPIO >> HIGH")

spi_in = SPI(0, 0)
spi_out = SPI(0, 1)

spi_out.msh = 500000

while True:
    
    GPIO.output("P9_12",GPIO.LOW)
    print("GPIO >> LOW")
    spi_out.writebytes([0b00001111])
    print("write >> num")
    print spi_in.readbytes(1)
    GPIO.output("P9_12",GPIO.HIGH)
    print("GPIO >> HIGH")
    time.sleep(1)

GPIO.cleanup()

開發者ID:5montest,項目名稱:spi,代碼行數:31,代碼來源:test.py

示例4: SPI

# 需要導入模塊: from Adafruit_BBIO.SPI import SPI [as 別名]
# 或者: from Adafruit_BBIO.SPI.SPI import msh [as 別名]
from Adafruit_BBIO.SPI import SPI 

spi = SPI(1,0) 
spi.mode=2 

spi.msh=200000 
spi.open(1,0) 

print spi.readbytes(4)
#print spi.xfer2([32, 11, 110, 22, 220]) 
spi.close() 
開發者ID:bauchter-work,項目名稱:2445_git_repo,代碼行數:13,代碼來源:no_loopback_test.py

示例5: ADCinit

# 需要導入模塊: from Adafruit_BBIO.SPI import SPI [as 別名]
# 或者: from Adafruit_BBIO.SPI.SPI import msh [as 別名]
def ADCinit():	
	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)
開發者ID:donfuge,項目名稱:ADS1248,代碼行數:32,代碼來源:ADS1248_minimal.py

示例6: SPI

# 需要導入模塊: from Adafruit_BBIO.SPI import SPI [as 別名]
# 或者: from Adafruit_BBIO.SPI.SPI import msh [as 別名]
from Adafruit_BBIO.SPI import SPI
import time

pause = 0.1

chipSelect = "P9_12"
GPIO.setup(chipSelect, GPIO.OUT)
GPIO.output(chipSelect, GPIO.HIGH)

sclk = "P9_11"
GPIO.setup(sclk, GPIO.IN)

spi = SPI(0,0)
spi.mode = 0

spi.msh = 500000
spi.open(0,0)

# global count
# count = 0;
#
# def callback_function_print(input_pin):
#   count = count + 1
#   print "Input on pin", input_pin
#
# GPIO.add_event_detect(sclk, GPIO.BOTH, callback=callback_function_print)

def spi_write(num):
    print "Writing " + num + "..."
    GPIO.output(chipSelect, GPIO.LOW)
    print str(spi.xfer2([int(num)]))
開發者ID:erebus-labs,項目名稱:blocks-o-code,代碼行數:33,代碼來源:spi_test.py


注:本文中的Adafruit_BBIO.SPI.SPI.msh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。