]> sigrok.org Git - libsigrokdecode.git/commitdiff
ds243x: Add binary output for data read from EEPROM
authorSoeren Apel <redacted>
Wed, 25 Oct 2017 07:28:56 +0000 (09:28 +0200)
committerUwe Hermann <redacted>
Wed, 1 Nov 2017 23:33:09 +0000 (00:33 +0100)
decoders/ds243x/pd.py

index 0c515967bb2c8659ccf3638b3db6affd1dcc4fd0..05313dcc9e720f239261600585ddddeb2c7d11e7 100644 (file)
@@ -72,6 +72,9 @@ class Decoder(srd.Decoder):
     annotations = (
         ('text', 'Human-readable text'),
     )
+    binary = (
+        ('mem_read', 'Data read from memory'),
+    )
 
     def __init__(self):
         # Bytes for function command.
@@ -82,6 +85,7 @@ class Decoder(srd.Decoder):
 
     def start(self):
         self.out_ann = self.register(srd.OUTPUT_ANN)
+        self.out_binary = self.register(srd.OUTPUT_BINARY)
 
     def putx(self, data):
         self.put(self.ss, self.es, self.out_ann, data)
@@ -257,3 +261,6 @@ class Decoder(srd.Decoder):
                 elif 3 < len(self.bytes):
                     self.ss, self.es = ss, es
                     self.putx([0, ['Data: 0x%02x' % (self.bytes[-1])]])
+
+                    bdata = self.bytes[-1].to_bytes(1, byteorder='big')
+                    self.put(ss, es, self.out_binary, [0, bdata])