Net === .. py:module:: Nets :noindex: .. py:class:: Net Container for all Net Types .. py:classmethod:: get(name, type, *, setup_function=None, teardown_function=None) Instantiate a physical net in code .. code-block:: python :emphasize-lines: 3 from lager import Net, NetType v33_net = Net.get('+3.3V', type=NetType.Analog, setup_function=setup_net, teardown_function=teardown_net) :param str name: Name of net being instantiated :param NetType type: The type of net being created :param function setup_function: Callback that gets called when net is enabled, takes two parameters, `net` and `device` :param function teardown_function: Callback that gets called when net is disabled, takes two parameters, `net` and `device` :return: Net object :rtype: Net .. py:classmethod:: list_all() List all available nets. .. code-block:: python :emphasize-lines: 3 from lager import Net, NetType nets = Net.list_all() print(nets) :return: Net object :rtype: str array .. py:method:: enable() Connect net to oscilloscope. .. code-block:: python :emphasize-lines: 7 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') .. py:method:: disable(teardown=True) Disconnect net from oscilloscope. .. code-block:: python :emphasize-lines: 8 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') :param bool teardown: If true call the given Net's teardown function .. py:class:: NetType(enum) Possible Net Types .. py:data:: Analog Nets that can be inspected with an oscilloscope .. code-block:: python :emphasize-lines: 2 v33_net = Net.get('+3.3V', type=NetType.Analog, setup_function=None, teardown_function=None) .. py:data:: Logic Nets that can be inspected with a logic analyzer .. code-block:: python :emphasize-lines: 2 i2c_sda_net = Net.get('I2C.SDA', type=NetType.Logic, setup_function=None, teardown_function=None) .. py:data:: Battery Nets that can be controlled by a battery voltage .. code-block:: python :emphasize-lines: 2 lipo = Net.get('lipo', type=NetType.Battery, setup_function=None, teardown_function=None) .. py:data:: PowerSupply Nets that can be controlled by a voltage or current source. .. code-block:: python :emphasize-lines: 2 v24 = Net.get('V24+', type=NetType.PowerSupply, setup_function=None, teardown_function=None) .. py:data:: GPIO Nets that can be controlled by a GPIO signal or can read a GPIO signal .. code-block:: python :emphasize-lines: 2 user_button = Net.get('BUTTON', type=NetType.GPIO, setup_function=None, teardown_function=None) .. py:data:: ELoad Nets that can accept an electronic load .. code-block:: python :emphasize-lines: 2 resistive_heater = Net.get('Heater', type=NetType.ELoad, setup_function=None, teardown_function=None)