From 10aeb8ea8b183394cebc0033f048f49f4262b57d Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Mon, 20 Feb 2017 21:37:05 +0100 Subject: all decoders: introduce a reset() method Move initialization code of protocol decoders from the constructor to a new reset() helper method. The libsigrokdecode backend could run this method several times to clear the decoder's internal state, before new data from another acquisition gets fed to decode() calls. --- decoders/usb_power_delivery/pd.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'decoders/usb_power_delivery') diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py index 3258ac3..a2d6b4d 100644 --- a/decoders/usb_power_delivery/pd.py +++ b/decoders/usb_power_delivery/pd.py @@ -439,6 +439,9 @@ class Decoder(srd.Decoder): return -1 # No Start Of Packet def __init__(self): + self.reset() + + def reset(self): self.samplerate = None self.idx = 0 self.packet_seq = 0 -- cgit v1.2.3-70-g09d2