GPIO

class Nets.GPIO

Class for controlling GPIO nets

set(self, mode)

Set GPIO Mode

from lager.pcb.net import Net, NetType

reset = Net.get('RESET',
            type=NetType.GPIO,
            setup_function=None,
            teardown_function=None)
reset.enable()
reset.set(GPIOMode.OUT)
Parameters:

mode (GPIOMode) -- Set mode of GPIO trace

output(self, level)

Set GPIO Output Level

from lager.pcb.net import Net, NetType

reset = Net.get('RESET',
            type=NetType.GPIO,
            setup_function=None,
            teardown_function=None)
reset.enable()
reset.set(GPIOMode.OUT)
reset.output(GPIOLevel.HIGH) # can use High/Low
reset.output(GPIOLevel.LOW)
reset.output(GPIOLevel.ON) # or On/Off
reset.output(GPIOLevel.OFF)
Parameters:

level (GPIOLevel) -- Set level for GPIO output nets

input(self)

Read GPIO level

from lager.pcb.net import Net, NetType

stat = Net.get('STAT',
            type=NetType.GPIO,
            setup_function=None,
            teardown_function=None)
stat.enable()
stat.set(GPIOMode.IN)
level = stat.input()
print(level)
Returns:

gpio level

Return type:

GPIOLevel

class Nets.GPIOMode(enum)

GPIO as input or as output

IN
OUT
class Nets.GPIOLevel(enum)
ON
OFF
HIGH
LOW