From: Uwe Hermann Date: Fri, 16 Jun 2017 14:13:19 +0000 (+0200) Subject: rgb_led_ws281x: Convert to PD API version 3. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7a85bbbe3391fc245014d03d5415048239c2e591;p=libsigrokdecode.git rgb_led_ws281x: Convert to PD API version 3. --- diff --git a/decoders/rgb_led_ws281x/pd.py b/decoders/rgb_led_ws281x/pd.py index 0cb6603..ca35283 100644 --- a/decoders/rgb_led_ws281x/pd.py +++ b/decoders/rgb_led_ws281x/pd.py @@ -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