From 547b79f4b936b35285aed6e3e051ff5d55ffc40a Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sat, 11 Aug 2018 22:59:47 +0200 Subject: [PATCH] counter: Introduce option to ignore edges --- decoders/counter/pd.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.30.2