From: Uwe Hermann Date: Fri, 26 Aug 2016 13:21:03 +0000 (+0200) Subject: timing: Convert to PD API version 3. X-Git-Tag: libsigrokdecode-0.5.0~100 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=831e976a72a74dfa71548091b4fa401713d74052;p=libsigrokdecode.git timing: Convert to PD API version 3. --- diff --git a/decoders/timing/pd.py b/decoders/timing/pd.py index 98677b9..64ba566 100644 --- a/decoders/timing/pd.py +++ b/decoders/timing/pd.py @@ -47,7 +47,7 @@ def normalize_time(t): return '%f' % t class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'timing' name = 'Timing' longname = 'Timing calculation with frequency and averaging' @@ -83,12 +83,14 @@ class Decoder(srd.Decoder): def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) + self.initial_pins = [0] - def decode(self, ss, es, data): + def decode(self): if not self.samplerate: raise SamplerateError('Cannot decode without samplerate.') + while True: + pin = self.wait({0: 'e'}) - for (self.samplenum, (pin,)) in data: if self.oldpin is None: self.oldpin = pin self.last_samplenum = self.samplenum