35 #define L2CAP_CONTROL_SUCCESS 1
36 #define L2CAP_INTERRUPT_SETUP 2
39 #define L2CAP_CONTROL_CONNECT_REQUEST 3
40 #define L2CAP_CONTROL_CONFIG_REQUEST 4
41 #define L2CAP_INTERRUPT_CONNECT_REQUEST 5
43 #define L2CAP_INTERRUPT_CONFIG_REQUEST 6
45 #define L2CAP_CHECK_MOTION_PLUS_STATE 7
46 #define L2CAP_CHECK_EXTENSION_STATE 8
47 #define L2CAP_INIT_MOTION_PLUS_STATE 9
48 #define L2CAP_LED_STATE 10
51 #define L2CAP_INTERRUPT_DISCONNECT 12
52 #define L2CAP_CONTROL_DISCONNECT 13
55 #define L2CAP_FLAG_CONTROL_CONNECTED 0x001
56 #define L2CAP_FLAG_INTERRUPT_CONNECTED 0x002
57 #define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS 0x004
58 #define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS 0x008
59 #define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE 0x040
60 #define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE 0x080
61 #define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST 0x100
62 #define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST 0x200
65 #define l2cap_connected_control_flag (l2cap_event_flag & L2CAP_FLAG_CONTROL_CONNECTED)
66 #define l2cap_connected_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_INTERRUPT_CONNECTED)
67 #define l2cap_config_success_control_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
68 #define l2cap_config_success_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
69 #define l2cap_disconnect_response_control_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)
70 #define l2cap_disconnect_response_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)
71 #define l2cap_connection_request_control_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
72 #define l2cap_connection_request_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
75 #define WII_FLAG_MOTION_PLUS_CONNECTED 0x400
76 #define WII_FLAG_NUNCHUCK_CONNECTED 0x800
78 #define motion_plus_connected_flag (l2cap_event_flag & WII_FLAG_MOTION_PLUS_CONNECTED)
79 #define nunchuck_connected_flag (l2cap_event_flag & WII_FLAG_NUNCHUCK_CONNECTED)
115 virtual void Reset();
415 return(wiiState & 0x08);
428 bool activeConnection;
432 uint16_t l2cap_event_flag;
434 uint32_t ButtonState;
435 uint32_t OldButtonState;
436 uint32_t ButtonClickState;
437 uint16_t hatValues[4];
439 uint8_t HIDBuffer[3];
441 uint16_t stateCounter;
442 bool unknownExtensionConnected;
443 bool extensionConnected;
446 uint8_t control_scid[2];
447 uint8_t control_dcid[2];
448 uint8_t interrupt_scid[2];
449 uint8_t interrupt_dcid[2];
453 void HID_Command(uint8_t* data, uint8_t nbytes);
454 void setReportMode(
bool continuous, uint8_t mode);
456 void writeData(uint32_t offset, uint8_t size, uint8_t* data);
457 void initExtension1();
458 void initExtension2();
460 void readData(uint32_t offset, uint16_t size,
bool EEPROM);
461 void readExtensionType();
464 void checkMotionPresent();
465 void initMotionPlus();
466 void activateMotionPlus();
471 bool activateNunchuck;
472 bool motionValuesReset;
476 uint8_t batteryLevel;
480 void enableIRCamera1();
481 void enableIRCamera2();
482 void writeSensitivityBlock1();
483 void writeSensitivityBlock2();
484 void write0x08Value();
485 void setWiiModeNumber(uint8_t mode_number);
487 uint16_t IR_object_x1;
488 uint16_t IR_object_y1;
489 uint8_t IR_object_s1;
490 uint16_t IR_object_x2;
491 uint16_t IR_object_y2;
492 uint8_t IR_object_s2;
493 uint16_t IR_object_x3;
494 uint16_t IR_object_y3;
495 uint8_t IR_object_s3;
496 uint16_t IR_object_x4;
497 uint16_t IR_object_y4;
498 uint8_t IR_object_s4;