diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-14 18:09:11 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-14 18:09:11 +0100 |
commit | cc2047464a6b01474721557f32acafd9f1f00cb9 (patch) | |
tree | 1cb7eb616ee130fe3a38fc7895ae2c9d1086ee83 /decoders/spi.py | |
parent | 1ea831e97a3c65b820c049220480def1636cb0b5 (diff) | |
download | libsigrokdecode-cc2047464a6b01474721557f32acafd9f1f00cb9.tar.gz libsigrokdecode-cc2047464a6b01474721557f32acafd9f1f00cb9.zip |
srd: SPI: Add support for arbitrary word sizes.
Diffstat (limited to 'decoders/spi.py')
-rw-r--r-- | decoders/spi.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/decoders/spi.py b/decoders/spi.py index 0c98c1d..7c56aed 100644 --- a/decoders/spi.py +++ b/decoders/spi.py @@ -114,20 +114,20 @@ class Decoder(srd.Decoder): # Receive MOSI bit into our shift register. if self.bit_order == MSB_FIRST: - self.mosidata |= mosi << (7 - self.bitcount) + self.mosidata |= mosi << (self.wordsize - 1 - self.bitcount) else: self.mosidata |= mosi << self.bitcount # Receive MISO bit into our shift register. if self.bit_order == MSB_FIRST: - self.misodata |= miso << (7 - self.bitcount) + self.misodata |= miso << (self.wordsize - 1 - self.bitcount) else: self.misodata |= miso << self.bitcount self.bitcount += 1 # Continue to receive if not a byte yet. - if self.bitcount != 8: + if self.bitcount != self.wordsize: continue self.put(self.start_sample, self.samplenum, self.out_proto, |