From 9ed115003c754ed2af523af98d22123cee6e99d3 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sun, 2 Feb 2014 21:10:23 +0100 Subject: spi: Throw an error if neither MISO nor MOSI was supplied. --- decoders/spi/pd.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'decoders') 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) -- cgit v1.2.3-70-g09d2