33 #define L2CAP_CONTROL_SUCCESS 1
34 #define L2CAP_INTERRUPT_SETUP 2
37 #define L2CAP_CONTROL_CONNECT_REQUEST 3
38 #define L2CAP_CONTROL_CONFIG_REQUEST 4
39 #define L2CAP_INTERRUPT_CONNECT_REQUEST 5
41 #define L2CAP_INTERRUPT_CONFIG_REQUEST 6
43 #define L2CAP_CHECK_MOTION_PLUS_STATE 7
44 #define L2CAP_CHECK_EXTENSION_STATE 8
45 #define L2CAP_INIT_MOTION_PLUS_STATE 9
46 #define L2CAP_LED_STATE 10
49 #define L2CAP_INTERRUPT_DISCONNECT 12
50 #define L2CAP_CONTROL_DISCONNECT 13
53 #define L2CAP_FLAG_CONTROL_CONNECTED 0x001
54 #define L2CAP_FLAG_INTERRUPT_CONNECTED 0x002
55 #define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS 0x004
56 #define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS 0x008
57 #define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE 0x040
58 #define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE 0x080
59 #define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST 0x100
60 #define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST 0x200
63 #define l2cap_connected_control_flag (l2cap_event_flag & L2CAP_FLAG_CONTROL_CONNECTED)
64 #define l2cap_connected_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_INTERRUPT_CONNECTED)
65 #define l2cap_config_success_control_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
66 #define l2cap_config_success_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
67 #define l2cap_disconnect_response_control_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)
68 #define l2cap_disconnect_response_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)
69 #define l2cap_connection_request_control_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
70 #define l2cap_connection_request_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
73 #define WII_FLAG_MOTION_PLUS_CONNECTED 0x400
74 #define WII_FLAG_NUNCHUCK_CONNECTED 0x800
76 #define motion_plus_connected_flag (l2cap_event_flag & WII_FLAG_MOTION_PLUS_CONNECTED)
77 #define nunchuck_connected_flag (l2cap_event_flag & WII_FLAG_NUNCHUCK_CONNECTED)
113 virtual void Reset();
234 pFuncOnInit = funcOnInit;
415 return(wiiState & 0x08);
429 void (*pFuncOnInit)(void);
435 bool activeConnection;
439 uint16_t l2cap_event_flag;
441 uint32_t ButtonState;
442 uint32_t OldButtonState;
443 uint32_t ButtonClickState;
444 uint16_t hatValues[4];
446 uint8_t HIDBuffer[3];
448 uint16_t stateCounter;
449 bool unknownExtensionConnected;
450 bool extensionConnected;
452 bool motionPlusInside;
455 uint8_t control_scid[2];
456 uint8_t control_dcid[2];
457 uint8_t interrupt_scid[2];
458 uint8_t interrupt_dcid[2];
462 void HID_Command(uint8_t* data, uint8_t nbytes);
463 void setReportMode(
bool continuous, uint8_t mode);
465 void writeData(uint32_t offset, uint8_t size, uint8_t* data);
466 void initExtension1();
467 void initExtension2();
469 void statusRequest();
471 void readData(uint32_t offset, uint16_t size,
bool EEPROM);
472 void readExtensionType();
475 void checkMotionPresent();
476 void initMotionPlus();
477 void activateMotionPlus();
482 bool activateNunchuck;
483 bool motionValuesReset;
487 uint8_t batteryLevel;
491 void enableIRCamera1();
492 void enableIRCamera2();
493 void writeSensitivityBlock1();
494 void writeSensitivityBlock2();
495 void write0x08Value();
496 void setWiiModeNumber(uint8_t mode_number);
498 uint16_t IR_object_x1;
499 uint16_t IR_object_y1;
500 uint8_t IR_object_s1;
501 uint16_t IR_object_x2;
502 uint16_t IR_object_y2;
503 uint8_t IR_object_s2;
504 uint16_t IR_object_x3;
505 uint16_t IR_object_y3;
506 uint8_t IR_object_s3;
507 uint16_t IR_object_x4;
508 uint16_t IR_object_y4;
509 uint8_t IR_object_s4;