]> sigrok.org Git - libsigrokdecode.git/commitdiff
rgb_led_ws281x: Convert to PD API version 3.
authorUwe Hermann <redacted>
Fri, 16 Jun 2017 14:13:19 +0000 (16:13 +0200)
committerUwe Hermann <redacted>
Fri, 16 Jun 2017 14:13:19 +0000 (16:13 +0200)
decoders/rgb_led_ws281x/pd.py

index 0cb6603fb81dd7eaa9b20969387784b95c2f5aef..ca352838bbb92ab13662f1ca48142b696adf380c 100644 (file)
@@ -24,7 +24,7 @@ class SamplerateError(Exception):
     pass
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id = 'rgb_led_ws281x'
     name = 'RGB LED (WS281x)'
     longname = 'RGB LED string decoder (WS281x)'
@@ -70,11 +70,14 @@ class Decoder(srd.Decoder):
             self.bits = []
             self.ss_packet = None
 
-    def decode(self, ss, es, data):
+    def decode(self):
         if not self.samplerate:
             raise SamplerateError('Cannot decode without samplerate.')
 
-        for (self.samplenum, (pin, )) in data:
+        while True:
+            # TODO: Come up with more appropriate self.wait() conditions.
+            (pin,) = self.wait({'skip': 1})
+
             if self.oldpin is None:
                 self.oldpin = pin
                 continue