summaryrefslogtreecommitdiff
path: root/decoders/spi
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2012-01-28 19:08:13 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2012-01-28 19:08:13 +0100
commitfd4aa8aaed83f9f0041647b913e48ef95c1aab55 (patch)
treef7120186d2c040eec1fe7c4640e97c5969bb4afb /decoders/spi
parentafff6b1a0be19c4f0976309cae571a0c3e41c157 (diff)
downloadlibsigrokdecode-fd4aa8aaed83f9f0041647b913e48ef95c1aab55.tar.gz
libsigrokdecode-fd4aa8aaed83f9f0041647b913e48ef95c1aab55.zip
srd: PDs: Cleanups, simplifications, small fixes.
Diffstat (limited to 'decoders/spi')
-rw-r--r--decoders/spi/spi.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/decoders/spi/spi.py b/decoders/spi/spi.py
index 7789e34..a06498b 100644
--- a/decoders/spi/spi.py
+++ b/decoders/spi/spi.py
@@ -125,22 +125,24 @@ class Decoder(srd.Decoder):
if deasserted:
self.cs_was_deasserted_during_data_word = 1
+ ws = self.options['wordsize']
+
# Receive MOSI bit into our shift register.
if self.options['bitorder'] == MSB_FIRST:
- self.mosidata |= mosi << (self.options['wordsize'] - 1 - self.bitcount)
+ self.mosidata |= mosi << (ws - 1 - self.bitcount)
else:
self.mosidata |= mosi << self.bitcount
# Receive MISO bit into our shift register.
if self.options['bitorder'] == MSB_FIRST:
- self.misodata |= miso << (self.options['wordsize'] - 1 - self.bitcount)
+ self.misodata |= miso << (ws - 1 - self.bitcount)
else:
self.misodata |= miso << self.bitcount
self.bitcount += 1
- # Continue to receive if not a byte yet.
- if self.bitcount != self.options['wordsize']:
+ # Continue to receive if not enough bits were received, yet.
+ if self.bitcount != ws:
continue
self.put(self.start_sample, self.samplenum, self.out_proto,