Connect to a Wii Motion Plus (compatible) unit with no pass through or other controllers connected. The Motion Plus is a 3-axis gyroscope add-on w/Invensense IDG655 & IXZ650 MEMS gyros communicating via I2C @ 100KHz clock (some may do 400KHz)
Diff: WiiMP.c
- Revision:
- 1:727906cb5051
- Parent:
- 0:506079387c48
diff -r 506079387c48 -r 727906cb5051 WiiMP.c --- a/WiiMP.c Mon Mar 14 22:39:59 2011 +0000 +++ b/WiiMP.c Mon Mar 14 23:43:50 2011 +0000 @@ -21,7 +21,6 @@ bool WiiMP::Read(int* Yaw,int* Roll,int* Pitch) { - int i; char readBuf[WIIMP_READLEN]; if (Error) { @@ -34,10 +33,7 @@ if (_i2c.read(WIIEXT_ADDR, readBuf, sizeof(readBuf)) == I2C_ACK) { //init values *Yaw = 0; *Roll = 0; *Pitch = 0; - - for (i = 0; i < WIIMP_READLEN; ++i) { - readBuf[i] = (readBuf[i] ^ 0x17) + 0x17; - } + *Yaw = ((readBuf[YawH] >> 2) << 8) + readBuf[YawL]; *Roll = ((readBuf[RollH] >> 2) << 8) + readBuf[RollL]; *Pitch = ((readBuf[PitchH] >> 2) << 8) + readBuf[PitchL];