]> sigrok.org Git - libsigrokdecode.git/commitdiff
spi: Throw an error if neither MISO nor MOSI was supplied.
authorUwe Hermann <redacted>
Sun, 2 Feb 2014 20:10:23 +0000 (21:10 +0100)
committerUwe Hermann <redacted>
Sun, 9 Feb 2014 18:38:20 +0000 (19:38 +0100)
decoders/spi/pd.py

index cd40946c791ec5a1fb13edea8fbe6df75ed20e1f..3bebc7d6efa70e822069eeb5002a47ddc1e31748 100644 (file)
@@ -266,6 +266,10 @@ class Decoder(srd.Decoder):
             self.have_mosi = (mosi in (0, 1))
             self.have_cs = (cs in (0, 1))
 
+            # Either MISO or MOSI (but not both) can be omitted.
+            if not (self.have_miso or self.have_mosi):
+                raise Exception('Either MISO or MOSI (or both) pins required.')
+
             # State machine.
             if self.state == 'IDLE':
                 self.find_clk_edge(miso, mosi, clk, cs)