X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Ftransitioncounter.py;h=2ad3f528ee45ed2ef2fadc3381dab774e4823a46;hb=67e847fd2185aa5677954dceacf3c279d7a68af1;hp=1b105186116f69b859429b6e9c8fb06db109c06f;hpb=b41ae47fa350bc0b6c81f0411cc12b9741a7e4e0;p=libsigrokdecode.git diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py index 1b10518..2ad3f52 100644 --- a/decoders/transitioncounter.py +++ b/decoders/transitioncounter.py @@ -42,11 +42,7 @@ class Decoder(): probes = {} options = {} - def __init__(self, unitsize, **kwargs): - # Metadata comes in here, we don't care for now. - # print kwargs - self.unitsize = unitsize - + def __init__(self, **kwargs): self.probes = Decoder.probes.copy() # TODO: Don't hardcode the number of channels. @@ -58,6 +54,9 @@ class Decoder(): self.rising = [0] * self.channels self.falling = [0] * self.channels + def start(self, metadata): + self.unitsize = metadata['unitsize'] + def report(self): pass @@ -66,7 +65,7 @@ class Decoder(): channel(s) of the signal.""" # We should accept a list of samples and iterate... - for sample in sampleiter(data["data"], self.unitsize): + for sample in sampleiter(data['data'], self.unitsize): # TODO: Eliminate the need for ord(). s = ord(sample.data) @@ -108,12 +107,5 @@ class Decoder(): 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