diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2013-09-20 16:28:33 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2013-09-20 17:57:53 +0200 |
commit | 7dc75721f38ce781db1b8d512d626024acf35b59 (patch) | |
tree | 20ed62986921d43f09dc66ad323bf096117b9d04 /decoders/usb_signalling | |
parent | 5bb55598a1868113513f737b2714bcd6e48aa9b3 (diff) | |
download | libsigrokdecode-7dc75721f38ce781db1b8d512d626024acf35b59.tar.gz libsigrokdecode-7dc75721f38ce781db1b8d512d626024acf35b59.zip |
usb_signalling: Simplify symbols handling a bit.
Diffstat (limited to 'decoders/usb_signalling')
-rw-r--r-- | decoders/usb_signalling/pd.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py index 70ada37..4bf74b6 100644 --- a/decoders/usb_signalling/pd.py +++ b/decoders/usb_signalling/pd.py @@ -25,19 +25,21 @@ import sigrokdecode as srd # Low-/full-speed symbols (used as states of our state machine, too). # Note: Low-speed J and K are inverted compared to the full-speed J and K! -symbols_ls = { +symbols = { + 'low-speed': { # (<dp>, <dm>): <symbol/state> (0, 0): 'SE0', (1, 0): 'K', (0, 1): 'J', (1, 1): 'SE1', -} -symbols_fs = { + }, + 'full-speed': { # (<dp>, <dm>): <symbol/state> (0, 0): 'SE0', (1, 0): 'J', (0, 1): 'K', (1, 1): 'SE1', + }, } bitrates = { @@ -104,10 +106,7 @@ class Decoder(srd.Decoder): continue self.oldpins, (dp, dm) = pins, pins - if self.options['signalling'] == 'low-speed': - sym = symbols_ls[dp, dm] - elif self.options['signalling'] == 'full-speed': - sym = symbols_fs[dp, dm] + sym = symbols[self.options['signalling']][dp, dm] self.putx([0, [sym]]) self.putp(['SYM', sym]) |