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();
238 pFuncOnInit = funcOnInit;
426 return(wiiState & 0x08);
440 void (*pFuncOnInit)(void);
446 bool activeConnection;
450 uint16_t l2cap_event_flag;
452 uint32_t ButtonState;
453 uint32_t OldButtonState;
454 uint32_t ButtonClickState;
455 uint16_t hatValues[4];
457 uint8_t HIDBuffer[3];
459 uint16_t stateCounter;
460 bool unknownExtensionConnected;
461 bool extensionConnected;
463 bool motionPlusInside;
466 uint8_t control_scid[2];
467 uint8_t control_dcid[2];
468 uint8_t interrupt_scid[2];
469 uint8_t interrupt_dcid[2];
473 void HID_Command(uint8_t* data, uint8_t nbytes);
474 void setReportMode(
bool continuous, uint8_t mode);
476 void writeData(uint32_t offset, uint8_t size, uint8_t* data);
477 void initExtension1();
478 void initExtension2();
480 void statusRequest();
482 void readData(uint32_t offset, uint16_t size,
bool EEPROM);
483 void readExtensionType();
486 void checkMotionPresent();
487 void initMotionPlus();
488 void activateMotionPlus();
493 bool activateNunchuck;
494 bool motionValuesReset;
498 uint8_t batteryLevel;
502 void enableIRCamera1();
503 void enableIRCamera2();
504 void writeSensitivityBlock1();
505 void writeSensitivityBlock2();
506 void write0x08Value();
507 void setWiiModeNumber(uint8_t mode_number);
509 uint16_t IR_object_x1;
510 uint16_t IR_object_y1;
511 uint8_t IR_object_s1;
512 uint16_t IR_object_x2;
513 uint16_t IR_object_y2;
514 uint8_t IR_object_s2;
515 uint16_t IR_object_x3;
516 uint16_t IR_object_y3;
517 uint8_t IR_object_s3;
518 uint16_t IR_object_x4;
519 uint16_t IR_object_y4;
520 uint8_t IR_object_s4;
double getNunchuckPitch()
void setLedRaw(uint8_t value)
virtual void ACLData(uint8_t *ACLData)
uint8_t getBatteryLevel()
virtual void disconnect()
bool getButtonClick(Button b)
WII(BTD *p, bool pair=false)
bool wiiUProControllerConnected
bool getButtonPress(Button b)
void attachOnInit(void(*funcOnInit)(void))
uint8_t getAnalogHat(Hat a)