From 84c1c0b52820af2418186ac3ecf93a5c6373a22e Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Sun, 9 Mar 2014 23:48:27 +0100 Subject: Change PD options to be a tuple of dictionaries. Each option consists of a dictionary with the following keys: id The option id, which is passed in when setting a value. desc A description of the option, suitable for display. def The default value for this option. values (optional) If present, a tuple containing values the option may take. They must be of the same type as the default. Valid types for the options are UTF-8-encoded strings, integers, and floating point values. --- decoders/i2cfilter/pd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'decoders/i2cfilter') diff --git a/decoders/i2cfilter/pd.py b/decoders/i2cfilter/pd.py index 09c12f1..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): -- cgit v1.2.3-70-g09d2