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/onewire_link/pd.py | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'decoders/onewire_link/pd.py') diff --git a/decoders/onewire_link/pd.py b/decoders/onewire_link/pd.py index 5b5ebd0..38ef8cc 100644 --- a/decoders/onewire_link/pd.py +++ b/decoders/onewire_link/pd.py @@ -35,19 +35,36 @@ class Decoder(srd.Decoder): optional_probes = [ {'id': 'pwr', 'name': 'PWR', 'desc': '1-Wire power supply pin'}, ] - options = { - 'overdrive': ['Overdrive mode', 'no'], + options = ( + {'id': 'overdrive', + 'desc': 'Overdrive mode', + 'default': 'no'}, # Time options (specified in microseconds): - 'cnt_normal_bit': ['Normal mode sample bit time (µs)', 15], - 'cnt_normal_slot': ['Normal mode data slot time (µs)', 60], - 'cnt_normal_presence': ['Normal mode sample presence time (µs)', 75], - 'cnt_normal_reset': ['Normal mode reset time (µs)', 480], - 'cnt_overdrive_bit': ['Overdrive mode sample bit time (µs)', 2], - # 'cnt_overdrive_slot': ['Overdrive mode data slot time (µs)', 7.3], - 'cnt_overdrive_slot': ['Overdrive mode data slot time (µs)', 7], - 'cnt_overdrive_presence': ['Overdrive mode sample presence time (µs)', 10], - 'cnt_overdrive_reset': ['Overdrive mode reset time (µs)', 48], - } + {'id': 'cnt_normal_bit', + 'desc': 'Normal mode sample bit time (μs)', + 'default': 15}, + {'id': 'cnt_normal_slot', + 'desc': 'Normal mode data slot time (μs)', + 'default': 60}, + {'id': 'cnt_normal_presence', + 'desc': 'Normal mode sample presence time (μs)', + 'default': 75}, + {'id': 'cnt_normal_reset', + 'desc': 'Normal mode reset time (μs)', + 'default': 480}, + {'id': 'cnt_overdrive_bit', + 'desc': 'Overdrive mode sample bit time (μs)', + 'default': 2}, + {'id': 'cnt_overdrive_slot', + 'desc': 'Overdrive mode data slot time (μs)', + 'default': 7.3}, + {'id': 'cnt_overdrive_presence', + 'desc': 'Overdrive mode sample presence time (μs)', + 'default': 10}, + {'id': 'cnt_overdrive_reset', + 'desc': 'Overdrive mode reset time (μs)', + 'default': 48}, + ) annotations = [ ['bit', 'Bit'], ['warnings', 'Warnings'], -- cgit v1.2.3-70-g09d2