Exemplo n.º 1
0
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 = []
Exemplo n.º 2
0
def setup():
	gpio.init() 	
	for config in outputConfigs:
		
		configPin(config['pin'], gpio.OUTPUT, config['level'])
Exemplo n.º 3
0
def setup():
    gpio.init()
    for config in outputConfigs:

        configPin(config['pin'], gpio.OUTPUT, config['level'])
Exemplo n.º 4
0
from pyA10Lime.gpio import connector
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"""
from pyA10Lime.gpio import gpio
from pyA10Lime.gpio import connector
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:
Exemplo n.º 6
0
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):