X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fspi%2Fpd.py;h=97d5571c066a3d8ec6664de9ef04cc766b4d756b;hb=95d11271b46a46788d497481d03177e883c8554e;hp=4e5627bd02db6ae14d3154ac1c04bbbbd4a99c82;hpb=37b0da68d021530012f17e86b4754d109977ba76;p=libsigrokdecode.git diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py index 4e5627b..97d5571 100644 --- a/decoders/spi/pd.py +++ b/decoders/spi/pd.py @@ -28,11 +28,11 @@ Packet: [, , ] : - - 'DATA': contains the MISO data, contains the MOSI data. + - 'DATA': contains the MOSI data, contains the MISO data. The data is _usually_ 8 bits (but can also be fewer or more bits). Both data items are Python numbers (not strings), or None if the respective channel was not supplied. - - 'BITS': / contain a list of bit values in this MISO/MOSI data + - 'BITS': / contain a list of bit values in this MOSI/MISO data item, and for each of those also their respective start-/endsample numbers. - 'CS CHANGE': is the old CS# pin value, is the new value. Both data items are Python numbers (0/1), not strings. @@ -63,7 +63,7 @@ spi_mode = { class SamplerateError(Exception): pass -class MissingDataError(Exception): +class ChannelError(Exception): pass class Decoder(srd.Decoder): @@ -265,7 +265,7 @@ class Decoder(srd.Decoder): def decode(self, ss, es, data): if not self.samplerate: - raise SamplerateError("Cannot decode without samplerate.") + raise SamplerateError('Cannot decode without samplerate.') # Either MISO or MOSI can be omitted (but not both). CS# is optional. for (self.samplenum, pins) in data: @@ -279,7 +279,6 @@ class Decoder(srd.Decoder): # Either MISO or MOSI (but not both) can be omitted. if not (self.have_miso or self.have_mosi): - raise MissingDataError('Either MISO or MOSI (or both) pins required.') + raise ChannelError('Either MISO or MOSI (or both) pins required.') self.find_clk_edge(miso, mosi, clk, cs) -