Net
- class Nets.Net
Container for all Net Types
- classmethod get(name, type, *, setup_function=None, teardown_function=None)
Instantiate a physical net in code
from lager import Net, NetType v33_net = Net.get('+3.3V', type=NetType.Analog, setup_function=setup_net, teardown_function=teardown_net)
- Parameters:
name (str) -- Name of net being instantiated
type (NetType) -- The type of net being created
setup_function (function) -- Callback that gets called when net is enabled, takes two parameters, net and device
teardown_function (function) -- Callback that gets called when net is disabled, takes two parameters, net and device
- Returns:
Net object
- Return type:
- classmethod list_all()
List all available nets.
from lager import Net, NetType nets = Net.list_all() print(nets)
- Returns:
Net object
- Return type:
str array
- enable()
Connect net to oscilloscope.
from lager import Net, NetType v33_net = Net.get('+3.3V', type=NetType.Analog, setup_function=setup_3v3, teardown_function=teardown_ch) v33_net.enable() def setup_3v3(net, device): print('setup 3.3V Channel')
- disable(teardown=True)
Disconnect net from oscilloscope.
from lager Net, NetType v33_net = Net.get('+3.3V', type=NetType.Analog, setup_function=setup_3v3, teardown_function=teardown_ch) v33_net.enable() v33_net.disable(teardown=True) def teardown_ch(net, device): print('teardown channel')
- Parameters:
teardown (bool) -- If true call the given Net's teardown function
- class Nets.NetType(enum)
Possible Net Types
- Analog
Nets that can be inspected with an oscilloscope
v33_net = Net.get('+3.3V', type=NetType.Analog, setup_function=None, teardown_function=None)
- Logic
Nets that can be inspected with a logic analyzer
i2c_sda_net = Net.get('I2C.SDA', type=NetType.Logic, setup_function=None, teardown_function=None)
- Battery
Nets that can be controlled by a battery voltage
lipo = Net.get('lipo', type=NetType.Battery, setup_function=None, teardown_function=None)
- PowerSupply
Nets that can be controlled by a voltage or current source.
v24 = Net.get('V24+', type=NetType.PowerSupply, setup_function=None, teardown_function=None)
- GPIO
Nets that can be controlled by a GPIO signal or can read a GPIO signal
user_button = Net.get('BUTTON', type=NetType.GPIO, setup_function=None, teardown_function=None)
- ELoad
Nets that can accept an electronic load
resistive_heater = Net.get('Heater', type=NetType.ELoad, setup_function=None, teardown_function=None)