Skip to content

Commit 647f6b2

Browse files
committed
use tud_hid_n() API
1 parent b75604f commit 647f6b2

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/arduino/hid/Adafruit_USBD_HID.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,23 @@ bool Adafruit_USBD_HID::begin(void) {
186186
return true;
187187
}
188188

189-
bool Adafruit_USBD_HID::ready(void) { return tud_hid_ready(); }
189+
bool Adafruit_USBD_HID::ready(void) { return tud_hid_n_ready(_instance); }
190190

191191
bool Adafruit_USBD_HID::sendReport(uint8_t report_id, void const *report,
192192
uint8_t len) {
193-
return tud_hid_report(report_id, report, len);
193+
return tud_hid_n_report(_instance, report_id, report, len);
194194
}
195195

196196
bool Adafruit_USBD_HID::sendReport8(uint8_t report_id, uint8_t num) {
197-
return tud_hid_report(report_id, &num, sizeof(num));
197+
return tud_hid_n_report(_instance, report_id, &num, sizeof(num));
198198
}
199199

200200
bool Adafruit_USBD_HID::sendReport16(uint8_t report_id, uint16_t num) {
201-
return tud_hid_report(report_id, &num, sizeof(num));
201+
return tud_hid_n_report(_instance, report_id, &num, sizeof(num));
202202
}
203203

204204
bool Adafruit_USBD_HID::sendReport32(uint8_t report_id, uint32_t num) {
205-
return tud_hid_report(report_id, &num, sizeof(num));
205+
return tud_hid_n_report(_instance, report_id, &num, sizeof(num));
206206
}
207207

208208
//------------- TinyUSB callbacks -------------//
@@ -258,7 +258,7 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id,
258258

259259
bool Adafruit_USBD_HID::keyboardReport(uint8_t report_id, uint8_t modifier,
260260
uint8_t keycode[6]) {
261-
return tud_hid_keyboard_report(report_id, modifier, keycode);
261+
return tud_hid_n_keyboard_report(_instance, report_id, modifier, keycode);
262262
}
263263

264264
bool Adafruit_USBD_HID::keyboardPress(uint8_t report_id, char ch) {
@@ -271,11 +271,11 @@ bool Adafruit_USBD_HID::keyboardPress(uint8_t report_id, char ch) {
271271
}
272272
keycode[0] = _ascii2keycode[uch][1];
273273

274-
return tud_hid_keyboard_report(report_id, modifier, keycode);
274+
return tud_hid_n_keyboard_report(_instance, report_id, modifier, keycode);
275275
}
276276

277277
bool Adafruit_USBD_HID::keyboardRelease(uint8_t report_id) {
278-
return tud_hid_keyboard_report(report_id, 0, NULL);
278+
return tud_hid_n_keyboard_report(_instance, report_id, 0, NULL);
279279
}
280280

281281
//--------------------------------------------------------------------+
@@ -288,24 +288,27 @@ bool Adafruit_USBD_HID::mouseReport(uint8_t report_id, uint8_t buttons,
288288
// cache mouse button for other API such as move, scroll
289289
_mouse_button = buttons;
290290

291-
return tud_hid_mouse_report(report_id, buttons, x, y, vertical, horizontal);
291+
return tud_hid_n_mouse_report(_instance, report_id, buttons, x, y, vertical,
292+
horizontal);
292293
}
293294

294295
bool Adafruit_USBD_HID::mouseMove(uint8_t report_id, int8_t x, int8_t y) {
295-
return tud_hid_mouse_report(report_id, _mouse_button, x, y, 0, 0);
296+
return tud_hid_n_mouse_report(_instance, report_id, _mouse_button, x, y, 0,
297+
0);
296298
}
297299

298300
bool Adafruit_USBD_HID::mouseScroll(uint8_t report_id, int8_t scroll,
299301
int8_t pan) {
300-
return tud_hid_mouse_report(report_id, _mouse_button, 0, 0, scroll, pan);
302+
return tud_hid_n_mouse_report(_instance, report_id, _mouse_button, 0, 0,
303+
scroll, pan);
301304
}
302305

303306
bool Adafruit_USBD_HID::mouseButtonPress(uint8_t report_id, uint8_t buttons) {
304-
return tud_hid_mouse_report(report_id, buttons, 0, 0, 0, 0);
307+
return tud_hid_n_mouse_report(_instance, report_id, buttons, 0, 0, 0, 0);
305308
}
306309

307310
bool Adafruit_USBD_HID::mouseButtonRelease(uint8_t report_id) {
308-
return tud_hid_mouse_report(report_id, 0, 0, 0, 0, 0);
311+
return tud_hid_n_mouse_report(_instance, report_id, 0, 0, 0, 0, 0);
309312
}
310313

311314
#endif // CFG_TUD_ENABLED

0 commit comments

Comments
 (0)