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

gpio_net_output.py
 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)
Control GPIO Net's Output
 ~  lager gpio output BTN 1 --dut 1
 ~  lager gpio output BTN 0 --dut 1

Input

gpio_net_input.py
 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()}")
Read GPIO Net's Input
 ~  lager gpio input BTN --dut 1
 0
 ~