diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2019-04-24 21:10:40 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2019-04-24 22:02:11 +0200 |
commit | a69b0f0bfe92106228252eed05c1ce22859f15d8 (patch) | |
tree | c51c58a3f08236924e9a7807493597d97a983d62 | |
parent | 5ae47601f4935bca731415b23c5f8ad85d6f2309 (diff) | |
download | libsigrokdecode-a69b0f0bfe92106228252eed05c1ce22859f15d8.tar.gz libsigrokdecode-a69b0f0bfe92106228252eed05c1ce22859f15d8.zip |
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.
-rw-r--r-- | decoders/spi/pd.py | 10 |
1 files changed, 10 insertions, 0 deletions
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]) |