@@ -38,8 +38,14 @@ Adafruit_USBD_HID::Adafruit_USBD_HID(void)
38
38
{
39
39
_interval_ms = 10 ;
40
40
_protocol = HID_PROTOCOL_NONE;
41
+
42
+ _mouse_button = 0 ;
43
+
41
44
_desc_report = NULL ;
42
45
_desc_report_len = 0 ;
46
+
47
+ _get_report_cb = NULL ;
48
+ _set_report_cb = NULL ;
43
49
}
44
50
45
51
void Adafruit_USBD_HID::setPollInterval (uint8_t interval_ms)
@@ -110,31 +116,35 @@ bool Adafruit_USBD_HID::keyboardPress(uint8_t report_id, char ch)
110
116
111
117
if ( _ascii2keycode[ch][0 ] ) modifier = KEYBOARD_MODIFIER_LEFTSHIFT;
112
118
keycode[0 ] = _ascii2keycode[ch][1 ];
113
- tud_hid_keyboard_report (report_id, modifier, keycode);
119
+
120
+ return tud_hid_keyboard_report (report_id, modifier, keycode);
114
121
}
115
122
116
123
bool Adafruit_USBD_HID::keyboardRelease (uint8_t report_id)
117
124
{
118
- return tud_hid_keyboard_key_release (report_id);
125
+ return tud_hid_keyboard_report (report_id, 0 , NULL );
119
126
}
120
127
121
128
// --------------------------------------------------------------------+
122
129
// Mouse
123
130
// --------------------------------------------------------------------+
124
131
125
- bool Adafruit_USBD_HID::mouseReport (uint8_t report_id, uint8_t buttons, int8_t x, int8_t y, int8_t scroll , int8_t pan )
132
+ bool Adafruit_USBD_HID::mouseReport (uint8_t report_id, uint8_t buttons, int8_t x, int8_t y, int8_t vertical , int8_t horizontal )
126
133
{
127
- return tud_hid_mouse_report (report_id, buttons, x, y, scroll, pan);
134
+ // cache mouse button for other API such as move, scroll
135
+ _mouse_button = buttons;
136
+
137
+ return tud_hid_mouse_report (report_id, buttons, x, y, vertical, horizontal);
128
138
}
129
139
130
140
bool Adafruit_USBD_HID::mouseMove (uint8_t report_id, int8_t x, int8_t y)
131
141
{
132
- return tud_hid_mouse_move (report_id, x, y);
142
+ return tud_hid_mouse_report (report_id, _mouse_button, x, y, 0 , 0 );
133
143
}
134
144
135
145
bool Adafruit_USBD_HID::mouseScroll (uint8_t report_id, int8_t scroll, int8_t pan)
136
146
{
137
- return tud_hid_mouse_scroll (report_id, scroll, pan);
147
+ return tud_hid_mouse_report (report_id, _mouse_button, 0 , 0 , scroll, pan);
138
148
}
139
149
140
150
bool Adafruit_USBD_HID::mouseButtonPress (uint8_t report_id, uint8_t buttons)
0 commit comments