X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fi2cfilter%2Fpd.py;h=91269c0862b186b7dc07c6960a328d84b355aab1;hb=84c1c0b52820af2418186ac3ecf93a5c6373a22e;hp=70613d24e909a627907ba53b8f901487c0ac5bfc;hpb=ef36224880135a05d2fbde8f048ea3fe3f425df9;p=libsigrokdecode.git diff --git a/decoders/i2cfilter/pd.py b/decoders/i2cfilter/pd.py index 70613d2..91269c0 100644 --- a/decoders/i2cfilter/pd.py +++ b/decoders/i2cfilter/pd.py @@ -33,10 +33,12 @@ class Decoder(srd.Decoder): outputs = ['i2c'] probes = [] optional_probes = [] - options = { - 'address': ['Address to filter out of the I²C stream', 0], - 'direction': ['Direction to filter (read/write/both)', 'both'] - } + options = ( + {'id': 'address', 'desc': 'Address to filter out of the I²C stream', + 'default': 0}, + {'id': 'direction', 'desc': 'Direction to filter', 'default': 'both', + 'values': ('read', 'write', 'both')} + ) annotations = [] def __init__(self, **kwargs): @@ -46,7 +48,7 @@ class Decoder(srd.Decoder): self.packets = [] # Local cache of I²C packets def start(self): - self.out_proto = self.register(srd.OUTPUT_PYTHON, proto_id='i2c') + self.out_python = self.register(srd.OUTPUT_PYTHON, proto_id='i2c') if self.options['address'] not in range(0, 127 + 1): raise Exception('Invalid slave (must be 0..127).') if self.options['direction'] not in ('both', 'read', 'write'): @@ -86,7 +88,7 @@ class Decoder(srd.Decoder): # TODO: START->STOP chunks with both read and write (Repeat START) # 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.put(p[0], p[1], self.out_python, p[2]) self.packets = [] else: