From 02760d3b6096ab5afb1a2cfb746fcb5540ccd4c5 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 16 Jun 2017 12:08:50 +0200 Subject: dali: Convert to PD API version 3. --- decoders/dali/pd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'decoders') 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. -- cgit v1.2.3-70-g09d2