summaryrefslogtreecommitdiff
path: root/scripts/transitioncounter.py
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2010-04-24 01:33:52 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2010-04-24 01:33:52 +0200
commita156f09eac00be0f6d8beaeadef77b03077ab7b1 (patch)
treea08e9a9db3c1240f5b0dcab14f1efd4ccf22fe1b /scripts/transitioncounter.py
parent87f03ae9f2bf5df0e671881b679b25feccbe2fde (diff)
downloadlibsigrokdecode-a156f09eac00be0f6d8beaeadef77b03077ab7b1.tar.gz
libsigrokdecode-a156f09eac00be0f6d8beaeadef77b03077ab7b1.zip
Various small decoder script fixes.
Diffstat (limited to 'scripts/transitioncounter.py')
-rw-r--r--scripts/transitioncounter.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/scripts/transitioncounter.py b/scripts/transitioncounter.py
index 4064d2f..a6d331e 100644
--- a/scripts/transitioncounter.py
+++ b/scripts/transitioncounter.py
@@ -35,10 +35,7 @@ def decode(inbuf):
rising = [0] * channels
falling = [0] * channels
- # print len(inbuf)
- # print type(inbuf)
-
- # Presets...
+ # Initial values.
oldbyte = inbuf[0]
for i in range(channels):
oldbit[i] = (oldbyte & (1 << i)) >> i
@@ -59,6 +56,7 @@ def decode(inbuf):
elif (oldbit[i] == 1 and curbit == 0):
falling[i] += 1
oldbit[i] = curbit
+ oldbyte = s
# Total number of transitions is the sum of rising and falling edges.
for i in range(channels):
@@ -81,8 +79,7 @@ def register():
return {
'id': 'transitioncounter',
'name': 'Transition counter',
- 'desc': 'TODO',
- 'func': 'decode',
+ 'desc': 'Count rising/falling edges',
'inputformats': ['raw'],
'signalnames': {}, # FIXME
'outputformats': ['transitioncounts'],