X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Ftransitioncounter.py;h=8cb32bb772029507ec8e721f3bf3622e61843dd5;hb=876f83fd3396ce581e700741e58414c2f4f6277e;hp=2847abc345cafb50af27b0f86183750ba9a97c5b;hpb=2fd89a85c4a1131ca259d794a43b26b8bd84b6a0;p=libsigrokdecode.git diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py index 2847abc..8cb32bb 100644 --- a/decoders/transitioncounter.py +++ b/decoders/transitioncounter.py @@ -18,12 +18,12 @@ ## 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 = '...' + longname = 'Pin transition counter' desc = 'Counts rising/falling edges in the signal.' longdesc = '...' author = 'Uwe Hermann' @@ -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)]])