]> sigrok.org Git - libsigrokdecode.git/commitdiff
timing: Convert to PD API version 3.
authorUwe Hermann <redacted>
Fri, 26 Aug 2016 13:21:03 +0000 (15:21 +0200)
committerUwe Hermann <redacted>
Wed, 7 Dec 2016 21:45:47 +0000 (22:45 +0100)
decoders/timing/pd.py

index 98677b9f20d0e7d3529834fef808c8665b0bc8f9..64ba5666667999d6e9a0c5e150a0265206aaa6ad 100644 (file)
@@ -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