From: BenediktO Date: Wed, 25 Mar 2020 13:05:13 +0000 (+0100) Subject: lpc: improve performance, use proper .wait() condition X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=190b74dda8456108b97ec70bcccfea29aaf797ad;p=libsigrokdecode.git lpc: improve performance, use proper .wait() condition Use a proper .wait() condition to have edges detected in common code, and avoid the many transitions between C and Python. This dramatically increases performance of the LPC protocol decoder. [ gsi: rephrased and reflowed the commit message ] --- diff --git a/decoders/lpc/pd.py b/decoders/lpc/pd.py index cf1707f..2a88e30 100644 --- a/decoders/lpc/pd.py +++ b/decoders/lpc/pd.py @@ -315,13 +315,9 @@ class Decoder(srd.Decoder): self.state = 'IDLE' def decode(self): + conditions = [{i: 'e'} for i in range(6)] while True: - # TODO: Come up with more appropriate self.wait() conditions. - pins = self.wait() - - # If none of the pins changed, there's nothing to do. - if self.oldpins == pins: - continue + pins = self.wait(conditions) # Store current pin values for the next round. self.oldpins = pins