summaryrefslogtreecommitdiff
path: root/decoders/spi
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2013-09-12 21:05:22 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2013-09-12 21:26:13 +0200
commit29f8bb7b787ff8bc2a2e55d3de0b53452e73c6af (patch)
tree5c062047a6c8e55496c7aeb5c81f8f167a4faac5 /decoders/spi
parentec0afe27db7f6e2abdd2a712ca4bbc5c01debe67 (diff)
downloadlibsigrokdecode-29f8bb7b787ff8bc2a2e55d3de0b53452e73c6af.tar.gz
libsigrokdecode-29f8bb7b787ff8bc2a2e55d3de0b53452e73c6af.zip
spi: Provide multiple annotation types.
For now SPI gets the following annotation types: - MISO/MOSI SPI data - MISO SPI data - MOSI SPI data (i.e. you can see either MISO, or MOSI, or both; the latter is most useful for CLI usage) Also, show the hex values as e.g. F5 (upper-case letters, no "0x" prefix).
Diffstat (limited to 'decoders/spi')
-rw-r--r--decoders/spi/pd.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py
index 1dff414..47bbe32 100644
--- a/decoders/spi/pd.py
+++ b/decoders/spi/pd.py
@@ -60,7 +60,9 @@ class Decoder(srd.Decoder):
'format': ['Data format', 'hex'],
}
annotations = [
- ['Data', 'SPI data'],
+ ['MISO/MOSI data', 'MISO/MOSI SPI data'],
+ ['MISO data', 'MISO SPI data'],
+ ['MOSI data', 'MOSI SPI data'],
['Warnings', 'Human-readable warnings'],
]
@@ -150,11 +152,12 @@ class Decoder(srd.Decoder):
continue
self.putpw(['DATA', self.mosidata, self.misodata])
- self.putw([0, ['MOSI: 0x%02x, MISO: 0x%02x' % (self.mosidata,
- self.misodata)]])
+ self.putw([0, ['%02X/%02X' % (self.mosidata, self.misodata)]])
+ self.putw([1, ['%02X' % self.misodata]])
+ self.putw([2, ['%02X' % self.mosidata]])
if self.cs_was_deasserted_during_data_word:
- self.putw([1, ['CS# was deasserted during this data word!']])
+ self.putw([3, ['CS# was deasserted during this data word!']])
# Reset decoder state.
self.mosidata = 0