Submitted by evilBunny (not verified) on Sun, 2008-01-13 23:31.
little optimization of the print() function would be something like this :
int joy_x_axis = outbuf[0];
int joy_y_axis = outbuf[1];
int accel_x_axis = (outbuf[2] << 2) + ((outbuf[5] >> 2) & 0x03);
int accel_y_axis = (outbuf[3] << 2) + ((outbuf[5] >> 4) & 0x03);
int accel_z_axis = (outbuf[4] << 2) + ((outbuf[5] >> 6) & 0x03);
int z_button = outbuf[5] & 1;
int c_button = outbuf[5] & 2;
geting a nunchuck tomorrow and write some plain avrlibc examples :D
little rework on the print function ^^
little optimization of the print() function would be something like this :
int joy_x_axis = outbuf[0];
int joy_y_axis = outbuf[1];
int accel_x_axis = (outbuf[2] << 2) + ((outbuf[5] >> 2) & 0x03);
int accel_y_axis = (outbuf[3] << 2) + ((outbuf[5] >> 4) & 0x03);
int accel_z_axis = (outbuf[4] << 2) + ((outbuf[5] >> 6) & 0x03);
int z_button = outbuf[5] & 1;
int c_button = outbuf[5] & 2;
geting a nunchuck tomorrow and write some plain avrlibc examples :D