CTL_STATUS_t wii_nunchuk_sample(CTL_I2C_BUS_t *bus,
                                WII_NUNCHUK_REPORT_t *report);

wii_nunchuk_sample samples the 3-axis accelerometer, 2-axis analog joystick, and the two buttons on the nunchuk controller. All data are returned as raw values directly from the received report. Accelerometer readings are 10 bits, 0 through 3FF; joystick readings are eight bits, 0 through FF, and button states are non-zero if the corresponding button is pressed.

Return Value

wii_nunchuk_sample returns a standard status code. If the status indicates an error, the returned sample data is undefined.

Thread Safety

wii_nunchuk_sample is thread-safe if a mutex is associated with the I2C bus bus.