from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import enums
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class PolarityCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("polarity", core, parent)
[docs]
def set(self, polarity: enums.BusPolarityMode, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:UART:POLarity`` \n
Snippet: ``driver.bus.uart.polarity.set(polarity = enums.BusPolarityMode.IDLHigh, bus = repcap.Bus.Default)`` \n
Defines the idle state of the bus. The idle state corresponds to a logic 1. The transmitted data on the bus is high (high
= 1) or low (low = 1) active.
:param polarity: IDLLow | IDLHigh
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(polarity, enums.BusPolarityMode)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write_with_opc(f'BUS{bus_cmd_val}:UART:POLarity {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusPolarityMode:
"""
``BUS<*>:UART:POLarity`` \n
Snippet: ``value: enums.BusPolarityMode = driver.bus.uart.polarity.get(bus = repcap.Bus.Default)`` \n
Defines the idle state of the bus. The idle state corresponds to a logic 1. The transmitted data on the bus is high (high
= 1) or low (low = 1) active.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: polarity: IDLLow | IDLHigh
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str_with_opc(f'BUS{bus_cmd_val}:UART:POLarity?')
return Conversions.str_to_scalar_enum(response, enums.BusPolarityMode)