From: Uwe Hermann Date: Fri, 20 Sep 2013 14:28:33 +0000 (+0200) Subject: usb_signalling: Simplify symbols handling a bit. X-Git-Tag: libsigrokdecode-0.3.0~297 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7dc75721f38ce781db1b8d512d626024acf35b59;p=libsigrokdecode.git usb_signalling: Simplify symbols handling a bit. --- 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': { # (, ): (0, 0): 'SE0', (1, 0): 'K', (0, 1): 'J', (1, 1): 'SE1', -} -symbols_fs = { + }, + 'full-speed': { # (, ): (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])