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 ErrcCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("errc", core, parent)
[docs]
def set(self, usb_err_cond_typ: enums.BusUsbErrorCondition, trigger=repcap.Trigger.Default) -> None:
"""
``TRIGger<*>:USB:ERRC`` \n
Snippet: ``driver.trigger.usb.errc.set(usb_err_cond_typ = enums.BusUsbErrorCondition.ANY, trigger = repcap.Trigger.Default)`` \n
Sets the trigger to an error condition type.
:param usb_err_cond_typ: ANY | PIDerror | CRC5error | CRC16error | BTST | UNEXpid | SE1error | GLITcherr \n
- ANY: Triggers on any of the errors listed below.
- PIDerror: Triggers on any packet identifier error.
- CRC5error: Triggers on any CRC5 error event.
- CRC16error: Triggers on any CRC16 error event.
- BTST: Triggers on any bitstuffing error event (erroneous or missing bit stuffing sequence, see USB standard) .
- UNEXpid: Triggers on any unexpected PID error (illegal PID, that is not allowed in USB low speed and USB full speed protocols, especially PID's announcing packets such as SPLIT, DATA2, MDATA, or other noncompliant packets) .
- SE1error: Triggers on the illegal bus state Single Ended 1 (SE1 = both lines high) .
- GLITcherr: Triggers on any glitching error (illegal bit period, see USB standard for the definition of glitching) .
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
"""
param = Conversions.enum_scalar_to_str(usb_err_cond_typ, enums.BusUsbErrorCondition)
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
self._core.io.write(f'TRIGger{trigger_cmd_val}:USB:ERRC {param}')
# noinspection PyTypeChecker
[docs]
def get(self, trigger=repcap.Trigger.Default) -> enums.BusUsbErrorCondition:
"""
``TRIGger<*>:USB:ERRC`` \n
Snippet: ``value: enums.BusUsbErrorCondition = driver.trigger.usb.errc.get(trigger = repcap.Trigger.Default)`` \n
Sets the trigger to an error condition type.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
"""
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:ERRC?')
return Conversions.str_to_scalar_enum(response, enums.BusUsbErrorCondition)