diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2018-08-11 22:59:47 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-08-30 11:56:34 +0200 |
commit | 547b79f4b936b35285aed6e3e051ff5d55ffc40a (patch) | |
tree | fc54a06c185d631f7e7f1ac224f0073ca668e01c | |
parent | 5dd2a4c0c2872be7dda3be9ea0ce087826754a82 (diff) | |
download | libsigrokdecode-547b79f4b936b35285aed6e3e051ff5d55ffc40a.tar.gz libsigrokdecode-547b79f4b936b35285aed6e3e051ff5d55ffc40a.zip |
counter: Introduce option to ignore edges
-rw-r--r-- | decoders/counter/pd.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/decoders/counter/pd.py b/decoders/counter/pd.py index b01b5e6..c6eac0e 100644 --- a/decoders/counter/pd.py +++ b/decoders/counter/pd.py @@ -55,6 +55,7 @@ class Decoder(srd.Decoder): 'default': 'falling', 'values': ('rising', 'falling')}, {'id': 'edge_off', 'desc': 'Edge counter value after start/reset', 'default': 0}, {'id': 'word_off', 'desc': 'Word counter value after start/reset', 'default': 0}, + {'id': 'dead_cycles', 'desc': 'Ignore this many edges after reset', 'default': 0}, ) def __init__(self): @@ -92,6 +93,7 @@ class Decoder(srd.Decoder): edge_start = None word_count = int(self.options['word_off']) word_start = None + dead_count = 0 while True: self.wait(condition) now = self.samplenum @@ -102,6 +104,13 @@ class Decoder(srd.Decoder): word_count = int(self.options['word_off']) word_start = now self.putc(ROW_RESET, now, ['Word reset', 'Reset', 'Rst', 'R']) + dead_count = int(self.options['dead_cycles']) + continue + + if dead_count: + dead_count -= 1 + edge_start = now + word_start = now continue # Implementation note: In the absence of a RESET condition |