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, nrz_pola_dat: enums.BusSpiI2cDataPolarity, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:CMSB:NRZ:POLarity`` \n
Snippet: ``driver.bus.cmsb.nrz.polarity.set(nrz_pola_dat = enums.BusSpiI2cDataPolarity.ACTHigh, bus = repcap.Bus.Default)`` \n
Selects the polarity of the custom serial bus data signal in NRZ coding standards.
:param nrz_pola_dat: ACTLow | ACTHigh \n
- ACTLow: Active low: the value '1' is represented by a voltage below the threshold
- ACTHigh: Active high: the value '1' is represented by a voltage above the threshold
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(nrz_pola_dat, enums.BusSpiI2cDataPolarity)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:CMSB:NRZ:POLarity {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusSpiI2cDataPolarity:
"""
``BUS<*>:CMSB:NRZ:POLarity`` \n
Snippet: ``value: enums.BusSpiI2cDataPolarity = driver.bus.cmsb.nrz.polarity.get(bus = repcap.Bus.Default)`` \n
Selects the polarity of the custom serial bus data signal in NRZ coding standards.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: nrz_pola_dat: ACTLow | ACTHigh \n
- ACTLow: Active low: the value '1' is represented by a voltage below the threshold
- ACTHigh: Active high: the value '1' is represented by a voltage above the threshold
"""
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:POLarity?')
return Conversions.str_to_scalar_enum(response, enums.BusSpiI2cDataPolarity)