X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Ftransitioncounter.py;h=2247248bee6e99c21c82c782fd46ded30d81e9ab;hb=2b9837d9fc5f9b4eca52327527e18db4bfb730ff;hp=5a6d140374eaab26363227bd41837c9142fb6ee7;hpb=f9b3b245bce5c8bf6fa63005dcc823904bba0ca8;p=libsigrokdecode.git diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py index 5a6d140..2247248 100644 --- a/decoders/transitioncounter.py +++ b/decoders/transitioncounter.py @@ -18,9 +18,9 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -import sigrokdecode +import sigrokdecode as srd -class Decoder(sigrokdecode.Decoder): +class Decoder(srd.Decoder): id = 'transitioncounter' name = 'Transition counter' longname = '...' @@ -31,24 +31,22 @@ class Decoder(sigrokdecode.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['transitioncounts'] - probes = [ - ] # TODO? + probes = [] options = {} + annotations = [] def __init__(self, **kwargs): - self.output_protocol = None - self.output_annotation = None self.channels = -1 self.lastsample = None def start(self, metadata): - # self.output_protocol = self.output_new(2) - self.output_annotation = self.output_new(1) + # self.out_proto = self.add(srd.OUTPUT_PROTO, 'transitioncounter') + self.out_ann = self.add(srd.OUTPUT_ANN, 'transitioncounter') def report(self): pass - def decode(self, timeoffset, duration, data): + def decode(self, ss, es, data): for (samplenum, s) in data: @@ -97,6 +95,6 @@ class Decoder(sigrokdecode.Decoder): outdata += [[self.transitions[i], self.rising[i], self.falling[i]]] if outdata != []: - # self.put(0, 0, self.output_protocol, out_proto) - self.put(0, 0, self.output_annotation, outdata) + # self.put(0, 0, self.out_proto, out_proto) + self.put(0, 0, self.out_ann, outdata)