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 FrConditionCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("frCondition", core, parent)
[docs]
def set(self, frame_condition: enums.BusFrameCondition, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:SPI:FRCondition`` \n
Snippet: ``driver.bus.spi.frCondition.set(frame_condition = enums.BusFrameCondition.CLKTimeout, bus = repcap.Bus.Default)`` \n
Defines the start of a frame. A frame contains a number of successive words, at least one word.
:param frame_condition: SS | CLKTimeout \n
- SS: Start and end of the frame is defined by the active state of the slave select signal, see BUSb:SPI:SSELect:POLarity.
- CLKTimeout: Defines a timeout on the clock line SCLK as limiter between two frames. The timeout condition is used for SPI connections without an SS line.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(frame_condition, enums.BusFrameCondition)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:SPI:FRCondition {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusFrameCondition:
"""
``BUS<*>:SPI:FRCondition`` \n
Snippet: ``value: enums.BusFrameCondition = driver.bus.spi.frCondition.get(bus = repcap.Bus.Default)`` \n
Defines the start of a frame. A frame contains a number of successive words, at least one word.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: frame_condition: SS | CLKTimeout \n
- SS: Start and end of the frame is defined by the active state of the slave select signal, see BUSb:SPI:SSELect:POLarity.
- CLKTimeout: Defines a timeout on the clock line SCLK as limiter between two frames. The timeout condition is used for SPI connections without an SS line.
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:SPI:FRCondition?')
return Conversions.str_to_scalar_enum(response, enums.BusFrameCondition)