X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fsdcard_spi%2Fpd.py;h=4f7c9f75b5fd9dc652a7eeebd82e4f87d688b0e1;hb=12851357e784b893e24880efc6cd22a0cbcc64ce;hp=c61c8c25833bd6e277762aaba189eeffe4179bec;hpb=780770f1295b7fdeb4481eb42623bad5da1e19a7;p=libsigrokdecode.git diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index c61c8c2..4f7c9f7 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -69,8 +69,15 @@ cmd_name = { 51: 'SEND_SCR', } +def cmd_list(): + l = [] + for i in range(63 + 1): + l.append(('cmd%d' % i, 'CMD%d' % i)) + + return tuple(l) + class Decoder(srd.Decoder): - api_version = 1 + api_version = 2 id = 'sdcard_spi' name = 'SD card (SPI mode)' longname = 'Secure Digital card (SPI mode)' @@ -78,17 +85,16 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['spi'] outputs = ['sdcard_spi'] - annotations = \ - [['cmd%d' % i, 'CMD%d' % i] for i in range(63 + 1)] + [ - ['cmd-desc', 'Command description'], - ['r1', 'R1 reply'], - ['r1b', 'R1B reply'], - ['r2', 'R2 reply'], - ['r3', 'R3 reply'], - ['r7', 'R7 reply'], - ['bits', 'Bits'], - ['bit-warnings', 'Bit warnings'], - ] + annotations = cmd_list() + ( + ('cmd-desc', 'Command description'), + ('r1', 'R1 reply'), + ('r1b', 'R1B reply'), + ('r2', 'R2 reply'), + ('r3', 'R3 reply'), + ('r7', 'R7 reply'), + ('bits', 'Bits'), + ('bit-warnings', 'Bit warnings'), + ) annotation_rows = ( ('bits', 'Bits', (70, 71)), ('cmd-reply', 'Commands/replies', @@ -110,7 +116,6 @@ class Decoder(srd.Decoder): self.cmd_str = '' def start(self): - # self.out_python = self.register(srd.OUTPUT_PYTHON) self.out_ann = self.register(srd.OUTPUT_ANN) def putx(self, data):