Source code for rsrtx.Implementations.Bus.Parallel.State

from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import repcap


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class StateCls:
	"""
	| Commands in total: 1
	| Subgroups: 0
	| Direct child commands: 1
	"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("state", core, parent)

[docs] def set(self, enable: bool, bus=repcap.Bus.Default) -> None: """ ``BUS<*>:PARallel:STATe`` \n Snippet: ``driver.bus.parallel.state.set(enable = False, bus = repcap.Bus.Default)`` \n Enables or disables the indicated parallel bus. The threshold settings of the bus take effect for all active parallel buses. Dependencies: At least one digital channel must be enabled for the selected bus, otherwise the command does not work. The bus is enabled automatically if the first digital channel is enabled with method ``RsRtx.bus.parallel.bit.state.set()`` or method ``RsRtx.digital.display.set()`` . :param enable: OFF | ON :param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus') """ param = Conversions.bool_to_str(enable) bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus) self._core.io.write(f'BUS{bus_cmd_val}:PARallel:STATe {param}')
[docs] def get(self, bus=repcap.Bus.Default) -> bool: """ ``BUS<*>:PARallel:STATe`` \n Snippet: ``value: bool = driver.bus.parallel.state.get(bus = repcap.Bus.Default)`` \n Enables or disables the indicated parallel bus. The threshold settings of the bus take effect for all active parallel buses. Dependencies: At least one digital channel must be enabled for the selected bus, otherwise the command does not work. The bus is enabled automatically if the first digital channel is enabled with method ``RsRtx.bus.parallel.bit.state.set()`` or method ``RsRtx.digital.display.set()`` . :param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus') :return: enable: OFF | ON """ bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus) response = self._core.io.query_str(f'BUS{bus_cmd_val}:PARallel:STATe?') return Conversions.str_to_bool(response)