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 RwbItCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("rwbIt", core, parent)
[docs]
def set(self, bus_config: enums.BusConfig, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:I2C:RWBit`` \n
Snippet: ``driver.bus.i2C.rwbIt.set(bus_config = enums.BusConfig.INADdress, bus = repcap.Bus.Default)`` \n
Defines if the R/W bit of a 7-bit address is considered separately or as part of the address. 10-bit addresses are not
affected. The setting defines which address lengths are available with method ``RsRtx.trigger.i2C.amode.set()`` .
:param bus_config: SEParate | INADdress \n
- SEParate: 7-bit address and separate R/W bit.
- INADdress: 8-bit address with R/W bit included.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(bus_config, enums.BusConfig)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:I2C:RWBit {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusConfig:
"""
``BUS<*>:I2C:RWBit`` \n
Snippet: ``value: enums.BusConfig = driver.bus.i2C.rwbIt.get(bus = repcap.Bus.Default)`` \n
Defines if the R/W bit of a 7-bit address is considered separately or as part of the address. 10-bit addresses are not
affected. The setting defines which address lengths are available with method ``RsRtx.trigger.i2C.amode.set()`` .
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: bus_config: SEParate | INADdress \n
- SEParate: 7-bit address and separate R/W bit.
- INADdress: 8-bit address with R/W bit included.
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:I2C:RWBit?')
return Conversions.str_to_scalar_enum(response, enums.BusConfig)