From: Uwe Hermann Date: Sun, 2 Feb 2014 20:10:23 +0000 (+0100) Subject: spi: Throw an error if neither MISO nor MOSI was supplied. X-Git-Tag: libsigrokdecode-0.3.0~110 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9ed115003c754ed2af523af98d22123cee6e99d3;p=libsigrokdecode.git spi: Throw an error if neither MISO nor MOSI was supplied. --- 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)