X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fnunchuk%2Fnunchuk.py;h=0e5e7420843745311e7c86a482e6188b42845cab;hp=46bf53cf85ff43753d830e387f2f73e7e1ec0775;hb=1b75abfdd3e00ef590c9d1905863f6f2cb5a8632;hpb=64c29e28e0efa184319f7831b3eca18c7f73f7d0 diff --git a/decoders/nunchuk/nunchuk.py b/decoders/nunchuk/nunchuk.py index 46bf53c..0e5e742 100644 --- a/decoders/nunchuk/nunchuk.py +++ b/decoders/nunchuk/nunchuk.py @@ -18,17 +18,7 @@ ## 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 @@ -40,6 +30,7 @@ INIT = 3 INITIALIZED = 4 class Decoder(srd.Decoder): + api_version = 1 id = 'nunchuk' name = 'Nunchuk' longname = 'Nintendo Wii Nunchuk' @@ -48,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): @@ -68,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 @@ -129,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: