]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/i2cdemux/i2cdemux.py
srd: I2C: change format to have ACK/NACK bits as separate events
[libsigrokdecode.git] / decoders / i2cdemux / i2cdemux.py
index 354d06c23473f66c141d6eef0ce604515ff83c29..4632c8df17644e73936f2a3b7c478e8152bf7f9e 100644 (file)
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#
 # Generic I2C demultiplexing protocol decoder
-#
-# Takes an I2C stream as input and outputs multiple I2C streams, each stream
-# containing only I2C packets for one specific I2C slave.
-#
 
 import sigrokdecode as srd
 
@@ -62,10 +57,10 @@ class Decoder(srd.Decoder):
     # get the whole chunk of packets (from START to STOP).
     def decode(self, ss, es, data):
 
-        cmd, databyte, ack = data
+        cmd, databyte = data
 
         # Add the I2C packet to our local cache.
-        self.packets += [[ss, es, data]]
+        self.packets.append([ss, es, data])
 
         if cmd in ('ADDRESS READ', 'ADDRESS WRITE'):
             if databyte in self.slaves:
@@ -73,9 +68,9 @@ class Decoder(srd.Decoder):
                 return
 
             # We're never seen this slave, add a new stream.
-            self.slaves += [databyte]
-            self.out_proto += [self.add(srd.OUTPUT_PROTO,
-                               'i2c-%s' % hex(databyte))]
+            self.slaves.append(databyte)
+            self.out_proto.append(self.add(srd.OUTPUT_PROTO,
+                                  'i2c-%s' % hex(databyte)))
             self.stream = self.streamcount
             self.streamcount += 1
         elif cmd == 'STOP':