From: Uwe Hermann Date: Fri, 16 Jun 2017 10:08:50 +0000 (+0200) Subject: dali: Convert to PD API version 3. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=02760d3b6096ab5afb1a2cfb746fcb5540ccd4c5;p=libsigrokdecode.git dali: Convert to PD API version 3. --- diff --git a/decoders/dali/pd.py b/decoders/dali/pd.py index f45306a..51d8284 100644 --- a/decoders/dali/pd.py +++ b/decoders/dali/pd.py @@ -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.