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 ConfigCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("config", core, parent)
[docs]
def set(self, configuration: enums.BusDphyConfig, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:DPHY:CONFig`` \n
Snippet: ``driver.bus.dphy.config.set(configuration = enums.BusDphyConfig.D1CL, bus = repcap.Bus.Default)`` \n
Sets the number of data lanes and if the clock lane and low power are available.
:param configuration: D1CN: 1 data lane, clock lane D1CL: 1 data lane, clock lane, low power D2CN: 2 data lanes, clock lane D2CL: 2 data lanes, clock lane, low power D3CN: 3 data lanes, clock lane D3NL: 3 data lanes, no clock, low power D4NN: 4 data lanes and no clock
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(configuration, enums.BusDphyConfig)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:DPHY:CONFig {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusDphyConfig:
"""
``BUS<*>:DPHY:CONFig`` \n
Snippet: ``value: enums.BusDphyConfig = driver.bus.dphy.config.get(bus = repcap.Bus.Default)`` \n
Sets the number of data lanes and if the clock lane and low power are available.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: configuration: D1CN: 1 data lane, clock lane D1CL: 1 data lane, clock lane, low power D2CN: 2 data lanes, clock lane D2CL: 2 data lanes, clock lane, low power D3CN: 3 data lanes, clock lane D3NL: 3 data lanes, no clock, low power D4NN: 4 data lanes and no clock
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:DPHY:CONFig?')
return Conversions.str_to_scalar_enum(response, enums.BusDphyConfig)