summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2020-11-07 14:47:21 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2020-11-11 19:31:47 +0100
commite2317ec49b8b04c7f8b3358c2e9c264de4280539 (patch)
treebde678ecc8ce98679d8086799a3fa1eb42019d3f /decoders
parent615f86f6bf7f7166f2975c9efe7e727bf2b65734 (diff)
downloadlibsigrokdecode-e2317ec49b8b04c7f8b3358c2e9c264de4280539.tar.gz
libsigrokdecode-e2317ec49b8b04c7f8b3358c2e9c264de4280539.zip
parallel: add option to sample data on either clock edge
Add 'either' as another choice in addition to rising and falling clock edge. This is useful since parallel busses exist which communicate at double data rate (DDR). Unobfuscate the mapping between displayed option text and .wait() condition codes while we are here.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/parallel/pd.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/decoders/parallel/pd.py b/decoders/parallel/pd.py
index 10255f3..abf48eb 100644
--- a/decoders/parallel/pd.py
+++ b/decoders/parallel/pd.py
@@ -86,7 +86,7 @@ class Decoder(srd.Decoder):
)
options = (
{'id': 'clock_edge', 'desc': 'Clock edge to sample on',
- 'default': 'rising', 'values': ('rising', 'falling')},
+ 'default': 'rising', 'values': ('rising', 'falling', 'either')},
{'id': 'wordsize', 'desc': 'Data wordsize (# bus cycles)',
'default': 0},
{'id': 'endianness', 'desc': 'Data endianness',
@@ -204,7 +204,11 @@ class Decoder(srd.Decoder):
# which provide input data.
has_clock = self.has_channel(Pin.CLOCK)
if has_clock:
- edge = self.options['clock_edge'][0]
+ edge = {
+ 'rising': 'r',
+ 'falling': 'f',
+ 'either': 'e',
+ }.get(self.options['clock_edge'])
conds = [{Pin.CLOCK: edge}]
else:
conds = [{idx: 'e'} for idx in has_data]