mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Clear and set flags in a more readable way
This commit is contained in:
parent
ed36d04e7c
commit
809e80a1b0
6 changed files with 88 additions and 106 deletions
25
BTD.h
25
BTD.h
|
@ -165,28 +165,9 @@
|
|||
#define L2CAP_FLAG_DISCONNECT_RESPONSE 0x00010000
|
||||
|
||||
/* Macros for L2CAP event flag tests */
|
||||
|
||||
#define l2cap_connection_request_control_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
|
||||
#define l2cap_config_success_control_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
|
||||
#define l2cap_connected_control_flag (l2cap_event_flag & L2CAP_FLAG_CONTROL_CONNECTED)
|
||||
#define l2cap_disconnect_response_control_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)
|
||||
|
||||
#define l2cap_connection_request_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
|
||||
#define l2cap_config_success_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
|
||||
#define l2cap_connected_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_INTERRUPT_CONNECTED)
|
||||
#define l2cap_disconnect_response_interrupt_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)
|
||||
|
||||
#define l2cap_connection_request_sdp_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_SDP_REQUEST)
|
||||
#define l2cap_config_request_sdp_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_SDP_REQUEST)
|
||||
#define l2cap_config_success_sdp_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_SDP_SUCCESS)
|
||||
#define l2cap_disconnect_request_sdp_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_SDP_REQUEST)
|
||||
|
||||
#define l2cap_connection_request_rfcomm_flag (l2cap_event_flag & L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST)
|
||||
#define l2cap_config_request_rfcomm_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_RFCOMM_REQUEST)
|
||||
#define l2cap_config_success_rfcomm_flag (l2cap_event_flag & L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS)
|
||||
#define l2cap_disconnect_request_rfcomm_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST)
|
||||
|
||||
#define l2cap_disconnect_response_flag (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_RESPONSE)
|
||||
#define l2cap_check_flag(flag) (l2cap_event_flag & flag)
|
||||
#define l2cap_set_flag(flag) (l2cap_event_flag |= flag)
|
||||
#define l2cap_clear_flag(flag) (l2cap_event_flag &= ~flag)
|
||||
|
||||
/* L2CAP signaling commands */
|
||||
#define L2CAP_CMD_COMMAND_REJECT 0x01
|
||||
|
|
34
BTHID.cpp
34
BTHID.cpp
|
@ -94,13 +94,13 @@ void BTHID::ACLData(uint8_t* l2capinbuf) {
|
|||
identifier = l2capinbuf[9];
|
||||
control_scid[0] = l2capinbuf[12];
|
||||
control_scid[1] = l2capinbuf[13];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONTROL_CONNECTED;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONTROL_CONNECTED);
|
||||
} else if (l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Interrupt Connection Complete"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
interrupt_scid[0] = l2capinbuf[12];
|
||||
interrupt_scid[1] = l2capinbuf[13];
|
||||
l2cap_event_flag |= L2CAP_FLAG_INTERRUPT_CONNECTED;
|
||||
l2cap_set_flag(L2CAP_FLAG_INTERRUPT_CONNECTED);
|
||||
}
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
|
||||
|
@ -120,23 +120,23 @@ void BTHID::ACLData(uint8_t* l2capinbuf) {
|
|||
identifier = l2capinbuf[9];
|
||||
control_scid[0] = l2capinbuf[14];
|
||||
control_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_CONTROL_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_CONTROL_REQUEST);
|
||||
} else if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
|
||||
identifier = l2capinbuf[9];
|
||||
interrupt_scid[0] = l2capinbuf[14];
|
||||
interrupt_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
|
||||
if ((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
|
||||
if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_CONTROL_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS);
|
||||
} else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS);
|
||||
}
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
|
||||
|
@ -167,11 +167,11 @@ void BTHID::ACLData(uint8_t* l2capinbuf) {
|
|||
if (l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE);
|
||||
} else if (l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE);
|
||||
}
|
||||
}
|
||||
#ifdef EXTRADEBUG
|
||||
|
@ -251,7 +251,7 @@ void BTHID::L2CAP_task() {
|
|||
switch (l2cap_state) {
|
||||
/* These states are used if the HID device is the host */
|
||||
case L2CAP_CONTROL_SUCCESS:
|
||||
if (l2cap_config_success_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
|
||||
#endif
|
||||
|
@ -261,7 +261,7 @@ void BTHID::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_SETUP:
|
||||
if (l2cap_connection_request_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -278,7 +278,7 @@ void BTHID::L2CAP_task() {
|
|||
|
||||
/* These states are used if the Arduino is the host */
|
||||
case L2CAP_CONTROL_CONNECT_REQUEST:
|
||||
if (l2cap_connected_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONTROL_CONNECTED)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
|
||||
#endif
|
||||
|
@ -289,7 +289,7 @@ void BTHID::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_CONTROL_CONFIG_REQUEST:
|
||||
if (l2cap_config_success_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)) {
|
||||
setProtocol(); // Set protocol before establishing HID interrupt channel
|
||||
delay(1); // Short delay between commands - just to be sure
|
||||
#ifdef DEBUG_USB_HOST
|
||||
|
@ -302,7 +302,7 @@ void BTHID::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_CONNECT_REQUEST:
|
||||
if (l2cap_connected_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_INTERRUPT_CONNECTED)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
|
||||
#endif
|
||||
|
@ -313,7 +313,7 @@ void BTHID::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_CONFIG_REQUEST:
|
||||
if (l2cap_config_success_interrupt_flag) { // Now the HID channels is established
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Channels Established"), 0x80);
|
||||
#endif
|
||||
|
@ -329,7 +329,7 @@ void BTHID::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_DISCONNECT:
|
||||
if (l2cap_disconnect_response_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
|
||||
#endif
|
||||
|
@ -340,7 +340,7 @@ void BTHID::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_CONTROL_DISCONNECT:
|
||||
if (l2cap_disconnect_response_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
|
||||
#endif
|
||||
|
@ -367,7 +367,7 @@ void BTHID::Run() {
|
|||
identifier = 0;
|
||||
pBtd->l2cap_connection_request(hci_handle, identifier, control_dcid, HID_CTRL_PSM);
|
||||
l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
|
||||
} else if (l2cap_connection_request_control_flag) {
|
||||
} else if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
|
24
PS3BT.cpp
24
PS3BT.cpp
|
@ -285,21 +285,21 @@ void PS3BT::ACLData(uint8_t* ACLData) {
|
|||
identifier = l2capinbuf[9];
|
||||
control_scid[0] = l2capinbuf[14];
|
||||
control_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_CONTROL_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_CONTROL_REQUEST);
|
||||
} else if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
|
||||
identifier = l2capinbuf[9];
|
||||
interrupt_scid[0] = l2capinbuf[14];
|
||||
interrupt_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
|
||||
if ((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
|
||||
if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_CONTROL_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS);
|
||||
} else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS);
|
||||
}
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
|
||||
|
@ -330,11 +330,11 @@ void PS3BT::ACLData(uint8_t* ACLData) {
|
|||
if (l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE);
|
||||
} else if (l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE);
|
||||
}
|
||||
}
|
||||
#ifdef EXTRADEBUG
|
||||
|
@ -378,7 +378,7 @@ void PS3BT::ACLData(uint8_t* ACLData) {
|
|||
void PS3BT::L2CAP_task() {
|
||||
switch (l2cap_state) {
|
||||
case L2CAP_WAIT:
|
||||
if (l2cap_connection_request_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -393,7 +393,7 @@ void PS3BT::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_CONTROL_SUCCESS:
|
||||
if (l2cap_config_success_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
|
||||
#endif
|
||||
|
@ -402,7 +402,7 @@ void PS3BT::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_SETUP:
|
||||
if (l2cap_connection_request_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -418,7 +418,7 @@ void PS3BT::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_CONFIG_REQUEST:
|
||||
if (l2cap_config_success_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Interrupt Successfully Configured"), 0x80);
|
||||
#endif
|
||||
|
@ -434,7 +434,7 @@ void PS3BT::L2CAP_task() {
|
|||
/* These states are handled in Run() */
|
||||
|
||||
case L2CAP_INTERRUPT_DISCONNECT:
|
||||
if (l2cap_disconnect_response_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
|
||||
#endif
|
||||
|
@ -445,7 +445,7 @@ void PS3BT::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_CONTROL_DISCONNECT:
|
||||
if (l2cap_disconnect_response_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
|
||||
#endif
|
||||
|
|
58
SPP.cpp
58
SPP.cpp
|
@ -131,52 +131,52 @@ void SPP::ACLData(uint8_t* l2capinbuf) {
|
|||
identifier = l2capinbuf[9];
|
||||
sdp_scid[0] = l2capinbuf[14];
|
||||
sdp_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_SDP_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_SDP_REQUEST);
|
||||
} else if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == RFCOMM_PSM) { // ----- || -----
|
||||
identifier = l2capinbuf[9];
|
||||
rfcomm_scid[0] = l2capinbuf[14];
|
||||
rfcomm_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
|
||||
if ((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
|
||||
if (l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
|
||||
//Notify(PSTR("\r\nSDP Configuration Complete"), 0x80);
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_SDP_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_SDP_SUCCESS);
|
||||
} else if (l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
|
||||
//Notify(PSTR("\r\nRFCOMM Configuration Complete"), 0x80);
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS);
|
||||
}
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
|
||||
if (l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
|
||||
//Notify(PSTR("\r\nSDP Configuration Request"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_SDP_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_SDP_REQUEST);
|
||||
} else if (l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
|
||||
//Notify(PSTR("\r\nRFCOMM Configuration Request"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_RFCOMM_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_RFCOMM_REQUEST);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
|
||||
if (l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Request: SDP Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_SDP_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_SDP_REQUEST);
|
||||
} else if (l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Request: RFCOMM Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
|
||||
if (l2capinbuf[12] == sdp_scid[0] && l2capinbuf[13] == sdp_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: SDP Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_RESPONSE);
|
||||
} else if (l2capinbuf[12] == rfcomm_scid[0] && l2capinbuf[13] == rfcomm_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: RFCOMM Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_RESPONSE);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_INFORMATION_REQUEST) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
|
@ -442,8 +442,8 @@ void SPP::Run() {
|
|||
void SPP::SDP_task() {
|
||||
switch (l2cap_sdp_state) {
|
||||
case L2CAP_SDP_WAIT:
|
||||
if (l2cap_connection_request_sdp_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_SDP_REQUEST; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_SDP_REQUEST)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_CONNECTION_SDP_REQUEST); // Clear flag
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSDP Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -457,8 +457,8 @@ void SPP::SDP_task() {
|
|||
}
|
||||
break;
|
||||
case L2CAP_SDP_REQUEST:
|
||||
if (l2cap_config_request_sdp_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_REQUEST; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_SDP_REQUEST)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_CONFIG_SDP_REQUEST); // Clear flag
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSDP Configuration Request"), 0x80);
|
||||
#endif
|
||||
|
@ -467,8 +467,8 @@ void SPP::SDP_task() {
|
|||
}
|
||||
break;
|
||||
case L2CAP_SDP_SUCCESS:
|
||||
if (l2cap_config_success_sdp_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_SUCCESS; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_SDP_SUCCESS)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_CONFIG_SDP_SUCCESS); // Clear flag
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSDP Successfully Configured"), 0x80);
|
||||
#endif
|
||||
|
@ -478,19 +478,19 @@ void SPP::SDP_task() {
|
|||
}
|
||||
break;
|
||||
case L2CAP_SDP_DONE:
|
||||
if (l2cap_disconnect_request_sdp_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_SDP_REQUEST; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_SDP_REQUEST)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_DISCONNECT_SDP_REQUEST); // Clear flag
|
||||
SDPConnected = false;
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected SDP Channel"), 0x80);
|
||||
#endif
|
||||
pBtd->l2cap_disconnection_response(hci_handle, identifier, sdp_dcid, sdp_scid);
|
||||
l2cap_sdp_state = L2CAP_SDP_WAIT;
|
||||
} else if (l2cap_connection_request_sdp_flag)
|
||||
} else if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_SDP_REQUEST))
|
||||
l2cap_rfcomm_state = L2CAP_SDP_WAIT;
|
||||
break;
|
||||
case L2CAP_DISCONNECT_RESPONSE: // This is for both disconnection response from the RFCOMM and SDP channel if they were connected
|
||||
if (l2cap_disconnect_response_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_RESPONSE)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected L2CAP Connection"), 0x80);
|
||||
#endif
|
||||
|
@ -509,8 +509,8 @@ void SPP::SDP_task() {
|
|||
void SPP::RFCOMM_task() {
|
||||
switch (l2cap_rfcomm_state) {
|
||||
case L2CAP_RFCOMM_WAIT:
|
||||
if (l2cap_connection_request_rfcomm_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST); // Clear flag
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nRFCOMM Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -524,8 +524,8 @@ void SPP::RFCOMM_task() {
|
|||
}
|
||||
break;
|
||||
case L2CAP_RFCOMM_REQUEST:
|
||||
if (l2cap_config_request_rfcomm_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_REQUEST; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_RFCOMM_REQUEST)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_CONFIG_RFCOMM_REQUEST); // Clear flag
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nRFCOMM Configuration Request"), 0x80);
|
||||
#endif
|
||||
|
@ -534,8 +534,8 @@ void SPP::RFCOMM_task() {
|
|||
}
|
||||
break;
|
||||
case L2CAP_RFCOMM_SUCCESS:
|
||||
if (l2cap_config_success_rfcomm_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS); // Clear flag
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nRFCOMM Successfully Configured"), 0x80);
|
||||
#endif
|
||||
|
@ -546,8 +546,8 @@ void SPP::RFCOMM_task() {
|
|||
}
|
||||
break;
|
||||
case L2CAP_RFCOMM_DONE:
|
||||
if (l2cap_disconnect_request_rfcomm_flag) {
|
||||
l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST; // Clear flag
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST)) {
|
||||
l2cap_clear_flag(L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST); // Clear flag
|
||||
RFCOMMConnected = false;
|
||||
connected = false;
|
||||
#ifdef DEBUG_USB_HOST
|
||||
|
@ -555,7 +555,7 @@ void SPP::RFCOMM_task() {
|
|||
#endif
|
||||
pBtd->l2cap_disconnection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid);
|
||||
l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
|
||||
} else if (l2cap_connection_request_rfcomm_flag)
|
||||
} else if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST))
|
||||
l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
|
||||
break;
|
||||
}
|
||||
|
|
48
Wii.cpp
48
Wii.cpp
|
@ -168,13 +168,13 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
|||
identifier = l2capinbuf[9];
|
||||
control_scid[0] = l2capinbuf[12];
|
||||
control_scid[1] = l2capinbuf[13];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONTROL_CONNECTED;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONTROL_CONNECTED);
|
||||
} else if (l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Interrupt Connection Complete"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
interrupt_scid[0] = l2capinbuf[12];
|
||||
interrupt_scid[1] = l2capinbuf[13];
|
||||
l2cap_event_flag |= L2CAP_FLAG_INTERRUPT_CONNECTED;
|
||||
l2cap_set_flag(L2CAP_FLAG_INTERRUPT_CONNECTED);
|
||||
}
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
|
||||
|
@ -194,23 +194,23 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
|||
identifier = l2capinbuf[9];
|
||||
control_scid[0] = l2capinbuf[14];
|
||||
control_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_CONTROL_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_CONTROL_REQUEST);
|
||||
} else if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
|
||||
identifier = l2capinbuf[9];
|
||||
interrupt_scid[0] = l2capinbuf[14];
|
||||
interrupt_scid[1] = l2capinbuf[15];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST);
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
|
||||
if ((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
|
||||
if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_CONTROL_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS);
|
||||
} else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
|
||||
//Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS;
|
||||
l2cap_set_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS);
|
||||
}
|
||||
}
|
||||
} else if (l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
|
||||
|
@ -241,11 +241,11 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
|||
if (l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE);
|
||||
} else if (l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
|
||||
//Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
|
||||
identifier = l2capinbuf[9];
|
||||
l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE;
|
||||
l2cap_set_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE);
|
||||
}
|
||||
}
|
||||
#ifdef EXTRADEBUG
|
||||
|
@ -319,7 +319,7 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
|||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR(" - from Motion Plus"), 0x80);
|
||||
#endif
|
||||
l2cap_event_flag &= ~WII_FLAG_NUNCHUCK_CONNECTED;
|
||||
wii_clear_flag(WII_FLAG_NUNCHUCK_CONNECTED);
|
||||
if (!activateNunchuck) // If it's already trying to initialize the Nunchuck don't set it to false
|
||||
nunchuckConnected = false;
|
||||
//else if(classicControllerConnected)
|
||||
|
@ -328,7 +328,7 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
|||
Notify(PSTR(" - Nunchuck"), 0x80);
|
||||
#endif
|
||||
nunchuckConnected = false; // It must be the Nunchuck controller then
|
||||
l2cap_event_flag &= ~WII_FLAG_NUNCHUCK_CONNECTED;
|
||||
wii_clear_flag(WII_FLAG_NUNCHUCK_CONNECTED);
|
||||
onInit();
|
||||
setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
|
||||
} else
|
||||
|
@ -344,12 +344,12 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
|||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nNunchuck connected"), 0x80);
|
||||
#endif
|
||||
l2cap_event_flag |= WII_FLAG_NUNCHUCK_CONNECTED;
|
||||
wii_set_flag(WII_FLAG_NUNCHUCK_CONNECTED);
|
||||
} else if (l2capinbuf[16] == 0x00 && (l2capinbuf[17] == 0xA6 || l2capinbuf[17] == 0xA4) && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x05) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nMotion Plus connected"), 0x80);
|
||||
#endif
|
||||
l2cap_event_flag |= WII_FLAG_MOTION_PLUS_CONNECTED;
|
||||
wii_set_flag(WII_FLAG_MOTION_PLUS_CONNECTED);
|
||||
} else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x05) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nMotion Plus activated in normal mode"), 0x80);
|
||||
|
@ -582,7 +582,7 @@ void WII::L2CAP_task() {
|
|||
switch (l2cap_state) {
|
||||
/* These states are used if the Wiimote is the host */
|
||||
case L2CAP_CONTROL_SUCCESS:
|
||||
if (l2cap_config_success_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
|
||||
#endif
|
||||
|
@ -591,7 +591,7 @@ void WII::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_SETUP:
|
||||
if (l2cap_connection_request_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -608,7 +608,7 @@ void WII::L2CAP_task() {
|
|||
|
||||
/* These states are used if the Arduino is the host */
|
||||
case L2CAP_CONTROL_CONNECT_REQUEST:
|
||||
if (l2cap_connected_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONTROL_CONNECTED)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
|
||||
#endif
|
||||
|
@ -619,7 +619,7 @@ void WII::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_CONTROL_CONFIG_REQUEST:
|
||||
if (l2cap_config_success_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -630,7 +630,7 @@ void WII::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_CONNECT_REQUEST:
|
||||
if (l2cap_connected_interrupt_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_INTERRUPT_CONNECTED)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
|
||||
#endif
|
||||
|
@ -641,7 +641,7 @@ void WII::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_INTERRUPT_CONFIG_REQUEST:
|
||||
if (l2cap_config_success_interrupt_flag) { // Now the HID channels is established
|
||||
if (l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Channels Established"), 0x80);
|
||||
#endif
|
||||
|
@ -655,7 +655,7 @@ void WII::L2CAP_task() {
|
|||
/* The next states are in run() */
|
||||
|
||||
case L2CAP_INTERRUPT_DISCONNECT:
|
||||
if (l2cap_disconnect_response_interrupt_flag && millis() > timer) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE) && millis() > timer) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
|
||||
#endif
|
||||
|
@ -666,7 +666,7 @@ void WII::L2CAP_task() {
|
|||
break;
|
||||
|
||||
case L2CAP_CONTROL_DISCONNECT:
|
||||
if (l2cap_disconnect_response_control_flag) {
|
||||
if (l2cap_check_flag(L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
|
||||
#endif
|
||||
|
@ -697,7 +697,7 @@ void WII::Run() {
|
|||
identifier = 0;
|
||||
pBtd->l2cap_connection_request(hci_handle, identifier, control_dcid, HID_CTRL_PSM);
|
||||
l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
|
||||
} else if (l2cap_connection_request_control_flag) {
|
||||
} else if (l2cap_check_flag(L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
|
||||
#endif
|
||||
|
@ -719,7 +719,7 @@ void WII::Run() {
|
|||
stateCounter++;
|
||||
if (stateCounter % 200 == 0)
|
||||
checkMotionPresent(); // Check if there is a motion plus connected
|
||||
if (motion_plus_connected_flag) {
|
||||
if (wii_check_flag(WII_FLAG_MOTION_PLUS_CONNECTED)) {
|
||||
stateCounter = 0;
|
||||
l2cap_state = WII_INIT_MOTION_PLUS_STATE;
|
||||
timer = micros();
|
||||
|
@ -780,7 +780,7 @@ void WII::Run() {
|
|||
break;
|
||||
|
||||
case TURN_ON_LED:
|
||||
if (nunchuck_connected_flag)
|
||||
if (wii_check_flag(WII_FLAG_NUNCHUCK_CONNECTED))
|
||||
nunchuckConnected = true;
|
||||
wiimoteConnected = true;
|
||||
onInit();
|
||||
|
@ -806,7 +806,7 @@ void WII::Run() {
|
|||
else if (stateCounter == 200)
|
||||
readExtensionType();
|
||||
else if (stateCounter == 250) {
|
||||
if (nunchuck_connected_flag) {
|
||||
if (wii_check_flag(WII_FLAG_NUNCHUCK_CONNECTED)) {
|
||||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nNunchuck was reconnected"), 0x80);
|
||||
#endif
|
||||
|
|
5
Wii.h
5
Wii.h
|
@ -30,8 +30,9 @@
|
|||
#define WII_FLAG_MOTION_PLUS_CONNECTED 0x01
|
||||
#define WII_FLAG_NUNCHUCK_CONNECTED 0x02
|
||||
|
||||
#define motion_plus_connected_flag (wii_event_flag & WII_FLAG_MOTION_PLUS_CONNECTED)
|
||||
#define nunchuck_connected_flag (wii_event_flag & WII_FLAG_NUNCHUCK_CONNECTED)
|
||||
#define wii_check_flag(flag) (wii_event_flag & flag)
|
||||
#define wii_set_flag(flag) (wii_event_flag |= flag)
|
||||
#define wii_clear_flag(flag) (wii_event_flag &= ~flag)
|
||||
|
||||
/** Enum used to read the joystick on the Nunchuck. */
|
||||
enum Hat {
|
||||
|
|
Loading…
Reference in a new issue