]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/parallel/pd.py
Change PD options to be a tuple of dictionaries.
[libsigrokdecode.git] / decoders / parallel / pd.py
index c31718fb4efc371fadfe17d056425a40d805e988..8f2176c70e8988c439246fdf2f44f670710a9457 100644 (file)
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-# Parallel (sync) bus protocol decoder
-
 import sigrokdecode as srd
 
 '''
-Protocol output format:
+OUTPUT_PYTHON format:
 
 Packet:
 [<ptype>, <pdata>]
@@ -74,12 +72,14 @@ class Decoder(srd.Decoder):
     outputs = ['parallel']
     probes = []
     optional_probes = probe_list(8)
-    options = {
-        'clock_edge': ['Clock edge to sample on', 'rising'],
-        'wordsize': ['Word size of the data', 1],
-        'endianness': ['Endianness of the data', 'little'],
-        'format': ['Data format', 'hex'],
-    }
+    options = (
+        {'id': 'clock_edge', 'desc': 'Clock edge to sample on',
+            'default': 'rising', 'values': ('rising', 'falling')},
+        {'id': 'wordsize', 'desc': 'Word size of the data',
+            'default': 1},
+        {'id': 'endianness', 'desc': 'Endianness of the data',
+            'default': 'little', 'values': ('little', 'big')},
+    )
     annotations = [
         ['items', 'Items'],
         ['words', 'Words'],
@@ -97,17 +97,17 @@ class Decoder(srd.Decoder):
         self.state = 'IDLE'
 
     def start(self):
-        self.out_proto = self.register(srd.OUTPUT_PYTHON)
+        self.out_python = self.register(srd.OUTPUT_PYTHON)
         self.out_ann = self.register(srd.OUTPUT_ANN)
 
     def putpb(self, data):
-        self.put(self.ss_item, self.es_item, self.out_proto, data)
+        self.put(self.ss_item, self.es_item, self.out_python, data)
 
     def putb(self, data):
         self.put(self.ss_item, self.es_item, self.out_ann, data)
 
     def putpw(self, data):
-        self.put(self.ss_word, self.es_word, self.out_proto, data)
+        self.put(self.ss_word, self.es_word, self.out_python, data)
 
     def putw(self, data):
         self.put(self.ss_word, self.es_word, self.out_ann, data)
@@ -144,7 +144,7 @@ class Decoder(srd.Decoder):
         if self.itemcount < ws:
             return
 
-        # Output annotations/proto for a word (a collection of items).
+        # Output annotations/python for a word (a collection of items).
         word = 0
         for i in range(ws):
             if endian == 'little':