summaryrefslogtreecommitdiff
path: root/decoders/usb_request/pd.py
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-02-20 21:37:05 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2017-12-22 12:21:54 +0100
commit10aeb8ea8b183394cebc0033f048f49f4262b57d (patch)
treef58f049342dd6fce239514ed5dfffdbc573e3ce1 /decoders/usb_request/pd.py
parentecb0b96d4a4d0021b41ffebec0df219338aa3724 (diff)
downloadlibsigrokdecode-10aeb8ea8b183394cebc0033f048f49f4262b57d.tar.gz
libsigrokdecode-10aeb8ea8b183394cebc0033f048f49f4262b57d.zip
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.
Diffstat (limited to 'decoders/usb_request/pd.py')
-rw-r--r--decoders/usb_request/pd.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/decoders/usb_request/pd.py b/decoders/usb_request/pd.py
index 1bd2878..a480284 100644
--- a/decoders/usb_request/pd.py
+++ b/decoders/usb_request/pd.py
@@ -136,6 +136,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.request = {}
self.request_id = 0