diff --git a/custom_gamepad.h b/custom_gamepad.h index a96d76d..c1c8800 100644 --- a/custom_gamepad.h +++ b/custom_gamepad.h @@ -15,17 +15,17 @@ HID_REPORT_COUNT ( 2 ) ,\ HID_REPORT_SIZE ( 8 ) ,\ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\ - /* 13 bit Button Map */ \ + /* 15 bit Button Map */ \ HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ) ,\ HID_USAGE_MIN ( 1 ) ,\ - HID_USAGE_MAX ( 13 ) ,\ + HID_USAGE_MAX ( 15 ) ,\ HID_LOGICAL_MIN ( 0 ) ,\ HID_LOGICAL_MAX ( 1 ) ,\ - HID_REPORT_COUNT ( 13 ) ,\ + HID_REPORT_COUNT ( 15 ) ,\ HID_REPORT_SIZE ( 1 ) ,\ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\ - /* 3 bit reserved */ \ - HID_REPORT_COUNT ( 3 ) ,\ + /* 1 bit reserved */ \ + HID_REPORT_COUNT ( 1 ) ,\ HID_REPORT_SIZE ( 1 ) ,\ HID_INPUT ( HID_CONSTANT ) ,\ HID_COLLECTION_END \ diff --git a/main.cpp b/main.cpp index ff0565c..1286b73 100644 --- a/main.cpp +++ b/main.cpp @@ -269,15 +269,21 @@ void hid_task(void) if ( tud_hid_n_ready(ITF_GAMEPAD_1) ) { //tud_hid_n_gamepad_report(ITF_GAMEPAD_1, 0, in.p1_x, in.p1_y, 0, 0, 0, 0, 0, in.p1 & BUTTON_MASK); - uint16_t hotkey = (in.util & UTIL_P1_HOTKEY) ? (1 << 12) : 0; - picade_gamepad_report(ITF_GAMEPAD_1, in.p1_x, in.p1_y, (in.p1 & BUTTON_MASK) | hotkey); + uint16_t extra = 0; + extra |= (in.util & UTIL_P1_HOTKEY) ? (1 << 12) : 0; + extra |= (in.util & UTIL_P1_X1) ? (1 << 13) : 0; + extra |= (in.util & UTIL_P1_X2) ? (1 << 14) : 0; + picade_gamepad_report(ITF_GAMEPAD_1, in.p1_x, in.p1_y, (in.p1 & BUTTON_MASK) | extra); } if ( tud_hid_n_ready(ITF_GAMEPAD_2) ) { //tud_hid_n_gamepad_report(ITF_GAMEPAD_2, 0, in.p2_x, in.p2_y, 0, 0, 0, 0, 0, in.p2 & BUTTON_MASK); - uint16_t hotkey = (in.util & UTIL_P2_HOTKEY) ? (1 << 12) : 0; - picade_gamepad_report(ITF_GAMEPAD_2, in.p2_x, in.p2_y, (in.p2 & BUTTON_MASK) | hotkey); + uint16_t extra = 0; + extra |= (in.util & UTIL_P2_HOTKEY) ? (1 << 12) : 0; + extra |= (in.util & UTIL_P2_X1) ? (1 << 13) : 0; + extra |= (in.util & UTIL_P2_X2) ? (1 << 14) : 0; + picade_gamepad_report(ITF_GAMEPAD_2, in.p2_x, in.p2_y, (in.p2 & BUTTON_MASK) | extra); } } diff --git a/picade.hpp b/picade.hpp index 650050b..fc93f87 100644 --- a/picade.hpp +++ b/picade.hpp @@ -8,14 +8,10 @@ const int16_t BUTTON_MASK = 0b0000111111111111; const uint8_t UTIL_P1_HOTKEY = 0b000001; const uint8_t UTIL_P2_HOTKEY = 0b000010; - -// Deprecated -const uint8_t UTIL_ENTER = 0b000001; -const uint8_t UTIL_ESCAPE = 0b000010; -const uint8_t UTIL_HOTKEY = 0b000100; -const uint8_t UTIL_A = 0b001000; -const uint8_t UTIL_B = 0b010000; -const uint8_t UTIL_C = 0b100000; +const uint8_t UTIL_P1_X1 = 0b000100; +const uint8_t UTIL_P1_X2 = 0b001000; +const uint8_t UTIL_P2_X1 = 0b010000; +const uint8_t UTIL_P2_X2 = 0b100000; struct input_t { uint16_t p1;