Line 6:
Line 6:
== Nunchuk ==
== Nunchuk ==
−
[[Image:Wii Remote Dissection-60.jpg|200px|thumb|right|Wii nunchuk]] The Nunchuk is identified by the 16-bit constant 0x0000 (0xFEFE encrypted) at register address 0xa400fe. It provides three-axis acceleration data, two digital buttons, and an X-Y analog stick.
+
[[File:Wii Remote Dissection-60.jpg|200px|thumb|right|Wii nunchuk]] The Nunchuk is identified by the 16-bit constant 0x0000 (0xFEFE encrypted) at register address 0xa400fe. It provides three-axis acceleration data, two digital buttons, and an X-Y analog stick.
=== Data Format (Nunchuk) ===
=== Data Format (Nunchuk) ===
The Nunchuk reports its information as 6 bytes of data, readable at 0xa40008 and streamable using Data Reporting Modes that include Extension bytes (unused bytes are filled with 0x00). The data is packed into the six bytes as follows ('''after decryption'''):
The Nunchuk reports its information as 6 bytes of data, readable at 0xa40008 and streamable using Data Reporting Modes that include Extension bytes (unused bytes are filled with 0x00). The data is packed into the six bytes as follows ('''after decryption'''):
Line 53:
Line 53:
=== Hardware (Nunchuk) ===
=== Hardware (Nunchuk) ===
−
[[Image:Wii-Nunchuk-top.jpg|200px|thumb|right|Wii nunchuk circuit board, top surface]][[Image:Wii-Nunchuk-bottom.jpg|200px|thumb|right|Wii nunchuk circuit board, bottom surface]]The official Nintendo wired nunchuk appears to be electrically much simpler than the other controller extensions. It has a single joystick comprised of a 30KΩ potentiometer per axis, two switches, an accelerometer chip, and a microcontroller.
+
[[File:Wii-Nunchuk-top.jpg|200px|thumb|right|Wii nunchuk circuit board, top surface]][[File:Wii-Nunchuk-bottom.jpg|200px|thumb|right|Wii nunchuk circuit board, bottom surface]]The official Nintendo wired nunchuk appears to be electrically much simpler than the other controller extensions. It has a single joystick comprised of a 30KΩ potentiometer per axis, two switches, an accelerometer chip, and a microcontroller.
{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 212:
Line 212:
=== Hardware (Classic Controller) ===
=== Hardware (Classic Controller) ===
−
[[Image:Wii Remote Classic Controller top.jpg|200px|thumb|right|Wii Classic Controller circuit board, top surface]][[Image:Wii_Remote_Classic_Controller_bottom.jpg|200px|thumb|right|Wii Classic Controller circuit board, bottom surface]]The classic controller uses several different hardware parts for its various inputs.
+
[[File:Wii Remote Classic Controller top.jpg|200px|thumb|right|Wii Classic Controller circuit board, top surface]][[File:Wii_Remote_Classic_Controller_bottom.jpg|200px|thumb|right|Wii Classic Controller circuit board, bottom surface]]The classic controller uses several different hardware parts for its various inputs.
{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 400:
Line 400:
| style="border: 1px solid #ccc; padding: 0.2em;" | '''B'''<span style="color: #c00;">U</span>
| style="border: 1px solid #ccc; padding: 0.2em;" | '''B'''<span style="color: #c00;">U</span>
|}
|}
−
SX,SY are the Analog Stick X and Y positions. BG,BR,BY,BB,BO are the fret buttons by color (Green, Red, Yellow, Blue, Orange). B-,B+ are the + and - buttons at the base of the controller, on the GHWT Guitars the B- is the StarPower button. BU and BD are up and down on the strum bar, respectively. WB is the analog whammy bar. Bits marked GH3 seem to be 1 on GH3 Gibson Les Paul Guitars and 0 on GHWT Guitars.
+
SX,SY are the Analog Stick X and Y positions. BG,BR,BY,BB,BO are the fret buttons by color (Green, Red, Yellow, Blue, Orange). B-,B+ are the + and - buttons at the base of the controller, on the GHWT Guitars the B- is the StarPower button. BU and BD are up and down on the strum bar, respectively. WB is the analog whammy bar. Bits marked GH3 seem to be 1 on GH3 Gibson Les Paul Guitars and 0 on GHWT Guitars.
TB is the analog touchbar found on the neck of the Guitar Hero World Tour Guitars, which does not exist on Guitar Hero 3 Guitars.
TB is the analog touchbar found on the neck of the Guitar Hero World Tour Guitars, which does not exist on Guitar Hero 3 Guitars.
Line 515:
Line 515:
The Wii Motion Plus starts off at register 0xA60000 instead of register 0xA40000, because it has its own extension port on the back allowing a Nunchuk for example to be plugged in along with the Wii Motion Plus. BUT it changes to 0xA40000 once it is activated by writing 04 to 0xa600fe.
The Wii Motion Plus starts off at register 0xA60000 instead of register 0xA40000, because it has its own extension port on the back allowing a Nunchuk for example to be plugged in along with the Wii Motion Plus. BUT it changes to 0xA40000 once it is activated by writing 04 to 0xa600fe.
−
The Wii Motion Plus is first identified by the 6 bytes: 00 00 A6 20 00 05 at register address 0x(4)a600fa (instead of 0x(4)a400fa like a regular extension). Games attempt to detect the Wii Motion Plus by trying to read the two-byte expansion identifier at 0xA600FE (they try up to 3 times, then wait 8 seconds, then check again). If a Wii Motion Plus is not present, or it has already been activated, then the attempt to read those bytes will fail with error 7.
+
The Wii Motion Plus is first identified by the 6 bytes: 00 00 A6 20 00 05 at register address 0x(4)a600fa (instead of 0x(4)a400fa like a regular extension). Games attempt to detect the Wii Motion Plus by trying to read the two-byte expansion identifier at 0xA600FE (they try up to 3 times, then wait 8 seconds, then check again). If a Wii Motion Plus is not present, or it has already been activated, then the attempt to read those bytes will fail with error 7.
The extension is initialised by writing 0x55 to 0x(4)a600f0. But there is no need to write 00 to 0x(4)a500fb, since Wii games don't do that. While the Motion Plus is initialising, the value at 0x(4)a600f7 changes from 0x02 to 0x04 to 0x08 to 0x0C to 0x0E then stays at 0x0E. There is no need to read this byte, since games don't. While initialising, the 128 bytes from 0x(4)a60050 - 0x(4)a600cf also change briefly, but randomly, after the extension is initialized. More examples of this data block changing over time can be found here: [https://docs.google.com/Doc?id=dds4pks_606fmcd6zwt&hl=en Three Data Samples from Wii Motion Plus (Google Doc)]
The extension is initialised by writing 0x55 to 0x(4)a600f0. But there is no need to write 00 to 0x(4)a500fb, since Wii games don't do that. While the Motion Plus is initialising, the value at 0x(4)a600f7 changes from 0x02 to 0x04 to 0x08 to 0x0C to 0x0E then stays at 0x0E. There is no need to read this byte, since games don't. While initialising, the 128 bytes from 0x(4)a60050 - 0x(4)a600cf also change briefly, but randomly, after the extension is initialized. More examples of this data block changing over time can be found here: [https://docs.google.com/Doc?id=dds4pks_606fmcd6zwt&hl=en Three Data Samples from Wii Motion Plus (Google Doc)]
−
It appears that the 32 bytes from 0x(4)a60020 are, as usual, calibration information, but it is unknown how they work.
+
It appears that the 32 bytes from 0x(4)a60020 are, as usual, calibration information, but it is unknown how they work.
−
Writing 0x04 to 0x(4)A600FE activates the MotionPlus as the "active" extension. This does 3 things (with no additional initialization):
+
Writing 0x04 to 0x(4)A600FE activates the MotionPlus as the "active" extension. This does 3 things (with no additional initialization):
* A status report (0x20) will automatically be sent indicating that a normal extension has been plugged in, if and only if there was no extension plugged into the MotionPlus pass-through extension port.
* A status report (0x20) will automatically be sent indicating that a normal extension has been plugged in, if and only if there was no extension plugged into the MotionPlus pass-through extension port.
* The standard extension identifier at 0x(4)A400FA now reads 00 00 A4 20 04 05
* The standard extension identifier at 0x(4)A400FA now reads 00 00 A4 20 04 05
Line 605:
Line 605:
=== Information ===
=== Information ===
−
When not activated, the MotionPlus is detected by regular polling (every 8 seconds or so) of 0x(4)a600fe. Writing 0x55 to 0x4A400F0, then 0x00 to 0x4A400FB (standard extension init, works fine even with no extension) re-activates the standard extension, if any, plugged into the MotionPlus pass-through port. The development version of the CWiid driver currently implements this method (without automatic 8 second checks) on the motionplus branch: http://abstrakraft.org/cwiid/browser/branches/motionplus/. Additional information on MotionPlus workings and implementation requirements are at http://abstrakraft.org/cwiid/wiki/MotionPlus.
+
When not activated, the MotionPlus is detected by regular polling (every 8 seconds or so) of 0x(4)a600fe. Writing 0x55 to 0x4A400F0, then 0x00 to 0x4A400FB (standard extension init, works fine even with no extension) re-activates the standard extension, if any, plugged into the MotionPlus pass-through port. The development version of the CWiid driver currently implements this method (without automatic 8 second checks) on the motionplus branch: http://abstrakraft.org/cwiid/browser/branches/motionplus/. Additional information on MotionPlus workings and implementation requirements are at http://abstrakraft.org/cwiid/wiki/MotionPlus.
−
The combination of 3 linear accelerations with 3 angular rates allows what Nintendo refers to as 1:1 motion tracking, which is another way of saying 6DOF (degrees of freedom) over a short time. It's only valid over short times because of the integration involved to convert accelerations and rates into positions (input errors, when integrated, blow up over time).
+
The combination of 3 linear accelerations with 3 angular rates allows what Nintendo refers to as 1:1 motion tracking, which is another way of saying 6DOF (degrees of freedom) over a short time. It's only valid over short times because of the integration involved to convert accelerations and rates into positions (input errors, when integrated, blow up over time).
In addition to providing yaw, the gyros also allow the software to tell the difference between orientation and acceleration, which are difficult to tell apart from the accelerometers which measure a mixture of both.
In addition to providing yaw, the gyros also allow the software to tell the difference between orientation and acceleration, which are difficult to tell apart from the accelerometers which measure a mixture of both.