Skip to content

Commit 99736ac

Browse files
committed
add Adafruit_USBD_HID::getProtocol
Add a getProtocol method, allowing an application to query whether the HID interface is currently set to Boot or Report Protocol.
1 parent 185692b commit 99736ac

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/arduino/hid/Adafruit_USBD_HID.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ bool Adafruit_USBD_HID::sendReport32(uint8_t report_id, uint32_t num) {
217217
return tud_hid_n_report(_instance, report_id, &num, sizeof(num));
218218
}
219219

220+
uint8_t Adafruit_USBD_HID::getProtocol() {
221+
return tud_hid_n_get_protocol(_instance);
222+
}
223+
220224
//------------- TinyUSB callbacks -------------//
221225
extern "C" {
222226

src/arduino/hid/Adafruit_USBD_HID.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class Adafruit_USBD_HID : public Adafruit_USBD_Interface {
6161
bool ready(void);
6262
bool sendReport(uint8_t report_id, void const *report, uint8_t len);
6363

64+
uint8_t getProtocol();
65+
6466
// Report helpers
6567
bool sendReport8(uint8_t report_id, uint8_t num);
6668
bool sendReport16(uint8_t report_id, uint16_t num);

0 commit comments

Comments
 (0)