diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2019-11-09 15:25:47 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2019-11-09 15:41:26 +0100 |
commit | 841cb8c0ea257b79690b0f2467ad6df7bb09cb29 (patch) | |
tree | d2180ddb8df498388bd0581d170f110de778dcc3 /decoders/eeprom93xx | |
parent | 9e953ff151c5d714dd57ec81eb402ec1d77ab8e7 (diff) | |
download | libsigrokdecode-841cb8c0ea257b79690b0f2467ad6df7bb09cb29.tar.gz libsigrokdecode-841cb8c0ea257b79690b0f2467ad6df7bb09cb29.zip |
eeprom93xx: Add OUTPUT_BINARY support.
Diffstat (limited to 'decoders/eeprom93xx')
-rw-r--r-- | decoders/eeprom93xx/pd.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/decoders/eeprom93xx/pd.py b/decoders/eeprom93xx/pd.py index 68649b5..db4dd3f 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'] @@ -63,6 +68,7 @@ class Decoder(srd.Decoder): 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]]) + 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%x' % word, '0x%x' % 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): |