X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Feeprom93xx%2Fpd.py;h=8c08fc804c3d13b83ff2b50ee48768ed951d1300;hb=e144452bcdd5f2abbe6b6f3da41ad64f67e39def;hp=68649b5cfba1283cbc70c3314574d0a9428eefb4;hpb=9b61fbd1b54df4a4e4b0e42dd89a5891c71f6fb2;p=libsigrokdecode.git diff --git a/decoders/eeprom93xx/pd.py b/decoders/eeprom93xx/pd.py index 68649b5..8c08fc8 100644 --- a/decoders/eeprom93xx/pd.py +++ b/decoders/eeprom93xx/pd.py @@ -44,6 +44,10 @@ class Decoder(srd.Decoder): ('data', 'Data', (0, 1)), ('warnings', 'Warnings', (2,)), ) + binary = ( + ('address', 'Address'), + ('data', 'Data'), + ) def __init__(self): self.reset() @@ -53,6 +57,7 @@ class Decoder(srd.Decoder): def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) + self.out_binary = self.register(srd.OUTPUT_BINARY) self.addresssize = self.options['addresssize'] self.wordsize = self.options['wordsize'] @@ -62,7 +67,8 @@ class Decoder(srd.Decoder): for b in range(len(data)): a += (data[b].si << (len(data) - b - 1)) self.put(data[0].ss, data[-1].es, self.out_ann, - [0, ['Address: 0x%x' % a, 'Addr: 0x%x' % a, '0x%x' % a]]) + [0, ['Address: 0x%04x' % a, 'Addr: 0x%04x' % a, '0x%04x' % a]]) + self.put(data[0].ss, data[-1].es, self.out_binary, [0, bytes([a])]) def put_word(self, si, data): # Decode word (MSb first). @@ -81,10 +87,12 @@ class Decoder(srd.Decoder): else: word_str = '[{:02X}]'.format(c) + word_str self.put(data[0].ss, data[-1].es, - self.out_ann, [idx, ['Data: %s' % word_str, '%s' % word_str]]) + self.out_ann, [idx, ['Data: %s' % word_str, '%s' % word_str]]) else: self.put(data[0].ss, data[-1].es, - self.out_ann, [idx, ['Data: 0x%x' % word, '0x%x' % word]]) + self.out_ann, [idx, ['Data: 0x%04x' % word, '0x%04x' % word]]) + self.put(data[0].ss, data[-1].es, self.out_binary, + [1, bytes([(word & 0xff00) >> 8, word & 0xff])]) def decode(self, ss, es, data): if len(data) < (2 + self.addresssize):