]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/i2cfilter/pd.py
All PDs: Drop unneeded exceptions.
[libsigrokdecode.git] / decoders / i2cfilter / pd.py
index 09c12f1f69182fd9af3f6cc547db50a61136f85b..895cc179045333d83280a7031edf40933612bfb4 100644 (file)
@@ -23,7 +23,7 @@
 import sigrokdecode as srd
 
 class Decoder(srd.Decoder):
-    api_version = 1
+    api_version = 2
     id = 'i2cfilter'
     name = 'I²C filter'
     longname = 'I²C filter'
@@ -31,16 +31,14 @@ class Decoder(srd.Decoder):
     license = 'gplv3+'
     inputs = ['i2c']
     outputs = ['i2c']
-    probes = []
-    optional_probes = []
-    options = {
-        'address': ['Address to filter out of the I²C stream', 0],
-        'direction': ['Direction to filter (read/write/both)', 'both']
-    }
-    annotations = []
+    options = (
+        {'id': 'address', 'desc': 'Address to filter out of the I²C stream',
+            'default': 0},
+        {'id': 'direction', 'desc': 'Direction to filter', 'default': 'both',
+            'values': ('read', 'write', 'both')}
+    )
 
     def __init__(self, **kwargs):
-        self.state = None
         self.curslave = -1
         self.curdirection = None
         self.packets = [] # Local cache of I²C packets