summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-12-28 14:33:50 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2014-12-28 14:34:22 +0100
commit49d0e05ce73b2b8e47714b5d95e66e9b27aeaa4d (patch)
tree3f428d2d4e97ce4daf9f04d6b66006e4545a506e /decoders
parentbe42cffca100c00d0d5510b08dcb66655f8a5746 (diff)
downloadlibsigrokdecode-49d0e05ce73b2b8e47714b5d95e66e9b27aeaa4d.tar.gz
libsigrokdecode-49d0e05ce73b2b8e47714b5d95e66e9b27aeaa4d.zip
spi: Add binary output facilities for MISO/MOSI.
This fixes bug #424.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/spi/pd.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py
index 0618a8a..3abcd68 100644
--- a/decoders/spi/pd.py
+++ b/decoders/spi/pd.py
@@ -111,6 +111,10 @@ class Decoder(srd.Decoder):
('mosi-bits', 'MOSI bits', (3,)),
('other', 'Other', (4,)),
)
+ binary = (
+ ('miso', 'MISO'),
+ ('mosi', 'MOSI'),
+ )
def __init__(self):
self.samplerate = None
@@ -134,6 +138,7 @@ class Decoder(srd.Decoder):
def start(self):
self.out_python = self.register(srd.OUTPUT_PYTHON)
self.out_ann = self.register(srd.OUTPUT_ANN)
+ self.out_bin = self.register(srd.OUTPUT_BINARY)
self.out_bitrate = self.register(srd.OUTPUT_META,
meta=(int, 'Bitrate', 'Bitrate during transfers'))
@@ -149,8 +154,10 @@ class Decoder(srd.Decoder):
if self.have_miso:
ss, es = self.misobits[-1][1], self.misobits[0][2]
+ self.put(ss, es, self.out_bin, (0, bytes([so])))
if self.have_mosi:
ss, es = self.mosibits[-1][1], self.mosibits[0][2]
+ self.put(ss, es, self.out_bin, (1, bytes([si])))
self.put(ss, es, self.out_python, ['BITS', si_bits, so_bits])
self.put(ss, es, self.out_python, ['DATA', si, so])