PDChannelLogger¶
- class brainstem.pd_channel_logger.BS_PD_Packet(channel=0, seconds=0, uSeconds=0, direction=0, sop=0, event=0, payload=[])[source]¶
- Python representation of BS_PD_Packet_t (C structure)
channel (uint8_t): Channel/Index
seconds (uint8_t): Seconds in device time since power on.
uSeconds (uint32_t): Micro Seconds in device time since power on.
- direction (enumeration): Direction of packet transmission relative to the device.
Invalid = 0
Transmit = 1
Receive = 2
Unknown = 3
- sop (enumeration): See bs_pd_packet.h for more details
SOP = 0
SOP’ = 1
SOP’’ = 2
Unknown = 3
- event (enumeration): See powerdeliveryLogEvent in aProtocolDefs.h
pdEventNone = 0
pdEventPacket = 1
pdEventConnect = 2
pdEventDisconnect = 3
pdEventCableResetReceived = 4
pdEventCableResetSent = 5
pdEventHardResetReceived = 6
pdEventHardResetSent = 7
pdEventMessageTransmitFailed = 8 // No GoodCRC received
pdEventMessageTransmitDiscarded = 9 // Incoming message detected so tx discarded
pdEventPDFunctionDisabled = 10 // PD Stack is giving up on PD Comms
pdEventVBUSEnabled = 11
pdEventVBUSDisabled = 12
pdEventVCONNEnabled = 13
pdEventVCONNDisabled = 14
pdEventRp1A5 = 15 // Used for Src Atomic Message Sequences
pdEventRp3A0 = 16 // Used for Src Atomic Message Sequences
pdEventBistEnter = 17
pdEventBistExit = 18
pdEventLast = 19 // Should always be last!!
payload (list): Raw PD Packet data
- class brainstem.pd_channel_logger.PDChannelLogger(module, index, buffer_length=1024)[source]¶
Manages BrainStem Power Delivery logging packets.
- Parameters:
module (Module) – : Reference to an existing BrainStem Module
index (unsigned byte) – Index/channel logging should be enabled for.
buffer_length (unsigned short) – Number of packets the class should queue before dropping.
- property buffer_length¶
Gets the buffer length
- Returns:
Buffer length of the associated object.
- Return type:
unsigned int
- getPacket()[source]¶
Attempts to takes a packet from the internal buffer.
- Returns:
Result object containing the requested value when the results error is set to NO_ERROR(0)
- getPackets(buffer_length=100)[source]¶
Attempts to take a multiple packets (up to a maximum) from the internal buffer.
- Returns:
Result object containing the requested value when the results error is set to NO_ERROR(0)
- property index¶
Gets the Index/Channel
- Returns:
Index/channel of the associated object.
- Return type:
unsigned byte