from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from ....Internal.RepeatedCapability import RepeatedCapability
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class ThresholdCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
Repeated Capability Setting:
.. code-block:: python
# Range: Nr1 .. Nr4 \n
driver.bus.parallel.threshold.repcap_busThreshold_set(repcap.BusThreshold.Nr1)
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("threshold", core, parent)
self._cmd_group.rep_cap = RepeatedCapability(self._cmd_group.group_name, 'repcap_busThreshold_get', 'repcap_busThreshold_set', repcap.BusThreshold.Nr1)
def repcap_busThreshold_set(self, busThreshold: repcap.BusThreshold) -> None:
"""
Repeated Capability default value numeric suffix.
This value is used, if you do not explicitely set it in the child set/get methods, or if you leave it to BusThreshold.Default.
Default value after init: BusThreshold.Nr1
"""
self._cmd_group.set_repcap_enum_value(busThreshold)
def repcap_busThreshold_get(self) -> repcap.BusThreshold:
"""
Returns the current default repeated capability for the child set/get methods.
"""
# noinspection PyTypeChecker
return self._cmd_group.get_repcap_enum_value()
[docs]
def set(self, threshold: float, bus=repcap.Bus.Default, busThreshold=repcap.BusThreshold.Default) -> None:
"""
``BUS<*>:PARallel:THReshold<*>`` \n
Snippet: ``driver.bus.parallel.threshold.set(threshold = 1.0, bus = repcap.Bus.Default, busThreshold = repcap.BusThreshold.Default)`` \n
Sets the logical threshold for the indicated channel group. Alternatively, you can set the threshold with method
``RsRtx.bus.parallel.technology.set()`` . For the parallel bus 1, you can also use method
``RsRtx.digital.threshold.set()`` . See also: method ``RsRtx.digital.thCoupling.set()``
:param threshold: -8.0 to 8.0
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:param busThreshold: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Threshold')
"""
param = Conversions.decimal_value_to_str(threshold)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
busThreshold_cmd_val = self._cmd_group.get_repcap_cmd_value(busThreshold, repcap.BusThreshold)
self._core.io.write(f'BUS{bus_cmd_val}:PARallel:THReshold{busThreshold_cmd_val} {param}')
[docs]
def get(self, bus=repcap.Bus.Default, busThreshold=repcap.BusThreshold.Default) -> float:
"""
``BUS<*>:PARallel:THReshold<*>`` \n
Snippet: ``value: float = driver.bus.parallel.threshold.get(bus = repcap.Bus.Default, busThreshold = repcap.BusThreshold.Default)`` \n
Sets the logical threshold for the indicated channel group. Alternatively, you can set the threshold with method
``RsRtx.bus.parallel.technology.set()`` . For the parallel bus 1, you can also use method
``RsRtx.digital.threshold.set()`` . See also: method ``RsRtx.digital.thCoupling.set()``
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:param busThreshold: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Threshold')
:return: threshold: -8.0 to 8.0
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
busThreshold_cmd_val = self._cmd_group.get_repcap_cmd_value(busThreshold, repcap.BusThreshold)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:PARallel:THReshold{busThreshold_cmd_val}?')
return Conversions.str_to_float(response)
def clone(self) -> 'ThresholdCls':
"""
Clones the group by creating new object from it and its whole existing subgroups.
Also copies all the existing default Repeated Capabilities setting,
which you can change independently without affecting the original group.
"""
new_group = ThresholdCls(self._core, self._cmd_group.parent)
self._cmd_group.synchronize_repcaps(new_group)
return new_group