diff options
author | BenediktO <benedikt_o@web.de> | 2020-03-25 14:05:13 +0100 |
---|---|---|
committer | Gerhard Sittig <gerhard.sittig@gmx.net> | 2020-07-31 16:25:45 +0200 |
commit | 190b74dda8456108b97ec70bcccfea29aaf797ad (patch) | |
tree | e9d5aaa90cf396c8159234e3a81994f6e82a85b7 | |
parent | 575124cd9e4e059cfe5f12fd047d6e8fa922cfbb (diff) | |
download | libsigrokdecode-190b74dda8456108b97ec70bcccfea29aaf797ad.tar.gz libsigrokdecode-190b74dda8456108b97ec70bcccfea29aaf797ad.zip |
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 ]
-rw-r--r-- | decoders/lpc/pd.py | 8 |
1 files changed, 2 insertions, 6 deletions
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 |