## 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'
- email = 'uwe@hermann-uwe.de'
license = 'gplv2+'
inputs = ['logic']
outputs = ['transitioncounts']
- probes = [
- ] # TODO?
+ probes = []
options = {}
+ annotations = [
+ ['TODO', 'TODO'],
+ ]
def __init__(self, **kwargs):
- self.out_proto = None
- self.out_ann = None
self.channels = -1
self.lastsample = None
def start(self, metadata):
- # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'transitioncounter')
- self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'transitioncounter')
+ # 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:
if outdata != []:
# self.put(0, 0, self.out_proto, out_proto)
- self.put(0, 0, self.out_ann, outdata)
+ self.put(0, 0, self.out_ann, [0, [str(outdata)]])