X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Ftransitioncounter.py;h=46b5ac43f278d34f31c6cfccffcae49fffec52be;hp=d9956c78fb6ea4eb45e5eb559ec082eedab8352a;hb=e9de9c90da6bd8c6a2314fb68f37cefc0a480926;hpb=e100d51ec0909db8f93c837ea1fd92a08461b781 diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py index d9956c7..46b5ac4 100644 --- a/decoders/transitioncounter.py +++ b/decoders/transitioncounter.py @@ -18,6 +18,8 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## +import sigrok + class Sample(): def __init__(self, data): self.data = data @@ -29,7 +31,8 @@ def sampleiter(data, unitsize): for i in range(0, len(data), unitsize): yield(Sample(data[i:i+unitsize])) -class Decoder(): +class Decoder(sigrok.Decoder): + id = 'transitioncounter' name = 'Transition counter' longname = '...' desc = 'Counts rising/falling edges in the signal.' @@ -105,14 +108,5 @@ class Decoder(): outdata = [] for i in range(self.channels): outdata += [[self.transitions[i], self.rising[i], self.falling[i]]] - sigrok.put(outdata) - -# Use psyco (if available) as it results in huge performance improvements. -try: - import psyco - psyco.bind(decode) -except ImportError: - pass - -import sigrok + self.put(outdata)