diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2017-06-16 16:13:19 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-06-16 16:13:19 +0200 |
commit | 7a85bbbe3391fc245014d03d5415048239c2e591 (patch) | |
tree | 0891ddf000305775c4c2807f9ae88fef33401476 | |
parent | a46b6ad55225c4e3fbd67b709382cb0799d86e45 (diff) | |
download | libsigrokdecode-7a85bbbe3391fc245014d03d5415048239c2e591.tar.gz libsigrokdecode-7a85bbbe3391fc245014d03d5415048239c2e591.zip |
rgb_led_ws281x: Convert to PD API version 3.
-rw-r--r-- | decoders/rgb_led_ws281x/pd.py | 9 |
1 files changed, 6 insertions, 3 deletions
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 |