]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/i2c.py
srd: Consistent PD option defaults handling.
[libsigrokdecode.git] / decoders / i2c.py
index 083fbb315324067451facefbc70e732d69de315f..b0273c092b453cc105d3efabb259d5b206e1fb90 100644 (file)
@@ -120,7 +120,7 @@ FIND_DATA = 2
 class Decoder(srd.Decoder):
     id = 'i2c'
     name = 'I2C'
-    longname = 'Inter-Integrated Circuit (I2C) bus'
+    longname = 'Inter-Integrated Circuit'
     desc = 'I2C is a two-wire, multi-master, serial bus.'
     longdesc = '...'
     author = 'Uwe Hermann'
@@ -133,7 +133,7 @@ class Decoder(srd.Decoder):
         {'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'},
     ]
     options = {
-        'address-space': ['Address space (in bits)', 7],
+        'addressing': ['Slave addressing (in bits)', 7], # 7 or 10
     }
     annotations = [
         # ANN_SHIFTED
@@ -157,6 +157,9 @@ 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')
@@ -269,7 +272,7 @@ class Decoder(srd.Decoder):
         # TODO: 0-0 sample range for now.
         super(Decoder, self).put(0, 0, output_id, data)
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
         for samplenum, (scl, sda) in data:
             self.samplecnt += 1