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 ModeCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("mode", core, parent)
[docs]
def set(self, trigger_mode: enums.TriggerMode, trigger=repcap.Trigger.Default) -> None:
"""
``TRIGger<*>:MODE`` \n
Snippet: ``driver.trigger.mode.set(trigger_mode = enums.TriggerMode.AUTO, trigger = repcap.Trigger.Default)`` \n
Sets the trigger mode which determines the behaviour of the instrument if no trigger occurs.
:param trigger_mode: AUTO | NORMal | FREerun \n
- AUTO: The instrument triggers repeatedly after a time interval if the trigger conditions are not fulfilled. If a real trigger occurs, it takes precedence. The time interval depends on the time base.
- NORMal: The instrument acquires a waveform only if a trigger occurs.
- FREerun: The instrument triggers after a very short time interval - faster than in AUTO mode. Real triggers are ignored.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
"""
param = Conversions.enum_scalar_to_str(trigger_mode, enums.TriggerMode)
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
self._core.io.write_with_opc(f'TRIGger{trigger_cmd_val}:MODE {param}')
# noinspection PyTypeChecker
[docs]
def get(self, trigger=repcap.Trigger.Default) -> enums.TriggerMode:
"""
``TRIGger<*>:MODE`` \n
Snippet: ``value: enums.TriggerMode = driver.trigger.mode.get(trigger = repcap.Trigger.Default)`` \n
Sets the trigger mode which determines the behaviour of the instrument if no trigger occurs.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
:return: trigger_mode: AUTO | NORMal | FREerun \n
- AUTO: The instrument triggers repeatedly after a time interval if the trigger conditions are not fulfilled. If a real trigger occurs, it takes precedence. The time interval depends on the time base.
- NORMal: The instrument acquires a waveform only if a trigger occurs.
- FREerun: The instrument triggers after a very short time interval - faster than in AUTO mode. Real triggers are ignored.
"""
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
response = self._core.io.query_str_with_opc(f'TRIGger{trigger_cmd_val}:MODE?')
return Conversions.str_to_scalar_enum(response, enums.TriggerMode)