GPIO
The GPIO module allows you to directly interact with your DUT. For example, maybe your board has a manual hard reset button, that you'd like the ability to press. With GPIO this is possible programmatically, you just need to make sure to assign a GPIO net during setup.
Output
import time
from lager import lager
from lager.pcb.net import Net, NetType
from lager.gpio import GPIO, GPIOLevel
button = Net.get('BTN',
type=NetType.GPIO,
setup_function=setup_nets,
teardown_function=teardown_nets)
button.output(GPIOLevel.HIGH)
time.sleep(1)
button.output(GPIOLevel.LOW)
~ lager gpio output BTN 1 --dut 1
~ lager gpio output BTN 0 --dut 1
Input
import time
from lager import lager
from lager.pcb.net import Net, NetType
from lager.gpio import GPIO, GPIOLevel
button = Net.get('BTN',
type=NetType.GPIO,
setup_function=setup_nets,
teardown_function=teardown_nets)
print(f"Button Value: {button.input()}")
~ lager gpio input BTN --dut 1
0
~