From e2317ec49b8b04c7f8b3358c2e9c264de4280539 Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sat, 7 Nov 2020 14:47:21 +0100 Subject: 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. --- decoders/parallel/pd.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'decoders') 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] -- cgit v1.2.3-70-g09d2