Close

Library refactor done.

A project log for WiiChuck

A Wii controller library for talking to every Extension Controller made for the wii including Nunchuck and Classic Controller over i2c.

alex-camiloAlex Camilo 02/16/2017 at 21:170 Comments

Library refactor is done. I think the interface is pretty clean and it's done under the hood using classes for each axis and virtual functions so I can get rid of the mapping struct my old version used.

This is what the old map looked like.

generic.addAnalogMap(
    UNUSED,0,0,        // MSB (Unused)
    UNUSED,0,0,        // CSB (Unused)
    BYTE1,BIT0,BIT7,   // LSB (7:0 bits of data in byte 1 of controller data)
    0,127,255,          // min, middle, max
    0,255,127,         // servo min, max, zero PWM values
    D6);                // Channel

Here is the new map.

myChuck.addMap(new Nunchuck::joyX(D5,200,125,50)); // chan smax szero smin

you can also statically declare the maps and pass em in that way.

Discussions