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 AmodeCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("amode", core, parent)
[docs]
def set(self, address_type: enums.AddressType, trigger=repcap.Trigger.Default) -> None:
"""
``TRIGger<*>:I2C:AMODe`` \n
Snippet: ``driver.trigger.i2C.amode.set(address_type = enums.AddressType.ANY, trigger = repcap.Trigger.Default)`` \n
Sets the address length. The setting affects the address input with method ``RsRtx.trigger.i2C.address.set()`` and method
``RsRtx.trigger.i2C.addTo.set()`` .
:param address_type: BIT7 | BIT7_RW | BIT10 | ANY \n
- BIT7: Enter the 7 address bits. Only available if BUSb:I2C:RWBit is set.
- BIT7_RW: Enter 7 address bits and the R/W bit. Only available if BUSb:I2C:RWBit is set.
- BIT10: 10-bit address
- ANY: Only available for trigger type Address + data (TRIGgert:I2C:TYPE) . Used to trigger on data only, regardless of the address.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
"""
param = Conversions.enum_scalar_to_str(address_type, enums.AddressType)
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
self._core.io.write_with_opc(f'TRIGger{trigger_cmd_val}:I2C:AMODe {param}')
# noinspection PyTypeChecker
[docs]
def get(self, trigger=repcap.Trigger.Default) -> enums.AddressType:
"""
``TRIGger<*>:I2C:AMODe`` \n
Snippet: ``value: enums.AddressType = driver.trigger.i2C.amode.get(trigger = repcap.Trigger.Default)`` \n
Sets the address length. The setting affects the address input with method ``RsRtx.trigger.i2C.address.set()`` and method
``RsRtx.trigger.i2C.addTo.set()`` .
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
:return: address_type: BIT7 | BIT7_RW | BIT10 | ANY \n
- BIT7: Enter the 7 address bits. Only available if BUSb:I2C:RWBit is set.
- BIT7_RW: Enter 7 address bits and the R/W bit. Only available if BUSb:I2C:RWBit is set.
- BIT10: 10-bit address
- ANY: Only available for trigger type Address + data (TRIGgert:I2C:TYPE) . Used to trigger on data only, regardless of the address.
"""
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}:I2C:AMODe?')
return Conversions.str_to_scalar_enum(response, enums.AddressType)