23 #define DEBUG // Uncomment to print data for debugging
27 const uint8_t
LEDS[] PROGMEM = {
97 control_dcid[0] = 0x60;
98 control_dcid[1] = 0x00;
99 interrupt_dcid[0] = 0x61;
100 interrupt_dcid[1] = 0x00;
109 activateNunchuck =
false;
110 motionValuesReset =
false;
111 activeConnection =
false;
115 l2cap_event_flag = 0;
122 Notify(PSTR(
"\r\nDeactivating Motion Plus"), 0x80);
135 if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) ==
HID_CTRL_PSM) {
138 activeConnection =
true;
144 if ((l2capinbuf[0] | (l2capinbuf[1] << 8)) == (hci_handle | 0x2000)) {
145 if ((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001) {
148 Notify(PSTR(
"\r\nL2CAP Command Rejected - Reason: "), 0x80);
149 PrintHex<uint8_t > (l2capinbuf[13], 0x80);
151 PrintHex<uint8_t > (l2capinbuf[12], 0x80);
153 PrintHex<uint8_t > (l2capinbuf[17], 0x80);
155 PrintHex<uint8_t > (l2capinbuf[16], 0x80);
157 PrintHex<uint8_t > (l2capinbuf[15], 0x80);
159 PrintHex<uint8_t > (l2capinbuf[14], 0x80);
162 if (((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) && ((l2capinbuf[18] | (l2capinbuf[19] << 8)) ==
SUCCESSFUL)) {
163 if (l2capinbuf[14] == control_dcid[0] && l2capinbuf[15] == control_dcid[1]) {
165 identifier = l2capinbuf[9];
166 control_scid[0] = l2capinbuf[12];
167 control_scid[1] = l2capinbuf[13];
169 }
else if (l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
171 identifier = l2capinbuf[9];
172 interrupt_scid[0] = l2capinbuf[12];
173 interrupt_scid[1] = l2capinbuf[13];
179 Notify(PSTR(
"\r\nL2CAP Connection Request - PSM: "), 0x80);
180 PrintHex<uint8_t > (l2capinbuf[13], 0x80);
182 PrintHex<uint8_t > (l2capinbuf[12], 0x80);
183 Notify(PSTR(
" SCID: "), 0x80);
184 PrintHex<uint8_t > (l2capinbuf[15], 0x80);
186 PrintHex<uint8_t > (l2capinbuf[14], 0x80);
187 Notify(PSTR(
" Identifier: "), 0x80);
188 PrintHex<uint8_t > (l2capinbuf[9], 0x80);
190 if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) ==
HID_CTRL_PSM) {
191 identifier = l2capinbuf[9];
192 control_scid[0] = l2capinbuf[14];
193 control_scid[1] = l2capinbuf[15];
195 }
else if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) ==
HID_INTR_PSM) {
196 identifier = l2capinbuf[9];
197 interrupt_scid[0] = l2capinbuf[14];
198 interrupt_scid[1] = l2capinbuf[15];
202 if ((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) {
203 if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
205 identifier = l2capinbuf[9];
207 }
else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
209 identifier = l2capinbuf[9];
214 if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
217 }
else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
222 if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
224 Notify(PSTR(
"\r\nDisconnect Request: Control Channel"), 0x80);
226 identifier = l2capinbuf[9];
229 }
else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
231 Notify(PSTR(
"\r\nDisconnect Request: Interrupt Channel"), 0x80);
233 identifier = l2capinbuf[9];
238 if (l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
240 identifier = l2capinbuf[9];
242 }
else if (l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
244 identifier = l2capinbuf[9];
250 identifier = l2capinbuf[9];
251 Notify(PSTR(
"\r\nL2CAP Unknown Signaling Command: "), 0x80);
252 PrintHex<uint8_t > (l2capinbuf[8], 0x80);
255 }
else if (l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) {
258 if (l2capinbuf[8] == 0xA1) {
259 if ((l2capinbuf[9] >= 0x20 && l2capinbuf[9] <= 0x22) || (l2capinbuf[9] >= 0x30 && l2capinbuf[9] <= 0x37) || l2capinbuf[9] == 0x3e || l2capinbuf[9] == 0x3f) {
260 if ((l2capinbuf[9] >= 0x20 && l2capinbuf[9] <= 0x22) || l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33)
261 ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
263 ButtonState = (uint32_t)(((~l2capinbuf[23]) & 0xFE) | ((uint16_t)(~l2capinbuf[24]) << 8) | ((uint32_t)((~l2capinbuf[25]) & 0x03) << 16));
265 if (l2capinbuf[20] & 0x02)
266 ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)(ButtonState & 0xFFFF0000)));
268 ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x0C) << 14));
271 ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x03) << 16));
273 else if (!unknownExtensionConnected)
274 ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
276 Notify(PSTR(
"ButtonState: "), 0x80);
277 PrintHex<uint32_t > (ButtonState, 0x80);
278 Notify(PSTR(
"\r\n"), 0x80);
280 if (ButtonState != OldButtonState) {
281 ButtonClickState = ButtonState & ~OldButtonState;
282 OldButtonState = ButtonState;
285 if (l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33 || l2capinbuf[9] == 0x35 || l2capinbuf[9] == 0x37) {
286 accX = ((l2capinbuf[12] << 2) | (l2capinbuf[10] & 0x60 >> 5)) - 500;
287 accY = ((l2capinbuf[13] << 2) | (l2capinbuf[11] & 0x20 >> 4)) - 500;
288 accZ = ((l2capinbuf[14] << 2) | (l2capinbuf[11] & 0x40 >> 5)) - 500;
292 switch (l2capinbuf[9]) {
294 wiiState = l2capinbuf[12];
295 batteryLevel = l2capinbuf[15];
296 if (l2capinbuf[12] & 0x01) {
298 Notify(PSTR(
"\r\nWARNING: Battery is nearly empty"), 0x80);
301 if (l2capinbuf[12] & 0x02) {
303 if (!unknownExtensionConnected)
304 Notify(PSTR(
"\r\nExtension connected"), 0x80);
306 unknownExtensionConnected =
true;
310 setReportMode(
false, 0x35);
313 Notify(PSTR(
"\r\nExtension disconnected"), 0x80);
317 Notify(PSTR(
" - from Motion Plus"), 0x80);
320 if (!activateNunchuck)
325 Notify(PSTR(
" - Nunchuck"), 0x80);
330 setReportMode(
false, 0x31);
332 setReportMode(
false, 0x31);
337 if ((l2capinbuf[12] & 0x0F) == 0) {
339 if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x00) {
341 Notify(PSTR(
"\r\nNunchuck connected"), 0x80);
344 }
else if (l2capinbuf[16] == 0x00 && (l2capinbuf[17] == 0xA6 || l2capinbuf[17] == 0xA4) && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x05) {
346 Notify(PSTR(
"\r\nMotion Plus connected"), 0x80);
349 }
else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x05) {
351 Notify(PSTR(
"\r\nMotion Plus activated in normal mode"), 0x80);
354 }
else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x05 && l2capinbuf[20] == 0x05) {
356 Notify(PSTR(
"\r\nMotion Plus activated in Nunchuck pass-through mode"), 0x80);
358 activateNunchuck =
false;
361 }
else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA6 && l2capinbuf[18] == 0x20 && (l2capinbuf[19] == 0x00 || l2capinbuf[19] == 0x04 || l2capinbuf[19] == 0x05 || l2capinbuf[19] == 0x07) && l2capinbuf[20] == 0x05) {
363 Notify(PSTR(
"\r\nInactive Wii Motion Plus"), 0x80);
364 Notify(PSTR(
"\r\nPlease unplug the Motion Plus, disconnect the Wiimote and then replug the Motion Plus Extension"), 0x80);
367 }
else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x01 && l2capinbuf[20] == 0x20) {
369 Notify(PSTR(
"\r\nWii U Pro Controller connected"), 0x80);
375 Notify(PSTR(
"\r\nUnknown Device: "), 0x80);
376 PrintHex<uint8_t > (l2capinbuf[13], 0x80);
377 PrintHex<uint8_t > (l2capinbuf[14], 0x80);
378 Notify(PSTR(
"\r\nData: "), 0x80);
379 for (uint8_t i = 0; i < ((l2capinbuf[12] >> 4) + 1); i++) {
380 PrintHex<uint8_t > (l2capinbuf[15 + i], 0x80);
388 Notify(PSTR(
"\r\nReport Error: "), 0x80);
389 PrintHex<uint8_t > (l2capinbuf[13], 0x80);
390 PrintHex<uint8_t > (l2capinbuf[14], 0x80);
396 if (l2capinbuf[13] != 0x00) {
397 Notify(PSTR(
"\r\nCommand failed: "), 0x80);
398 PrintHex<uint8_t > (l2capinbuf[12], 0x80);
415 IR_object_x1 = (l2capinbuf[15] | ((uint16_t)(l2capinbuf[17] & 0x30) << 4));
416 IR_object_y1 = (l2capinbuf[16] | ((uint16_t)(l2capinbuf[17] & 0xC0) << 2));
417 IR_object_s1 = (l2capinbuf[17] & 0x0F);
419 IR_object_x2 = (l2capinbuf[18] | ((uint16_t)(l2capinbuf[20] & 0x30) << 4));
420 IR_object_y2 = (l2capinbuf[19] | ((uint16_t)(l2capinbuf[20] & 0xC0) << 2));
421 IR_object_s2 = (l2capinbuf[20] & 0x0F);
423 IR_object_x3 = (l2capinbuf[21] | ((uint16_t)(l2capinbuf[23] & 0x30) << 4));
424 IR_object_y3 = (l2capinbuf[22] | ((uint16_t)(l2capinbuf[23] & 0xC0) << 2));
425 IR_object_s3 = (l2capinbuf[23] & 0x0F);
427 IR_object_x4 = (l2capinbuf[24] | ((uint16_t)(l2capinbuf[26] & 0x30) << 4));
428 IR_object_y4 = (l2capinbuf[25] | ((uint16_t)(l2capinbuf[26] & 0xC0) << 2));
429 IR_object_s4 = (l2capinbuf[26] & 0x0F);
457 if (l2capinbuf[20] & 0x02) {
458 if (motionValuesReset) {
468 if (!(l2capinbuf[18] & 0x02))
470 if (!(l2capinbuf[18] & 0x01))
472 if (!(l2capinbuf[19] & 0x02))
498 if ((micros() - timer) > 1000000) {
500 Notify(PSTR(
"\r\nThe gyro values has been reset"), 0x80);
502 gyroYawZero = (l2capinbuf[15] | ((l2capinbuf[18] & 0xFC) << 6));
503 gyroRollZero = (l2capinbuf[16] | ((l2capinbuf[19] & 0xFC) << 6));
504 gyroPitchZero = (l2capinbuf[17] | ((l2capinbuf[20] & 0xFC) << 6));
514 motionValuesReset =
true;
520 hatValues[
HatX] = l2capinbuf[15];
521 hatValues[
HatY] = l2capinbuf[16];
522 accX = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x10 >> 3)) - 416;
523 accY = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x20 >> 4)) - 416;
524 accZ = (((l2capinbuf[19] & 0xFE) << 2) | (l2capinbuf[20] & 0xC0 >> 5)) - 416;
530 if (l2capinbuf[19] & 0x01) {
531 if (!extensionConnected) {
532 extensionConnected =
true;
533 unknownExtensionConnected =
true;
535 Notify(PSTR(
"\r\nExtension connected to Motion Plus"), 0x80);
539 if (extensionConnected && !unknownExtensionConnected) {
540 extensionConnected =
false;
541 unknownExtensionConnected =
true;
543 Notify(PSTR(
"\r\nExtension disconnected from Motion Plus"), 0x80);
550 hatValues[
HatX] = l2capinbuf[15];
551 hatValues[
HatY] = l2capinbuf[16];
552 accX = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x0C >> 2)) - 416;
553 accY = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x30 >> 4)) - 416;
554 accZ = ((l2capinbuf[19] << 2) | (l2capinbuf[20] & 0xC0 >> 6)) - 416;
561 hatValues[
LeftHatX] = (l2capinbuf[15] | l2capinbuf[16] << 8);
562 hatValues[
RightHatX] = (l2capinbuf[17] | l2capinbuf[18] << 8);
563 hatValues[
LeftHatY] = (l2capinbuf[19] | l2capinbuf[20] << 8);
564 hatValues[
RightHatY] = (l2capinbuf[21] | l2capinbuf[22] << 8);
569 Notify(PSTR(
"\r\nUnknown Report type: "), 0x80);
570 PrintHex<uint8_t > (l2capinbuf[9], 0x80);
581 void WII::L2CAP_task() {
582 switch (l2cap_state) {
587 Notify(PSTR(
"\r\nHID Control Successfully Configured"), 0x80);
596 Notify(PSTR(
"\r\nHID Interrupt Incoming Connection Request"), 0x80);
613 Notify(PSTR(
"\r\nSend HID Control Config Request"), 0x80);
624 Notify(PSTR(
"\r\nSend HID Interrupt Connection Request"), 0x80);
635 Notify(PSTR(
"\r\nSend HID Interrupt Config Request"), 0x80);
646 Notify(PSTR(
"\r\nHID Channels Established"), 0x80);
661 Notify(PSTR(
"\r\nDisconnected Interrupt Channel"), 0x80);
672 Notify(PSTR(
"\r\nDisconnected Control Channel"), 0x80);
676 l2cap_event_flag = 0;
684 switch (l2cap_state) {
688 activeConnection =
true;
690 Notify(PSTR(
"\r\nSend HID Control Connection Request"), 0x80);
693 l2cap_event_flag = 0;
699 Notify(PSTR(
"\r\nHID Control Incoming Connection Request"), 0x80);
713 if (stateCounter == 0)
714 Notify(PSTR(
"\r\nChecking if a Motion Plus is connected"), 0x80);
717 if (stateCounter % 200 == 0)
718 checkMotionPresent();
724 if (unknownExtensionConnected) {
726 Notify(PSTR(
"\r\nA extension is also connected"), 0x80);
728 activateNunchuck =
true;
731 }
else if (stateCounter == 601) {
733 Notify(PSTR(
"\r\nNo Motion Plus was detected"), 0x80);
742 if (stateCounter == 0)
743 Notify(PSTR(
"\r\nChecking if there is any extension connected"), 0x80);
746 if (stateCounter == 1)
748 if (stateCounter == 100) {
749 if (unknownExtensionConnected)
753 }
else if (stateCounter == 200)
755 else if (stateCounter == 300) {
757 unknownExtensionConnected =
false;
758 }
else if (stateCounter == 400) {
766 if (stateCounter == 1)
768 else if (stateCounter == 100)
769 activateMotionPlus();
770 else if (stateCounter == 200)
772 else if (stateCounter == 300) {
774 unknownExtensionConnected =
false;
787 if (unknownExtensionConnected) {
789 if (stateCounter == 0)
790 Notify(PSTR(
"\r\nChecking extension port"), 0x80);
793 if (stateCounter == 50)
795 else if (stateCounter == 100)
797 else if (stateCounter == 150)
802 else if (stateCounter == 200)
804 else if (stateCounter == 250) {
807 Notify(PSTR(
"\r\nNunchuck was reconnected"), 0x80);
809 activateNunchuck =
true;
814 }
else if (stateCounter == 300) {
817 Notify(PSTR(
"\r\nReactivating the Motion Plus"), 0x80);
822 }
else if (stateCounter == 350)
823 activateMotionPlus();
824 else if (stateCounter == 400)
826 else if (stateCounter == 450) {
829 unknownExtensionConnected =
false;
841 void WII::HID_Command(uint8_t* data, uint8_t nbytes) {
843 pBtd->
L2CAP_Command(hci_handle, data, nbytes, interrupt_scid[0], interrupt_scid[1]);
845 pBtd->
L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]);
851 HID_Command(HIDBuffer, 3);
856 HIDBuffer[2] &= ~0x01;
857 HID_Command(HIDBuffer, 3);
862 HIDBuffer[2] |= 0x01;
863 HID_Command(HIDBuffer, 3);
868 HIDBuffer[2] ^= 0x01;
869 HID_Command(HIDBuffer, 3);
874 HIDBuffer[2] = value | (HIDBuffer[2] & 0x01);
875 HID_Command(HIDBuffer, 3);
879 HIDBuffer[2] &= ~(pgm_read_byte(&
LEDS[(uint8_t)a]));
880 HID_Command(HIDBuffer, 3);
885 HIDBuffer[2] |= pgm_read_byte(&
LEDS[(uint8_t)a]);
886 HID_Command(HIDBuffer, 3);
891 HIDBuffer[2] ^= pgm_read_byte(&
LEDS[(uint8_t)a]);
892 HID_Command(HIDBuffer, 3);
897 HIDBuffer[2] = (HIDBuffer[2] & 0x01);
899 HIDBuffer[2] |= 0x10;
901 HIDBuffer[2] |= 0x20;
903 HIDBuffer[2] |= 0x40;
905 HID_Command(HIDBuffer, 3);
908 void WII::setReportMode(
bool continuous, uint8_t mode) {
913 cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01);
915 cmd_buf[2] = 0x00 | (HIDBuffer[2] & 0x01);
917 HID_Command(cmd_buf, 4);
924 cmd_buf[2] = (HIDBuffer[2] & 0x01);
925 HID_Command(cmd_buf, 3);
932 void WII::writeData(uint32_t offset, uint8_t size, uint8_t* data) {
936 cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01);
937 cmd_buf[3] = (uint8_t)((offset & 0xFF0000) >> 16);
938 cmd_buf[4] = (uint8_t)((offset & 0xFF00) >> 8);
939 cmd_buf[5] = (uint8_t)(offset & 0xFF);
942 for (; i < size; i++)
943 cmd_buf[7 + i] = data[i];
945 cmd_buf[7 + i] = 0x00;
946 HID_Command(cmd_buf, 23);
949 void WII::initExtension1() {
952 writeData(0xA400F0, 1, buf);
955 void WII::initExtension2() {
958 writeData(0xA400FB, 1, buf);
961 void WII::initMotionPlus() {
964 writeData(0xA600F0, 1, buf);
967 void WII::activateMotionPlus() {
971 Notify(PSTR(
"\r\nActivating Wii U Pro Controller"), 0x80);
974 }
else if (activateNunchuck) {
976 Notify(PSTR(
"\r\nActivating Motion Plus in pass-through mode"), 0x80);
983 Notify(PSTR(
"\r\nActivating Motion Plus in normal mode"), 0x80);
987 writeData(0xA600FE, 1, buf);
990 void WII::readData(uint32_t offset, uint16_t size,
bool EEPROM) {
995 cmd_buf[2] = 0x00 | (HIDBuffer[2] & 0x01);
997 cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01);
998 cmd_buf[3] = (uint8_t)((offset & 0xFF0000) >> 16);
999 cmd_buf[4] = (uint8_t)((offset & 0xFF00) >> 8);
1000 cmd_buf[5] = (uint8_t)(offset & 0xFF);
1001 cmd_buf[6] = (uint8_t)((size & 0xFF00) >> 8);
1002 cmd_buf[7] = (uint8_t)(size & 0xFF);
1004 HID_Command(cmd_buf, 8);
1007 void WII::readExtensionType() {
1008 readData(0xA400FA, 6,
false);
1011 void WII::readCalData() {
1012 readData(0x0016, 8,
true);
1015 void WII::checkMotionPresent() {
1016 readData(0xA600FA, 6,
false);
1028 return (ButtonState & pgm_read_dword(&
BUTTONS[(uint8_t)b]));
1036 button = pgm_read_dword(&
BUTTONS[(uint8_t)b]);
1037 bool click = (ButtonClickState & button);
1038 ButtonClickState &= ~button;
1046 uint8_t output = hatValues[(uint8_t)a];
1047 if (output == 0xFF || output == 0x00)
1058 uint16_t output = hatValues[(uint8_t)a];
1075 Notify(PSTR(
"\r\nEnable IR Camera1 Complete"), 0x80);
1081 Notify(PSTR(
"\r\nEnable IR Camera2 Complete"), 0x80);
1087 Notify(PSTR(
"\r\nWrote hex number 0x08"), 0x80);
1091 writeSensitivityBlock1();
1093 Notify(PSTR(
"\r\nWrote Sensitivity Block 1"), 0x80);
1097 writeSensitivityBlock2();
1099 Notify(PSTR(
"\r\nWrote Sensitivity Block 2"), 0x80);
1103 uint8_t mode_num = 0x03;
1104 setWiiModeNumber(mode_num);
1106 Notify(PSTR(
"\r\nSet Wii Mode Number To 0x"), 0x80);
1107 PrintHex<uint8_t > (mode_num, 0x80);
1113 Notify(PSTR(
"\r\nWrote Hex Number 0x08"), 0x80);
1117 setReportMode(
false, 0x33);
1120 Notify(PSTR(
"\r\nSet Report Mode to 0x33"), 0x80);
1126 Notify(PSTR(
"\r\nIR Initialized"), 0x80);
1130 void WII::enableIRCamera1() {
1134 cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01);
1135 HID_Command(cmd_buf, 3);
1138 void WII::enableIRCamera2() {
1142 cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01);
1143 HID_Command(cmd_buf, 3);
1146 void WII::writeSensitivityBlock1() {
1158 writeData(0xB00000, 9, buf);
1161 void WII::writeSensitivityBlock2() {
1166 writeData(0xB0001A, 2, buf);
1169 void WII::write0x08Value() {
1171 writeData(0xb00030, 1, &cmd);
1174 void WII::setWiiModeNumber(uint8_t mode_number) {
1175 writeData(0xb00033, 1, &mode_number);