X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Ftransitioncounter.py;h=ded3a3d1c8361acb6f9b9e3a8066e8e0920e150c;hb=a10bfc48b04de832a62a474b34b23f8f24662e9a;hp=2847abc345cafb50af27b0f86183750ba9a97c5b;hpb=2fd89a85c4a1131ca259d794a43b26b8bd84b6a0;p=libsigrokdecode.git diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py index 2847abc..ded3a3d 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,24 @@ class Decoder(sigrokdecode.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['transitioncounts'] - probes = [ - ] # TODO? + probes = [] options = {} + annotations = [ + ['TODO', 'TODO'], + ] 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.add(2) - self.output_annotation = self.add(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 +97,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, [0, [str(outdata)]])