Source code for rsrtx.Implementations.Bus.Usb.Packet.Pid

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 PidCls:
	"""
	| Commands in total: 1
	| Subgroups: 0
	| Direct child commands: 1
	"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("pid", core, parent)

	# noinspection PyTypeChecker
[docs] def get(self, bus=repcap.Bus.Default, busUsbPacket=repcap.BusUsbPacket.Default) -> enums.BusUsbPid: """ ``BUS<*>:USB:PACKet<*>:PID`` \n Snippet: ``value: enums.BusUsbPid = driver.bus.usb.packet.pid.get(bus = repcap.Bus.Default, busUsbPacket = repcap.BusUsbPacket.Default)`` \n Returns the packet PID for the selected serial bus and packet number. :param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus') :param busUsbPacket: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Packet') :return: pid: RES | OUT | ACK | DATA0 | DATa0 | PING | SOF | NYET | DATA2 | DATa2 | SPLIT | SPLit | IN | NAK | DATA1 | DATa1 | PRE | SETUP | SETup | STALL | STALl | MDATA | MDATa | UNK \n - RES: RES = Reserved - OUT: OUT Token PID - IN: IN Token PID - SOF: Start Of Frame PID - SETUP = SETup: SETUP PID - DATA0 = DATa0: DATA0 PID, even PID - DATA1 = DATa1: DATA1 PID, odd PID - DATA2 = DATa2: DATA2 PID (only valid in USB high speed and USB HSIC protocols) - MDATA = MDATa: MDATA PID (only valid in USB high speed and USB HSIC protocols) - ACK: ACKnowledgment PID - NAK: Non-AcKnowledgment PID - STALL = STALl: STALL PID - NYET: Not ready YET (only valid in USB high speed and USB HSIC protocols) - PRE: PREamble PID (only valid in USB high speed and USB HSIC protocols) - SPLIT = SPLit: SPLIT PID (only valid in USB high speed and USB HSIC protocols) - PING: PING PID (only valid in USB high speed and USB HSIC protocols) - UNK: UNK = Unknown PID """ bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus) busUsbPacket_cmd_val = self._cmd_group.get_repcap_cmd_value(busUsbPacket, repcap.BusUsbPacket) response = self._core.io.query_str(f'BUS{bus_cmd_val}:USB:PACKet{busUsbPacket_cmd_val}:PID?') return Conversions.str_to_scalar_enum(response, enums.BusUsbPid)