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 CpolarityCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("cpolarity", core, parent)
[docs]
def set(self, cpol_mode: enums.BusPolarityMode, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:CMSB:NRZ:CPOLarity`` \n
Snippet: ``driver.bus.cmsb.nrz.cpolarity.set(cpol_mode = enums.BusPolarityMode.IDLHigh, bus = repcap.Bus.Default)`` \n
Selects the polarity of the clock signal for the coding standard NRZ Clocked.
:param cpol_mode: IDLLow | IDLHigh \n
- IDLLow: Sets the base value of the clock to be '0', the clock signal starts with a low-to-high transition
- IDLHigh: Sets the base value of the clock to be '1', the clock signal starts with a high-to-low transition.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(cpol_mode, enums.BusPolarityMode)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:CMSB:NRZ:CPOLarity {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusPolarityMode:
"""
``BUS<*>:CMSB:NRZ:CPOLarity`` \n
Snippet: ``value: enums.BusPolarityMode = driver.bus.cmsb.nrz.cpolarity.get(bus = repcap.Bus.Default)`` \n
Selects the polarity of the clock signal for the coding standard NRZ Clocked.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: cpol_mode: IDLLow | IDLHigh \n
- IDLLow: Sets the base value of the clock to be '0', the clock signal starts with a low-to-high transition
- IDLHigh: Sets the base value of the clock to be '1', the clock signal starts with a high-to-low transition.
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:CMSB:NRZ:CPOLarity?')
return Conversions.str_to_scalar_enum(response, enums.BusPolarityMode)