summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2020-01-10 21:28:06 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2020-01-10 21:48:18 +0100
commitcd4a074dcfa09713de7a0ae6259d9a18eab3582f (patch)
tree3f15fbd921d59b355f5f6d512f711836b0e13fcb /decoders
parenta32575cd7fc63447f4ba8bdb27e8e73ba5ae3cc0 (diff)
downloadlibsigrokdecode-cd4a074dcfa09713de7a0ae6259d9a18eab3582f.tar.gz
libsigrokdecode-cd4a074dcfa09713de7a0ae6259d9a18eab3582f.zip
maple_bus: Use SrdIntEnum for pins.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/maple_bus/pd.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/decoders/maple_bus/pd.py b/decoders/maple_bus/pd.py
index c3f1140..e0dcca7 100644
--- a/decoders/maple_bus/pd.py
+++ b/decoders/maple_bus/pd.py
@@ -18,6 +18,9 @@
##
import sigrokdecode as srd
+from common.srdhelper import SrdIntEnum
+
+Pin = SrdIntEnum.from_str('Pin', 'SDCKA SDCKB')
ann = [
['Size', 'L'],
@@ -142,11 +145,11 @@ class Decoder(srd.Decoder):
self.putx([7, ['Frame error', 'F error', 'FE']])
def handle_start(self):
- self.wait({0: 'l', 1: 'h'})
+ self.wait({Pin.SDCKA: 'l', Pin.SDCKB: 'h'})
self.ss = self.samplenum
count = 0
while True:
- sdcka, sdckb = self.wait([{1: 'f'}, {0: 'r'}])
+ sdcka, sdckb = self.wait([{Pin.SDCKB: 'f'}, {Pin.SDCKA: 'r'}])
if self.matched[0]:
count = count + 1
if self.matched[1]:
@@ -175,14 +178,15 @@ class Decoder(srd.Decoder):
countb = 0
self.data = 0
while countb < 4:
- sdcka, sdckb = self.wait([{0: 'f'}, {1: 'f'}])
+ sdcka, sdckb = self.wait([{Pin.SDCKA: 'f'}, {Pin.SDCKB: 'f'}])
self.es = self.samplenum
if self.matched[0]:
if counta == countb:
self.got_bit(sdckb)
counta = counta + 1
elif counta == 1 and countb == 0 and self.data == 0 and sdckb == 0:
- self.wait([{0: 'h', 1: 'h'}, {0: 'f'}, {1: 'f'}])
+ self.wait([{Pin.SDCKA: 'h', Pin.SDCKB: 'h'},
+ {Pin.SDCKA: 'f'}, {Pin.SDCKB: 'f'}])
self.es = self.samplenum
if self.matched[0]:
self.got_end()
@@ -202,7 +206,7 @@ class Decoder(srd.Decoder):
else:
self.frame_error()
return False
- self.wait({0: 'h'})
+ self.wait({Pin.SDCKA: 'h'})
self.es = self.samplenum
self.got_byte()
return True