]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/parallel/pd.py
Doxyfile: Set version to 0.4.0.
[libsigrokdecode.git] / decoders / parallel / pd.py
index 0b512c8d80a1e6496aa25e064e8bdbb3ff423950..cafaefc071b4904718c84ab5e589bb695d005ea5 100644 (file)
@@ -61,6 +61,9 @@ def channel_list(num_channels):
         l.append(d)
     return tuple(l)
 
+class ChannelError(Exception):
+    pass
+
 class Decoder(srd.Decoder):
     api_version = 2
     id = 'parallel'
@@ -122,7 +125,7 @@ class Decoder(srd.Decoder):
         self.items.append(item)
         self.itemcount += 1
 
-        if self.first == True:
+        if self.first:
             # Save the start sample and item for later (no output yet).
             self.ss_item = self.samplenum
             self.first = False
@@ -180,8 +183,10 @@ class Decoder(srd.Decoder):
                 continue
             self.oldpins = pins
 
+            if sum(1 for p in pins if p in (0, 1)) == 0:
+                raise ChannelError('At least one channel has to be supplied.')
+
             if pins[0] not in (0, 1):
                 self.handle_bits(pins[1:])
             else:
                 self.find_clk_edge(pins[0], pins[1:])
-