summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2018-01-03 19:41:37 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2018-01-03 19:41:37 +0100
commite8b53818d68f724064c7fcca7ab826b5f2071293 (patch)
tree0efb5875d0b7410d7cb80c801ad38849fb75058d /decoders
parent42dcd8ef08cadaa870efa71f2df7650d4e4c24a6 (diff)
downloadlibsigrokdecode-e8b53818d68f724064c7fcca7ab826b5f2071293.tar.gz
libsigrokdecode-e8b53818d68f724064c7fcca7ab826b5f2071293.zip
counter: make 'reset' signal polarity an option
Allow configuration of the 'reset' signal polarity. Reset counters on either falling (default) or rising edges.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/counter/pd.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/decoders/counter/pd.py b/decoders/counter/pd.py
index a028765..cbb6a5f 100644
--- a/decoders/counter/pd.py
+++ b/decoders/counter/pd.py
@@ -45,8 +45,11 @@ class Decoder(srd.Decoder):
('word_resets', 'Word resets', (2,)),
)
options = (
- {'id': 'edge', 'desc': 'Edges to check', 'default': 'any', 'values': ('any', 'rising', 'falling')},
+ {'id': 'data_edge', 'desc': 'Edges to count (data)', 'default': 'any',
+ 'values': ('any', 'rising', 'falling')},
{'id': 'divider', 'desc': 'Count divider (word width)', 'default': 0},
+ {'id': 'reset_edge', 'desc': 'Edge which clears counters (reset)',
+ 'default': 'falling', 'values': ('rising', 'falling')},
)
def __init__(self):
@@ -63,7 +66,7 @@ class Decoder(srd.Decoder):
def start(self):
self.out_ann = self.register(srd.OUTPUT_ANN)
- self.edge = self.options['edge']
+ self.edge = self.options['data_edge']
self.divider = self.options['divider']
if self.divider < 0:
self.divider = 0
@@ -78,7 +81,7 @@ class Decoder(srd.Decoder):
if self.has_channel(1):
self.have_reset = True
- condition.append({1: 'f'})
+ condition.append({1: self.options['reset_edge'][0]})
while True:
self.wait(condition)