X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fi2cdemux%2Fi2cdemux.py;h=360c408a42a4aa85dab502b4cd54292249ef93c7;hb=6d990fe1dbf441eb9f090898e7c3a57889b26aef;hp=49261600495bb88b6885d4fea40b0d97bf31768b;hpb=decde15ecb51b3326b31019af61e0a729b9c61d0;p=libsigrokdecode.git diff --git a/decoders/i2cdemux/i2cdemux.py b/decoders/i2cdemux/i2cdemux.py index 4926160..360c408 100644 --- a/decoders/i2cdemux/i2cdemux.py +++ b/decoders/i2cdemux/i2cdemux.py @@ -18,12 +18,7 @@ ## 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 @@ -31,14 +26,13 @@ class Decoder(srd.Decoder): api_version = 1 id = 'i2cdemux' name = 'I2C demux' - longname = 'Generic I2C demultiplexer' + longname = 'I2C demultiplexer' desc = 'TODO.' - longdesc = 'TODO.' license = 'gplv2+' inputs = ['i2c'] outputs = [] # TODO: Only known at run-time. probes = [] - extra_probes = [] + optional_probes = [] options = {} annotations = [] @@ -62,10 +56,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 +67,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':