Source code for rsmxo.Implementations.Sbus.Spi.FrCondition

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.SbusFrameCondition, serialBus=repcap.SerialBus.Default) -> None: """ ``SBUS<*>:SPI:FRCondition`` \n Snippet: ``driver.sbus.spi.frCondition.set(frame_condition = enums.SbusFrameCondition.CLKTimeout, serialBus = repcap.SerialBus.Default)`` \n Defines the start of a frame. A frame contains a number of successive words, at least one word. :param frame_condition: CS | CLKTimeout \n - CS: Start and end of the frame is defined by the active state of the sub select signal, see SBUSsb:SPI:CSELect:POLarity. - CLKTimeout: Defines a timeout on the clock line SCLK as limiter between two frames. The timeout condition is used for SPI connections without a CS line. :param serialBus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Sbus') """ param = Conversions.enum_scalar_to_str(frame_condition, enums.SbusFrameCondition) serialBus_cmd_val = self._cmd_group.get_repcap_cmd_value(serialBus, repcap.SerialBus) self._core.io.write(f'SBUS{serialBus_cmd_val}:SPI:FRCondition {param}')
# noinspection PyTypeChecker
[docs] def get(self, serialBus=repcap.SerialBus.Default) -> enums.SbusFrameCondition: """ ``SBUS<*>:SPI:FRCondition`` \n Snippet: ``value: enums.SbusFrameCondition = driver.sbus.spi.frCondition.get(serialBus = repcap.SerialBus.Default)`` \n Defines the start of a frame. A frame contains a number of successive words, at least one word. :param serialBus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Sbus') :return: frame_condition: CS | CLKTimeout \n - CS: Start and end of the frame is defined by the active state of the sub select signal, see SBUSsb:SPI:CSELect:POLarity. - CLKTimeout: Defines a timeout on the clock line SCLK as limiter between two frames. The timeout condition is used for SPI connections without a CS line. """ serialBus_cmd_val = self._cmd_group.get_repcap_cmd_value(serialBus, repcap.SerialBus) response = self._core.io.query_str(f'SBUS{serialBus_cmd_val}:SPI:FRCondition?') return Conversions.str_to_scalar_enum(response, enums.SbusFrameCondition)