X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fnunchuk.py;h=009459db861d09736f516fa9c00ba057263828fa;hb=677d597b072c0a1d2df81c5c193cd3678aef8d03;hp=6cd30895c3e38a273c1d32709e18d9757fd24e41;hpb=1f24514c0e276d2844657925e4e423be5297cd2a;p=libsigrokdecode.git diff --git a/decoders/nunchuk.py b/decoders/nunchuk.py index 6cd3089..009459d 100644 --- a/decoders/nunchuk.py +++ b/decoders/nunchuk.py @@ -30,7 +30,7 @@ # https://www.sparkfun.com/products/9281 # -import sigrokdecode +import sigrokdecode as srd # States IDLE = 0 @@ -62,7 +62,7 @@ example_packets = [ {'type': 'P', 'range': (32, 33), 'data': None, 'ann': ''}, ] -class Decoder(sigrokdecode.Decoder): +class Decoder(srd.Decoder): id = 'nunchuk' name = 'Nunchuk' longname = 'Nintendo Wii Nunchuk decoder' @@ -77,8 +77,8 @@ class Decoder(sigrokdecode.Decoder): options = {} def __init__(self, **kwargs): - self.output_protocol = None - self.output_annotation = None + self.out_proto = None + self.out_ann = None self.state = IDLE # TODO: Can we assume a certain initial state? @@ -87,8 +87,8 @@ class Decoder(sigrokdecode.Decoder): self.databytecount = 0 def start(self, metadata): - # self.output_protocol = self.output_new(2) - self.output_annotation = self.output_new(1) + # self.out_proto = self.add(srd.SRD_OUTPUT_PROTO, 'nunchuk') + self.out_ann = self.add(srd.SRD_OUTPUT_ANN, 'nunchuk') def report(self): pass @@ -172,6 +172,6 @@ class Decoder(sigrokdecode.Decoder): self.databytecount = 0 if out != []: - # self.put(0, 0, self.output_protocol, out_proto) - self.put(0, 0, self.output_annotation, out) + # self.put(0, 0, self.out_proto, out_proto) + self.put(0, 0, self.out_ann, out)