|
@@ -58,8 +58,12 @@ static void send_hid_report(uint8_t report_id, uint32_t btn) {
|
58
|
58
|
case REPORT_ID_MOUSE:
|
59
|
59
|
{
|
60
|
60
|
struct pmw_motion mouse = pmw_get();
|
|
61
|
+ uint8_t buttons = 0x00;
|
|
62
|
+ if (btn) {
|
|
63
|
+ buttons |= MOUSE_BUTTON_LEFT;
|
|
64
|
+ }
|
61
|
65
|
if (mouse.motion) {
|
62
|
|
- tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00,
|
|
66
|
+ tud_hid_mouse_report(REPORT_ID_MOUSE, buttons,
|
63
|
67
|
mouse.delta_x * (INVERT_MOUSE_X_AXIS ? -1 : 1),
|
64
|
68
|
mouse.delta_y * (INVERT_MOUSE_Y_AXIS ? -1 : 1),
|
65
|
69
|
0, 0);
|
|
@@ -70,18 +74,18 @@ static void send_hid_report(uint8_t report_id, uint32_t btn) {
|
70
|
74
|
case REPORT_ID_CONSUMER_CONTROL:
|
71
|
75
|
{
|
72
|
76
|
// use to avoid send multiple consecutive zero report
|
73
|
|
- static bool has_consumer_key = false;
|
|
77
|
+ //static bool has_consumer_key = false;
|
74
|
78
|
|
75
|
79
|
if (btn) {
|
76
|
80
|
// volume down
|
77
|
|
- uint16_t volume_down = HID_USAGE_CONSUMER_VOLUME_DECREMENT;
|
78
|
|
- tud_hid_report(REPORT_ID_CONSUMER_CONTROL, &volume_down, 2);
|
79
|
|
- has_consumer_key = true;
|
|
81
|
+ //uint16_t volume_down = HID_USAGE_CONSUMER_VOLUME_DECREMENT;
|
|
82
|
+ //tud_hid_report(REPORT_ID_CONSUMER_CONTROL, &volume_down, 2);
|
|
83
|
+ //has_consumer_key = true;
|
80
|
84
|
} else {
|
81
|
85
|
// send empty key report (release key) if previously has key pressed
|
82
|
|
- uint16_t empty_key = 0;
|
83
|
|
- if (has_consumer_key) tud_hid_report(REPORT_ID_CONSUMER_CONTROL, &empty_key, 2);
|
84
|
|
- has_consumer_key = false;
|
|
86
|
+ //uint16_t empty_key = 0;
|
|
87
|
+ //if (has_consumer_key) tud_hid_report(REPORT_ID_CONSUMER_CONTROL, &empty_key, 2);
|
|
88
|
+ //has_consumer_key = false;
|
85
|
89
|
}
|
86
|
90
|
}
|
87
|
91
|
break;
|
|
@@ -89,24 +93,23 @@ static void send_hid_report(uint8_t report_id, uint32_t btn) {
|
89
|
93
|
case REPORT_ID_GAMEPAD:
|
90
|
94
|
{
|
91
|
95
|
// use to avoid send multiple consecutive zero report for keyboard
|
92
|
|
- static bool has_gamepad_key = false;
|
|
96
|
+ //static bool has_gamepad_key = false;
|
93
|
97
|
|
94
|
|
- hid_gamepad_report_t report = {
|
95
|
|
- .x = 0, .y = 0, .z = 0, .rz = 0, .rx = 0, .ry = 0,
|
96
|
|
- .hat = 0, .buttons = 0
|
97
|
|
- };
|
|
98
|
+ //hid_gamepad_report_t report = {
|
|
99
|
+ // .x = 0, .y = 0, .z = 0, .rz = 0, .rx = 0, .ry = 0,
|
|
100
|
+ // .hat = 0, .buttons = 0
|
|
101
|
+ //};
|
98
|
102
|
|
99
|
103
|
if (btn) {
|
100
|
|
- report.hat = GAMEPAD_HAT_UP;
|
101
|
|
- report.buttons = GAMEPAD_BUTTON_A;
|
102
|
|
- tud_hid_report(REPORT_ID_GAMEPAD, &report, sizeof(report));
|
103
|
|
-
|
104
|
|
- has_gamepad_key = true;
|
|
104
|
+ //report.hat = GAMEPAD_HAT_UP;
|
|
105
|
+ //report.buttons = GAMEPAD_BUTTON_A;
|
|
106
|
+ //tud_hid_report(REPORT_ID_GAMEPAD, &report, sizeof(report));
|
|
107
|
+ //has_gamepad_key = true;
|
105
|
108
|
} else {
|
106
|
|
- report.hat = GAMEPAD_HAT_CENTERED;
|
107
|
|
- report.buttons = 0;
|
108
|
|
- if (has_gamepad_key) tud_hid_report(REPORT_ID_GAMEPAD, &report, sizeof(report));
|
109
|
|
- has_gamepad_key = false;
|
|
109
|
+ //report.hat = GAMEPAD_HAT_CENTERED;
|
|
110
|
+ //report.buttons = 0;
|
|
111
|
+ //if (has_gamepad_key) tud_hid_report(REPORT_ID_GAMEPAD, &report, sizeof(report));
|
|
112
|
+ //has_gamepad_key = false;
|
110
|
113
|
}
|
111
|
114
|
}
|
112
|
115
|
break;
|