summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-02-19 15:17:52 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2014-02-19 15:21:06 +0100
commit7c09dbb2adb240e013d373da8dccb56efd22380e (patch)
tree2a45b1cee972673400122689edaae0e9f390fa72
parent8e8096e8289d8c5a5adf75109e481fe734e629f8 (diff)
downloadlibsigrokdecode-7c09dbb2adb240e013d373da8dccb56efd22380e.tar.gz
libsigrokdecode-7c09dbb2adb240e013d373da8dccb56efd22380e.zip
spi: Fix some start/end samplenumbers for PYTHON output.
This fixes the data/annotations of stacked PDs.
-rw-r--r--decoders/spi/pd.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py
index d077cca..2cde8bc 100644
--- a/decoders/spi/pd.py
+++ b/decoders/spi/pd.py
@@ -125,9 +125,6 @@ class Decoder(srd.Decoder):
self.out_bitrate = self.register(srd.OUTPUT_META,
meta=(int, 'Bitrate', 'Bitrate during transfers'))
- def putpw(self, data):
- self.put(self.startsample, self.samplenum, self.out_python, data)
-
def putw(self, data):
self.put(self.startsample, self.samplenum, self.out_ann, data)
@@ -137,8 +134,14 @@ class Decoder(srd.Decoder):
si = self.mosidata if self.have_mosi else None
so_bits = self.misobits if self.have_miso else None
si_bits = self.mosibits if self.have_mosi else None
- self.putpw(['BITS', si_bits, so_bits])
- self.putpw(['DATA', si, so])
+
+ if self.have_miso:
+ ss, es = self.misobits[-1][1], self.misobits[0][2]
+ if self.have_mosi:
+ ss, es = self.mosibits[-1][1], self.mosibits[0][2]
+
+ self.put(ss, es, self.out_python, ['BITS', si_bits, so_bits])
+ self.put(ss, es, self.out_python, ['DATA', si, so])
# Bit annotations.
if self.have_miso:
@@ -150,10 +153,8 @@ class Decoder(srd.Decoder):
# Dataword annotations.
if self.have_miso:
- ss, es = self.misobits[-1][1], self.misobits[0][2]
self.put(ss, es, self.out_ann, [0, ['%02X' % self.misodata]])
if self.have_mosi:
- ss, es = self.mosibits[-1][1], self.mosibits[0][2]
self.put(ss, es, self.out_ann, [1, ['%02X' % self.mosidata]])
def reset_decoder_state(self):