From a69b0f0bfe92106228252eed05c1ce22859f15d8 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 24 Apr 2019 21:10:40 +0200 Subject: spi: Add support for "transfer" annotations. There is already an OUTPUT_PYTHON type named 'TRANSFER' that is being transmitted to stacked decoders. Make the same information available as annotations (additionally), which can be helpful in some situations. --- decoders/spi/pd.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'decoders/spi') diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py index 2797137..7cfa266 100644 --- a/decoders/spi/pd.py +++ b/decoders/spi/pd.py @@ -108,12 +108,16 @@ class Decoder(srd.Decoder): ('miso-bits', 'MISO bits'), ('mosi-bits', 'MOSI bits'), ('warnings', 'Human-readable warnings'), + ('miso-transfer', 'MISO transfer'), + ('mosi-transfer', 'MOSI transfer'), ) annotation_rows = ( ('miso-data', 'MISO data', (0,)), ('miso-bits', 'MISO bits', (2,)), + ('miso-transfer', 'MISO transfer', (5,)), ('mosi-data', 'MOSI data', (1,)), ('mosi-bits', 'MOSI bits', (3,)), + ('mosi-transfer', 'MOSI transfer', (6,)), ('other', 'Other', (4,)), ) binary = ( @@ -276,6 +280,12 @@ class Decoder(srd.Decoder): self.misobytes = [] self.mosibytes = [] else: + if self.have_miso: + self.put(self.ss_transfer, self.samplenum, self.out_ann, + [5, [' '.join(format(x.val, '02X') for x in self.misobytes)]]) + if self.have_mosi: + self.put(self.ss_transfer, self.samplenum, self.out_ann, + [6, [' '.join(format(x.val, '02X') for x in self.mosibytes)]]) self.put(self.ss_transfer, self.samplenum, self.out_python, ['TRANSFER', self.mosibytes, self.misobytes]) -- cgit v1.2.3-70-g09d2