summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2012-01-03 19:30:17 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2012-01-03 19:33:59 +0100
commitf6555179b242357f9c75b1f6178537de2001cd98 (patch)
treebc0150cb25dfb3bd2d55c2d4ed04f84b622d3d89
parentf90fe506f8480047a3ba23a2bc99066fa2d208f0 (diff)
downloadlibsigrokdecode-f6555179b242357f9c75b1f6178537de2001cd98.tar.gz
libsigrokdecode-f6555179b242357f9c75b1f6178537de2001cd98.zip
srd: Quick hack to make nunchuk.py work again.
-rw-r--r--decoders/nunchuk.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/decoders/nunchuk.py b/decoders/nunchuk.py
index 635a714..fbc03d4 100644
--- a/decoders/nunchuk.py
+++ b/decoders/nunchuk.py
@@ -66,7 +66,7 @@ class Sample():
def __init__(self, data):
self.data = data
def probe(self, probe):
- s = ord(self.data[probe / 8]) & (1 << (probe % 8))
+ s = ord(self.data[int(probe / 8)]) & (1 << (probe % 8))
return True if s else False
def sampleiter(data, unitsize):
@@ -89,6 +89,8 @@ class Decoder(sigrok.Decoder):
def __init__(self, **kwargs):
self.probes = Decoder.probes.copy()
+ self.output_protocol = None
+ self.output_annotation = None
# TODO: Don't hardcode the number of channels.
self.channels = 8
@@ -101,11 +103,13 @@ class Decoder(sigrok.Decoder):
def start(self, metadata):
self.unitsize = metadata['unitsize']
+ # self.output_protocol = self.output_new(2)
+ self.output_annotation = self.output_new(1)
def report(self):
pass
- def decode(self, data):
+ def decode(self, timeoffset, duration, data):
"""Nintendo Wii Nunchuk decoder"""
out = []
@@ -186,5 +190,7 @@ class Decoder(sigrok.Decoder):
self.state = INITIALIZED
self.databytecount = 0
- self.put(out)
+ if out != []:
+ # self.put(self.output_protocol, 0, 0, out_proto)
+ self.put(self.output_annotation, 0, 0, out)