from .....Internal.Core import Core
from .....Internal.CommandsGroup import CommandsGroup
from .....Internal import Conversions
from ..... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class T2SegmentCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("t2Segment", core, parent)
[docs]
def set(self, flex_dat_time_seg_2: float, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:CAN:FDATa:T2Segment`` \n
Snippet: ``driver.bus.can.fdata.t2Segment.set(flex_dat_time_seg_2 = 1.0, bus = repcap.Bus.Default)`` \n
Sets the number of time quanta after the sample point (T2Segment) . T2Segment matches Phase_seg2 specified in the CAN
standard. Make sure to set also method ``RsRtx.bus.can.t1Segment.set()`` for correct definition of the sample point.
Alternatively, you can use method ``RsRtx.bus.can.samplePoint.set()`` . See also: 'Advanced settings' For CAN FD signals,
method ``RsRtx.bus.can.t2Segment.set()`` defines the synchronization of the arbitration phase, and method
``RsRtx.bus.can.fdata.t2Segment.set()`` defines the synchronization of the data phase.
:param flex_dat_time_seg_2: Time quanta
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.decimal_value_to_str(flex_dat_time_seg_2)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:CAN:FDATa:T2Segment {param}')
[docs]
def get(self, bus=repcap.Bus.Default) -> float:
"""
``BUS<*>:CAN:FDATa:T2Segment`` \n
Snippet: ``value: float = driver.bus.can.fdata.t2Segment.get(bus = repcap.Bus.Default)`` \n
Sets the number of time quanta after the sample point (T2Segment) . T2Segment matches Phase_seg2 specified in the CAN
standard. Make sure to set also method ``RsRtx.bus.can.t1Segment.set()`` for correct definition of the sample point.
Alternatively, you can use method ``RsRtx.bus.can.samplePoint.set()`` . See also: 'Advanced settings' For CAN FD signals,
method ``RsRtx.bus.can.t2Segment.set()`` defines the synchronization of the arbitration phase, and method
``RsRtx.bus.can.fdata.t2Segment.set()`` defines the synchronization of the data phase.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:CAN:FDATa:T2Segment?')
return Conversions.str_to_float(response)