]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/nunchuk/nunchuk.py
srd: I2C: change format to have ACK/NACK bits as separate events
[libsigrokdecode.git] / decoders / nunchuk / nunchuk.py
index 3308bef392095500bd064045205ec170486d5240..0e5e7420843745311e7c86a482e6188b42845cab 100644 (file)
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#
-# Nintendo Wii Nunchuk decoder
-#
-
-#
-# TODO: Description
-#
-# http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck
-# http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/
-# https://www.sparkfun.com/products/9281
-#
+# Nintendo Wii Nunchuk protocol decoder
 
 import sigrokdecode as srd
 
@@ -49,10 +39,11 @@ class Decoder(srd.Decoder):
     license = 'gplv2+'
     inputs = ['i2c']
     outputs = ['nunchuck']
-    probes = [] # TODO
+    probes = []
+    optional_probes = [] # TODO
     options = {}
     annotations = [
-        ['TODO', 'TODO'], 
+        ['TODO', 'TODO'],
     ]
 
     def __init__(self, **kwargs):
@@ -69,7 +60,7 @@ class Decoder(srd.Decoder):
 
     def decode(self, ss, es, data):
 
-        cmd, databyte, ack_bit = data
+        cmd, databyte = data
 
         if cmd == 'START': # TODO: Handle 'Sr' here, too?
             self.state = START
@@ -130,7 +121,7 @@ class Decoder(srd.Decoder):
             if self.state == IDLE:
                 self.state = INITIALIZED
             return
-    
+
             if databyte == 0x40 and self.state == START:
                 self.state = INIT
             elif databyte == 0x00 and self.state == INIT: