Io Controller Module
This module implements the functionality to control I/O channels.
- class mtf.network_port.io_controller.IoController
This class implements a singleton I/O controller to be used in the entire system.
- __init__()
Creates a new instance.
- Returns:
IoController: The newly created instance.
- set_io_value(channel_name: str, value: float)
Sets io value.
- Args:
channel_name (str): The IO channel name. value (float): IO value to be set.
- Returns:
bool: True if IO value is set; otherwise False .
- set_io_raw_value(channel_name: str, value: float)
Sets the I/O value of the given channel.
- Args:
channel_name (str): The I/O channel to set. value (float): The raw value to set.
- Returns:
bool: True on success; otherwise False .
- io_apply_faulty(channel_name: str, fault_type: int | IoFaultyTypes)
Applies a faulty value or type to the given I/O channel.
- Args:
channel_name (str): The I/O channel to manipulate. fault_type (Union[int, IoFaultyTypes]): The fault type to apply.
- Returns:
bool: True on success; otherwise False.
Note:
..note:
``fault_type`` codes: - 0 or ShortCutToGnd : shortcut to oGND. - 1 or ShortcutToVbat: shortcut to battery (BAT). - 2 or CableBreak: simulate a cable break.
- io_stop_faulty(channel_name: str, fault_type: int | IoFaultyTypes)
Remove a faulty value or type to the given I/O channel.
- Args:
channel_name (str): The I/O channel to manipulate. fault_type (Union[int, IoFaultyTypes]): The fault type to apply.
- Returns:
bool: True on success; otherwise False.
Note:
..note:
``fault_type`` codes:: - 0 or ShortCutToGnd : shortcut to GND. - 1 or ShortcutToVbat: shortcut to battery (BAT). - 2 or CableBreak: simulate a cable break.
- io_set_current(channel_name: str, value: float)
Sets the current value for the given I/O channel.
- Args:
channel_name (str): The I/O channel to modify. value (float): The current value (in Ampere) to set.
- Returns:
bool: True if IO current is set, otherwise False.
- io_set_resistance(channel_name: str, value: int)
Sets the resistance of the given I/O channel.
- Args:
channel_name (str): The I/O channel to modify. value (float): The resistance value (in Ohm) to set.
- Returns:
bool: True if IO resistance is set, otherwise False.
- io_set_voltage(channel_name: str, value: float)
Sets the voltage of the given I/O channel.
- Args:
channel_name (str): The I/O channel to modify. value (float): The voltage (in Volt) to set.
- Returns:
bool: True if the value is set, otherwise False.
- io_generate_pattern(channel_name: str, value: list)
Sets a pattern for the given I/O channel.
- Args:
channel_name (str): The I/O channel to modify. value (list): The list of values generating the desired pattern.
- Returns:
bool: True if the pattern is generated; otherwise False.
- is_channel_available(channel_name: str)
Checks for physical connection of the given I/O channel.
- Args:
channel_name (str): The I/O channel to be checked.
- Returns:
bool: True if channel name is available; otherwise False.
- io_get_last_value(channel_name: str, property_name: IoProperty)
Gets the latest value of the given I/O channel property.
- Args:
channel_name (str): The I/O channel to be checked. property_name (str): The property to be checked.
- Returns:
float: The last received value of the given property.
- io_read_current(channel_name: str)
Gets the current value of the given I/O channel.
- Args:
channel_name (str): The I/O channel to read from.
- Returns:
float: The current value (in Ampere).
- io_read_voltage(channel_name: str)
Gets the voltage of the given I/O channel.
- Args:
channel_name (str): The I/O channel to read from.
- Returns:
float: The voltage value (in Volt).
- io_current_generate_pattern_configure_timing(channel_name: str, current: list, ramp_timing: list, dwell_timing: list, repetition)
Generates an io pattern for a specific channel current, ramp, and dwell timing..
- === Arguments Description ===
channel_name (str): Hardware channel name.
current (list): list of current value in ma
ramp_timing (list): ramp duration in ms.
dwell_timing (list): dwell duration in ms.
repetition (int): repetition.
- === Returns ===
bool: True if the io_current is well set; otherwise, False.
- io_pwm_generate_pattern_with_enable_timing(channel_name: str, enable: bool, ontime: float, offtime: float)
Generates an io pattern for a specific channel with on/off timing.
- === Arguments Description ===
channel_name (str): Hardware channel name.
enable (bool): True if the activity is on else False
ontime (float): The duration that the signal is activated (ON) in milliseconds (ms).
offtime (float): The duration that the signal is deactivated (OFF) in milliseconds (ms).
- === Returns ===
bool: True if the io_pwm is well set; otherwise, False.