From: Soeren Apel Date: Fri, 17 Dec 2021 21:50:00 +0000 (+0100) Subject: parallel: Add binary output X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=82f3f4d4163ffba003a49a5c7f1f6966f132bbb8;p=libsigrokdecode.git parallel: Add binary output --- diff --git a/decoders/parallel/pd.py b/decoders/parallel/pd.py index 5acfb67..96741e7 100644 --- a/decoders/parallel/pd.py +++ b/decoders/parallel/pd.py @@ -108,6 +108,9 @@ class Decoder(srd.Decoder): ('words', 'Words', (Ann.WORD,)), ('warnings', 'Warnings', (Ann.WARN,)), ) + binary = ( + ('binary', 'Binary'), + ) def __init__(self): self.reset() @@ -118,6 +121,7 @@ class Decoder(srd.Decoder): def start(self): self.out_python = self.register(srd.OUTPUT_PYTHON) + self.out_binary = self.register(srd.OUTPUT_BINARY) self.out_ann = self.register(srd.OUTPUT_ANN) def putg(self, ss, es, ann, txts): @@ -126,6 +130,9 @@ class Decoder(srd.Decoder): def putpy(self, ss, es, ann, data): self.put(ss, es, self.out_python, [ann, data]) + def putbin(self, ss, es, ann_class, data): + self.put(ss, es, self.out_binary, [ann_class, data]) + def flush_word(self, bus_width): if not self.word_items: return @@ -177,6 +184,7 @@ class Decoder(srd.Decoder): txts = [self.fmt_item.format(data)] self.putg(ss, es, Ann.ITEM, txts) self.putpy(ss, es, 'ITEM', (data, bus_width)) + self.putbin(ss, es, 0, data.to_bytes(1, byteorder='big')) # Optionally queue the currently seen item. if item is not None: