Added expansion detection from fWiine

Added gyro rate calculations & calibrations from WiiC

Conflicts:

	src/events.c
	src/io.c
	src/motion_plus.c
	src/wiiuse_internal.h
This commit is contained in:
Jan Ciger
2011-09-14 09:12:33 -05:00
committed by Ryan Pavlik
parent 80e8fa37ac
commit 9ae7f37396
4 changed files with 149 additions and 47 deletions

View File

@@ -35,6 +35,23 @@
#include <stdlib.h> /* for free, malloc */
static void wiiuse_disable_motion_plus2(struct wiimote_t *wm,byte *data,unsigned short len)
{
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_FAILED);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE);
wiiuse_set_ir_mode(wm);
wm->handshake_state++;
wiiuse_handshake(wm, NULL, 0);
}
static void wiiuse_disable_motion_plus1(struct wiimote_t *wm,byte *data,unsigned short len)
{
byte val = 0x00;
wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus2);
}
/**
* @brief Get initialization data from the wiimote.
*
@@ -91,11 +108,16 @@ void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len) {
accel->cal_zero.x, accel->cal_zero.y, accel->cal_zero.z,
accel->cal_g.x, accel->cal_g.y, accel->cal_g.z);
/*wiiuse_set_motion_plus(wm, 0);*/
wiiuse_status(wm);
/* M+ off */
byte val = 0x55;
wiiuse_write_data_cb(wm, WM_EXP_MEM_ENABLE1, &val, 1, wiiuse_disable_motion_plus1);
break;
}
case 2:
{
/* request the status of the wiimote to check for any expansion */
wiiuse_status(wm);
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE);
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE);
wm->handshake_state++;