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.
)
options = (
{'id': 'clock_edge', 'desc': 'Clock edge to sample on',
)
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',
{'id': 'wordsize', 'desc': 'Data wordsize (# bus cycles)',
'default': 0},
{'id': 'endianness', 'desc': 'Data endianness',
# which provide input data.
has_clock = self.has_channel(Pin.CLOCK)
if has_clock:
# 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]
conds = [{Pin.CLOCK: edge}]
else:
conds = [{idx: 'e'} for idx in has_data]