]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/i2c/i2c.py
srd: clear objects after final decref, so it doesn't happen twice
[libsigrokdecode.git] / decoders / i2c / i2c.py
index 270e0f3a9f3faeaf1bb041630dbe1a5a32907f97..816fd790baa33fb4ca0d2091390911ad4b91596a 100644 (file)
@@ -129,6 +129,7 @@ class Decoder(srd.Decoder):
         {'id': 'scl', 'name': 'SCL', 'desc': 'Serial clock line'},
         {'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'},
     ]
+    extra_probes = []
     options = {
         'addressing': ['Slave addressing (in bits)', 7], # 7 or 10
     }
@@ -154,13 +155,13 @@ class Decoder(srd.Decoder):
         self.oldscl = None
         self.oldsda = None
 
-        # Set protocol decoder option defaults.
-        self.addressing = Decoder.options['addressing'][1]
-
     def start(self, metadata):
         self.out_proto = self.add(srd.OUTPUT_PROTO, 'i2c')
         self.out_ann = self.add(srd.OUTPUT_ANN, 'i2c')
 
+    def report(self):
+        pass
+
     def is_start_condition(self, scl, sda):
         # START condition (S): SDA = falling, SCL = high
         if (self.oldsda == 1 and sda == 0) and scl == 1:
@@ -293,8 +294,7 @@ class Decoder(srd.Decoder):
                 elif self.is_stop_condition(scl, sda):
                     self.found_stop(scl, sda)
             else:
-                # Shouldn't happen.
-                raise Exception("unknown state %d" % self.STATE)
+                raise Exception('Invalid state %d' % self.STATE)
 
             # Save current SDA/SCL values for the next round.
             self.oldscl = scl