Source code for rsrtx.Implementations.Trigger.Usb.Data

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 DataCls:
	"""
	| Commands in total: 1
	| Subgroups: 0
	| Direct child commands: 1
	"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("data", core, parent)

[docs] def set(self, usb_data_type: enums.BusUsbDataType, trigger=repcap.Trigger.Default) -> None: """ ``TRIGger<*>:USB:DATA`` \n Snippet: ``driver.trigger.usb.data.set(usb_data_type = enums.BusUsbDataType.ANY, trigger = repcap.Trigger.Default)`` \n Sets the trigger to one out of four different payload data types: DATA0, DATA1, DATA2, or MDATA. :param usb_data_type: D0 | D1 | D2 | MD \n - D0: Sets the trigger to the DATA0 field (even PID) . - D1: Sets the trigger to the DATA1 field (odd PID) . - D2: Sets the trigger to the DATA2 field (data packet PID for high-speed, high bandwidth isochronous transaction in a microframe) . - MD: Sets the trigger to the MDATA field (high-speed data packet PID for split and high bandwidth isochronous transactions) . :param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger') """ param = Conversions.enum_scalar_to_str(usb_data_type, enums.BusUsbDataType) trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger) self._core.io.write(f'TRIGger{trigger_cmd_val}:USB:DATA {param}')
# noinspection PyTypeChecker
[docs] def get(self, trigger=repcap.Trigger.Default) -> enums.BusUsbDataType: """ ``TRIGger<*>:USB:DATA`` \n Snippet: ``value: enums.BusUsbDataType = driver.trigger.usb.data.get(trigger = repcap.Trigger.Default)`` \n Sets the trigger to one out of four different payload data types: DATA0, DATA1, DATA2, or MDATA. :param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger') :return: usb_data_type: D0 | D1 | D2 | MD \n - D0: Sets the trigger to the DATA0 field (even PID) . - D1: Sets the trigger to the DATA1 field (odd PID) . - D2: Sets the trigger to the DATA2 field (data packet PID for high-speed, high bandwidth isochronous transaction in a microframe) . - MD: Sets the trigger to the MDATA field (high-speed data packet PID for split and high bandwidth isochronous transactions) . """ trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger) response = self._core.io.query_str(f'TRIGger{trigger_cmd_val}:USB:DATA?') return Conversions.str_to_scalar_enum(response, enums.BusUsbDataType)