コード例 #1
0
ファイル: spiTest.py プロジェクト: muirt/bbqbadass_server
def spi_cs0(level):				##ADC
	gpio.output(port.PG7, level)
コード例 #2
0
ファイル: spiTest.py プロジェクト: muirt/bbqbadass_server
from pyA10Lime import spi
import time
from pyA10Lime.gpio import gpio
from pyA10Lime.gpio import port
from pyA10Lime.gpio import connector


spi.open("/dev/spidev2.0")


gpio.init() #Initialize module. Always called first


gpio.setcfg(port.PG7, gpio.OUTPUT)		#CS0
gpio.output(port.PG7, gpio.HIGH)

gpio.setcfg(port.PG8, gpio.OUTPUT)		#CS1
gpio.output(port.PG8, gpio.HIGH)

def spi_cs1(level):				##TC AMP
	gpio.output(port.PG8, level)

def spi_cs0(level):				##ADC
	gpio.output(port.PG7, level)


tcBytes = []
for x in range(0,4):
	tcBytes.append(0)

adcBytes = []
コード例 #3
0
ファイル: spiTest.py プロジェクト: muirt/bbqbadass_server
def spi_cs1(level):				##TC AMP
	gpio.output(port.PG8, level)
コード例 #4
0
def configPin(pin, dir, state):
	gpio.setcfg(pin, dir)
	gpio.output(pin, state)
コード例 #5
0
def outputLevel(name, level):	
	for output in outputConfigs:
		if output['name'] == name:						
			gpio.output(output['pin'], level)
			break
コード例 #6
0
def configPin(pin, dir, state):
    gpio.setcfg(pin, dir)
    gpio.output(pin, state)
コード例 #7
0
def outputLevel(name, level):
    for output in outputConfigs:
        if output['name'] == name:
            gpio.output(output['pin'], level)
            break
コード例 #8
0
from pyA10Lime.gpio import port

__author__ = "Stefan Mavrodiev"
__copyright__ = "Copyright 2014, Olimex LTD"
__credits__ = ["Stefan Mavrodiev"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = __author__
__email__ = "*****@*****.**"

led = connector.gpio0p0  # This is the same as port.PH2
button = connector.gpio3p40
"""Init gpio module"""
gpio.init()
"""Set directions"""
gpio.setcfg(led, gpio.OUTPUT)
gpio.setcfg(button, gpio.INPUT)
"""Enable pullup resistor"""
gpio.pullup(button, gpio.PULLUP)
#gpio.pullup(button, gpio.PULLDOWN)     # Optionally you can use pull-down resistor

try:
    print("Press CTRL+C to exit")
    while True:
        state = gpio.input(button)  # Read button state
        """Since we use pull-up the logic will be inverted"""
        gpio.output(led, not state)

except KeyboardInterrupt:
    print("Goodbye.")
コード例 #9
0
ファイル: read_button.py プロジェクト: 1ntroVert/OLINUXINO
__credits__ = ["Stefan Mavrodiev"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = __author__
__email__ = "*****@*****.**"

led = connector.gpio0p0     # This is the same as port.PH2
button = connector.gpio3p40

"""Init gpio module"""
gpio.init()

"""Set directions"""
gpio.setcfg(led, gpio.OUTPUT)
gpio.setcfg(button, gpio.INPUT)

"""Enable pullup resistor"""
gpio.pullup(button, gpio.PULLUP)
#gpio.pullup(button, gpio.PULLDOWN)     # Optionally you can use pull-down resistor

try:
    print ("Press CTRL+C to exit")
    while True:
        state = gpio.input(button)      # Read button state

        """Since we use pull-up the logic will be inverted"""
        gpio.output(led, not state)

except KeyboardInterrupt:
    print ("Goodbye.")
コード例 #10
0
ファイル: spiTest.py プロジェクト: muirt/bbqbadass_server
def spi_cs0(level):  ##ADC
    gpio.output(port.PG7, level)
コード例 #11
0
ファイル: spiTest.py プロジェクト: muirt/bbqbadass_server
def spi_cs1(level):  ##TC AMP
    gpio.output(port.PG8, level)
コード例 #12
0
ファイル: spiTest.py プロジェクト: muirt/bbqbadass_server
from pyA10Lime import spi
import time
from pyA10Lime.gpio import gpio
from pyA10Lime.gpio import port
from pyA10Lime.gpio import connector

spi.open("/dev/spidev2.0")

gpio.init()  #Initialize module. Always called first

gpio.setcfg(port.PG7, gpio.OUTPUT)  #CS0
gpio.output(port.PG7, gpio.HIGH)

gpio.setcfg(port.PG8, gpio.OUTPUT)  #CS1
gpio.output(port.PG8, gpio.HIGH)


def spi_cs1(level):  ##TC AMP
    gpio.output(port.PG8, level)


def spi_cs0(level):  ##ADC
    gpio.output(port.PG7, level)


tcBytes = []
for x in range(0, 4):
    tcBytes.append(0)

adcBytes = []
for x in range(0, 2):
コード例 #13
0
from pyA10Lime.gpio import port

__author__ = "Stefan Mavrodiev"
__copyright__ = "Copyright 2014, Olimex LTD"
__credits__ = ["Stefan Mavrodiev"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = __author__
__email__ = "*****@*****.**"

led = port.PH2

gpio.init()
gpio.setcfg(led, gpio.OUTPUT)

try:
    print("Press CTRL+C to exit")
    while True:
        gpio.output(led, 1)
        sleep(0.1)
        gpio.output(led, 0)
        sleep(0.1)

        gpio.output(led, 1)
        sleep(0.1)
        gpio.output(led, 0)
        sleep(0.1)

        sleep(0.6)
except KeyboardInterrupt:
    print("Goodbye.")
コード例 #14
0
ファイル: blink_led.py プロジェクト: 1ntroVert/OLINUXINO
__author__ = "Stefan Mavrodiev"
__copyright__ = "Copyright 2014, Olimex LTD"
__credits__ = ["Stefan Mavrodiev"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = __author__
__email__ = "*****@*****.**"


led = port.PH2

gpio.init()
gpio.setcfg(led, gpio.OUTPUT)

try:
    print ("Press CTRL+C to exit")
    while True:
        gpio.output(led, 1)
        sleep(0.1)
        gpio.output(led, 0)
        sleep(0.1)

        gpio.output(led, 1)
        sleep(0.1)
        gpio.output(led, 0)
        sleep(0.1)

        sleep(0.6)
except KeyboardInterrupt:
    print ("Goodbye.")