diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2010-04-24 01:04:20 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2010-04-24 01:04:20 +0200 |
commit | 5c55017c401002c18b1d43dad61200df17ab3321 (patch) | |
tree | 95700d32f0666f0817d78fa6b7aae5e5d04f6d80 /scripts/transitioncounter.py | |
parent | 31b82285e5ca1fbd6a33eaaaa95bf83862b69eb1 (diff) | |
download | libsigrokdecode-5c55017c401002c18b1d43dad61200df17ab3321.tar.gz libsigrokdecode-5c55017c401002c18b1d43dad61200df17ab3321.zip |
Various Python decoder infrastructure improvements.
- Introduce 'struct sigrokdecode_decoder'.
- Decoders are now handled via two C functions:
- sigrokdecode_load_decoder(): Fills a 'struct sigrokdecode_decoder'.
- sigrokdecode_run_decoder(): Runs a decoder function.
- There are now two decoder API functions a script needs to implement:
- register(): Returns a Python dict with certain metadata.
- decode(): Runs the actual decoder code.
- libsigrokdecode: Add and use some more #defines for errors:
- SIGROKDECODE_ERR_ARGS
- SIGROKDECODE_ERR_PYTHON
- Various other smaller Python decode script infrastructure issues.
Diffstat (limited to 'scripts/transitioncounter.py')
-rw-r--r-- | scripts/transitioncounter.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/transitioncounter.py b/scripts/transitioncounter.py index a9e83f7..4064d2f 100644 --- a/scripts/transitioncounter.py +++ b/scripts/transitioncounter.py @@ -18,7 +18,7 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -def sigrokdecode_count_transitions(inbuf): +def decode(inbuf): """Counts the low->high and high->low transitions in the specified channel(s) of the signal.""" @@ -81,8 +81,8 @@ def register(): return { 'id': 'transitioncounter', 'name': 'Transition counter', - 'description': 'TODO', - 'function': 'sigrokdecode_count_transitions', + 'desc': 'TODO', + 'func': 'decode', 'inputformats': ['raw'], 'signalnames': {}, # FIXME 'outputformats': ['transitioncounts'], @@ -91,7 +91,7 @@ def register(): # Use psyco (if available) as it results in huge performance improvements. try: import psyco - psyco.bind(sigrokdecode_count_transitions) + psyco.bind(decode) except ImportError: pass |