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 SpecCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("spec", core, parent)
[docs]
def set(self, usb_special_type: enums.BusUsbSpecialType, trigger=repcap.Trigger.Default) -> None:
"""
``TRIGger<*>:USB:SPEC`` \n
Snippet: ``driver.trigger.usb.spec.set(usb_special_type = enums.BusUsbSpecialType.ANY, trigger = repcap.Trigger.Default)`` \n
Sets the trigger to one out of four different Special PID types: PREamble, ERR, SPLit, or PING.
:param usb_special_type: PREamble | ERR | SPLit | PING \n
- PREamble: Sets the trigger to the PREamble PID
- ERR: Sets the trigger to the ERRor PID
- SPLit: Sets the trigger to the SPLIT PID (in USB high speed transactions)
- PING: Sets the trigger to the PING PID (in USB high speed transactions, flow control probe for a bulk/control endpoint)
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
"""
param = Conversions.enum_scalar_to_str(usb_special_type, enums.BusUsbSpecialType)
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
self._core.io.write(f'TRIGger{trigger_cmd_val}:USB:SPEC {param}')
# noinspection PyTypeChecker
[docs]
def get(self, trigger=repcap.Trigger.Default) -> enums.BusUsbSpecialType:
"""
``TRIGger<*>:USB:SPEC`` \n
Snippet: ``value: enums.BusUsbSpecialType = driver.trigger.usb.spec.get(trigger = repcap.Trigger.Default)`` \n
Sets the trigger to one out of four different Special PID types: PREamble, ERR, SPLit, or PING.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
:return: usb_special_type: PREamble | ERR | SPLit | PING \n
- PREamble: Sets the trigger to the PREamble PID
- ERR: Sets the trigger to the ERRor PID
- SPLit: Sets the trigger to the SPLIT PID (in USB high speed transactions)
- PING: Sets the trigger to the PING PID (in USB high speed transactions, flow control probe for a bulk/control endpoint)
"""
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:SPEC?')
return Conversions.str_to_scalar_enum(response, enums.BusUsbSpecialType)