]> sigrok.org Git - libsigrokdecode.git/commitdiff
dali: Convert to PD API version 3.
authorUwe Hermann <redacted>
Fri, 16 Jun 2017 10:08:50 +0000 (12:08 +0200)
committerUwe Hermann <redacted>
Fri, 16 Jun 2017 10:48:39 +0000 (12:48 +0200)
decoders/dali/pd.py

index f45306a9ab55746853ccff131f9fb5c2d0699756..51d82842fcffe3040593e086c27aa5c0b935052a 100644 (file)
@@ -24,7 +24,7 @@ class SamplerateError(Exception):
     pass
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id = 'dali'
     name = 'DALI'
     longname = 'Digital Addressable Lighting Interface'
@@ -196,12 +196,13 @@ class Decoder(srd.Decoder):
         self.edges, self.bits, self.ss_es_bits = [], [], []
         self.state = 'IDLE'
 
-    def decode(self, ss, es, data):
+    def decode(self):
         if not self.samplerate:
             raise SamplerateError('Cannot decode without samplerate.')
         bit = 0
-        for (self.samplenum, pins) in data:
-            self.dali = pins[0]
+        while True:
+            # TODO: Come up with more appropriate self.wait() conditions.
+            (self.dali,) = self.wait({'skip': 1})
             if self.options['polarity'] == 'active-high':
                 self.dali ^= 1 # Invert.