27 #define WII_FLAG_MOTION_PLUS_CONNECTED (1 << 0)
28 #define WII_FLAG_NUNCHUCK_CONNECTED (1 << 1)
29 #define WII_FLAG_CALIBRATE_BALANCE_BOARD (1 << 2)
31 #define wii_check_flag(flag) (wii_event_flag & (flag))
32 #define wii_set_flag(flag) (wii_event_flag |= (flag))
33 #define wii_clear_flag(flag) (wii_event_flag &= ~(flag))
296 return wiiBalanceBoardRaw[pos];
409 return (wiiState & 0x08);
434 static int8_t getButtonIndexWii(
ButtonEnum b);
435 static int8_t getButtonIndexWiiPro(
ButtonEnum b);
440 bool activeConnection;
444 uint8_t wii_event_flag;
446 uint32_t ButtonState;
447 uint32_t OldButtonState;
448 uint32_t ButtonClickState;
449 uint16_t hatValues[4];
451 uint8_t HIDBuffer[3];
453 uint16_t stateCounter;
454 bool unknownExtensionConnected;
455 bool extensionConnected;
456 bool checkBatteryLevel;
457 bool motionPlusInside;
460 uint8_t control_scid[2];
461 uint8_t control_dcid[2];
462 uint8_t interrupt_scid[2];
463 uint8_t interrupt_dcid[2];
466 void HID_Command(uint8_t* data, uint8_t nbytes);
467 void setReportMode(
bool continuous, uint8_t mode);
469 void writeData(uint32_t offset, uint8_t size, uint8_t* data);
470 void initExtension1();
471 void initExtension2();
473 void statusRequest();
475 void readData(uint32_t offset, uint16_t size,
bool EEPROM);
476 void readExtensionType();
478 void readWiiBalanceBoardCalibration();
480 void checkMotionPresent();
481 void initMotionPlus();
482 void activateMotionPlus();
484 uint16_t wiiBalanceBoardRaw[4];
485 uint16_t wiiBalanceBoardCal[3][4];
490 bool activateNunchuck;
491 bool motionValuesReset;
495 uint8_t batteryLevel;
499 void enableIRCamera1();
500 void enableIRCamera2();
501 void writeSensitivityBlock1();
502 void writeSensitivityBlock2();
503 void write0x08Value();
504 void setWiiModeNumber(uint8_t mode_number);
506 uint16_t IR_object_x1;
507 uint16_t IR_object_y1;
508 uint8_t IR_object_s1;
509 uint16_t IR_object_x2;
510 uint16_t IR_object_y2;
511 uint8_t IR_object_s2;
512 uint16_t IR_object_x3;
513 uint16_t IR_object_y3;
514 uint8_t IR_object_s3;
515 uint16_t IR_object_x4;
516 uint16_t IR_object_y4;
517 uint8_t IR_object_s4;