From: Joel Holdsworth Date: Sat, 28 Dec 2013 08:01:02 +0000 (+0100) Subject: i2cfiler: Replaced I2C with I²C X-Git-Tag: libsigrokdecode-0.3.0~175 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=bbe6d87fa91938bafc81c19cb1ef868d1c29bb2b i2cfiler: Replaced I2C with I²C --- diff --git a/decoders/i2cfilter/__init__.py b/decoders/i2cfilter/__init__.py index 97572bf..31c3c6b 100644 --- a/decoders/i2cfilter/__init__.py +++ b/decoders/i2cfilter/__init__.py @@ -18,20 +18,20 @@ ## ''' -Generic I2C filtering protocol decoder. +Generic I²C filtering protocol decoder. -Takes input from the I2C protocol decoder and removes all traffic +Takes input from the I²C protocol decoder and removes all traffic except that from/to the specified slave address and/or direction. It then outputs the filtered data again as OUTPUT_PROTO of type/format 'i2c' (up the protocol decoder stack). No annotations are output. -The I2C slave address to filter out should be passed in as an option +The I²C slave address to filter out should be passed in as an option 'address', as an integer. A specific read or write operation can be selected with the 'direction' option, which should be 'read', 'write', or 'both'. Both of these are optional; if no options are specified the entire payload -of the I2C session will be output. +of the I²C session will be output. ''' from .pd import * diff --git a/decoders/i2cfilter/pd.py b/decoders/i2cfilter/pd.py index 664bbcd..009ab87 100644 --- a/decoders/i2cfilter/pd.py +++ b/decoders/i2cfilter/pd.py @@ -18,7 +18,7 @@ ## along with this program; if not, see . ## -# Generic I2C filtering protocol decoder +# Generic I²C filtering protocol decoder # TODO: Support for filtering out multiple slave/direction pairs? @@ -27,16 +27,16 @@ import sigrokdecode as srd class Decoder(srd.Decoder): api_version = 1 id = 'i2cfilter' - name = 'I2C filter' - longname = 'I2C filter' - desc = 'Filter out addresses/directions in an I2C stream.' + name = 'I²C filter' + longname = 'I²C filter' + desc = 'Filter out addresses/directions in an I²C stream.' license = 'gplv3+' inputs = ['i2c'] outputs = ['i2c'] probes = [] optional_probes = [] options = { - 'address': ['Address to filter out of the I2C stream', 0], + 'address': ['Address to filter out of the I²C stream', 0], 'direction': ['Direction to filter (read/write/both)', 'both'] } annotations = [] @@ -45,7 +45,7 @@ class Decoder(srd.Decoder): self.state = None self.curslave = -1 self.curdirection = None - self.packets = [] # Local cache of I2C packets + self.packets = [] # Local cache of I²C packets def start(self): self.out_proto = self.register(srd.OUTPUT_PYTHON, proto_id='i2c') @@ -54,17 +54,17 @@ class Decoder(srd.Decoder): if self.options['direction'] not in ('both', 'read', 'write'): raise Exception('Invalid direction (valid: read/write/both).') - # Grab I2C packets into a local cache, until an I2C STOP condition + # Grab I²C packets into a local cache, until an I²C STOP condition # packet comes along. At some point before that STOP condition, there # will have been an ADDRESS READ or ADDRESS WRITE which contains the - # I2C address of the slave that the master wants to talk to. + # I²C address of the slave that the master wants to talk to. # If that slave shall be filtered, output the cache (all packets from # START to STOP) as proto 'i2c', otherwise drop it. def decode(self, ss, es, data): cmd, databyte = data - # Add the I2C packet to our local cache. + # Add the I²C packet to our local cache. self.packets.append([ss, es, data]) if cmd in ('ADDRESS READ', 'ADDRESS WRITE'): @@ -86,11 +86,11 @@ class Decoder(srd.Decoder): return # TODO: START->STOP chunks with both read and write (Repeat START) - # Otherwise, send out the whole chunk of I2C packets. + # Otherwise, send out the whole chunk of I²C packets. for p in self.packets: self.put(p[0], p[1], self.out_proto, p[2]) self.packets = [] else: - pass # Do nothing, only add the I2C packet to our cache. + pass # Do nothing, only add the I²C packet to our cache.