summaryrefslogtreecommitdiff
path: root/decoders/counter/pd.py
AgeCommit message (Collapse)Author
2018-05-30counter: Drop unneeded tuple braces.Uwe Hermann
(minor readability / consistency improvement)
2018-05-30counter: emit wider annotations for data and word countsGerhard Sittig
Track the start of a data or word cycle. Avoid narrow ss=es annotations which may be tedious to inspect by users in GUI applications. This resolves the issue initially reported in bug #1210.
2018-05-30counter: prepare for variable width annotationsGerhard Sittig
Explicitly pass a start sample number to the .putc() method, to prepare annotations where ss differs from es. This is motivated by bug #1210. Stick with the narrow ss=es annotations for backwards compatibility.
2018-05-29counter: explicit string formatting for annotation textGerhard Sittig
Replace str() conversion with explicit number text formatting, for improved awareness and easier future adjustment during maintenance.
2018-05-29counter: use local variables instead of instance variablesGerhard Sittig
Since values get accessed within the .decode() method exclusively, we need not store data in instance variables of the decoder object. Use another variable for the "reset edge" option as well for consistency.
2018-05-29counter: move some init code to the start of decode()Gerhard Sittig
Since PD API v3 the .decode() method is called exactly once, and contains a main loop itself. Move initialization code that sets up .decode() related logic to the start of the .decode() routine.
2018-05-29counter: use symbolic names for input pins, wait conditions, annotation rowsGerhard Sittig
Replace magic numbers by symbolic references to (fixed and optional) decoder input signals, .wait() conditions, as well as annotation rows. Move some empty lines, to better reflect which code lines form groups of similar activity ("blocks" that logically belong together).
2018-05-29counter: explicit option text to .wait() edge mappingGerhard Sittig
The previous implementation used the fact that libsigrok's internal API happens to use the first letter of the user visible English option text. Two locations mapped edge choices to API literals in different ways. Unify them, introduce an explicit option text to literal value mapping. (Many if not all decoder implementations do that. More adjustment to use common code could be beneficial.)
2018-01-03counter: make 'reset' signal polarity an optionGerhard Sittig
Allow configuration of the 'reset' signal polarity. Reset counters on either falling (default) or rising edges.
2018-01-03counter: Make "word reset" an explicit annotation class+row.Uwe Hermann
Also, add long and short annotation string versions.
2018-01-03Add a trivial "counter" decoderStefan Brüns
This decoder just counts the number of falling and/or rising edges. This is especially useful for diagnosing protocols with a clock signal or a fixed number of transitions per bit, e.g. pulse length coded. It also provides a divider, which can be used to e.g. count the number of words in I²C or SPI transfers.