summaryrefslogtreecommitdiff
path: root/decoders/spi
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-02-02 21:10:23 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2014-02-09 19:38:20 +0100
commit9ed115003c754ed2af523af98d22123cee6e99d3 (patch)
tree6a2a4871392427cf01ea73feaf3908e47807ff70 /decoders/spi
parent808c6e7496410ea473c1a625530fd15f779b542e (diff)
downloadlibsigrokdecode-9ed115003c754ed2af523af98d22123cee6e99d3.tar.gz
libsigrokdecode-9ed115003c754ed2af523af98d22123cee6e99d3.zip
spi: Throw an error if neither MISO nor MOSI was supplied.
Diffstat (limited to 'decoders/spi')
-rw-r--r--decoders/spi/pd.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py
index cd40946..3bebc7d 100644
--- a/decoders/spi/pd.py
+++ b/decoders/spi/pd.py
@@ -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)