def spi_cs0(level): ##ADC gpio.output(port.PG7, level)
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 = []
def spi_cs1(level): ##TC AMP gpio.output(port.PG8, level)
def configPin(pin, dir, state): gpio.setcfg(pin, dir) gpio.output(pin, state)
def outputLevel(name, level): for output in outputConfigs: if output['name'] == name: gpio.output(output['pin'], level) break
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.")
__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.")
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):
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.")
__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.")