diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-14 18:34:07 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-14 18:34:07 +0100 |
commit | 01329e88ee576eb511528e691ddee23998d2de21 (patch) | |
tree | 0243b3ea084c39268eba536227bc895bbc99e04c /decoders | |
parent | c94c8c918152004e7bed50a50dcf7be233674b9d (diff) | |
download | libsigrokdecode-01329e88ee576eb511528e691ddee23998d2de21.tar.gz libsigrokdecode-01329e88ee576eb511528e691ddee23998d2de21.zip |
srd: SPI: Output warning annotation if CS# de-asserted.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/spi.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/decoders/spi.py b/decoders/spi.py index 480174e..5b97cd4 100644 --- a/decoders/spi.py +++ b/decoders/spi.py @@ -84,6 +84,7 @@ class Decoder(srd.Decoder): self.misodata = 0 self.bytesreceived = 0 self.samplenum = -1 + self.cs_was_deasserted_during_data_word = 0 # Set protocol decoder option defaults. self.cs_active_low = Decoder.options['cs_active_low'][1] @@ -128,6 +129,8 @@ class Decoder(srd.Decoder): # If this is the first bit, save its sample number. if self.bitcount == 0: self.start_sample = samplenum + if cs: + self.cs_was_deasserted_during_data_word = 1 # Receive MOSI bit into our shift register. if self.bitorder == MSB_FIRST: @@ -153,6 +156,10 @@ class Decoder(srd.Decoder): [ANN_HEX, ['MOSI: 0x%02x, MISO: 0x%02x' % (self.mosidata, self.misodata)]]) + if self.cs_was_deasserted_during_data_word: + self.put(self.start_sample, self.samplenum, self.out_ann, + [ANN_HEX, ['WARNING: CS# was deasserted!']]) + # Reset decoder state. self.mosidata = 0 self.misodata = 0 |