Skip to content

Commit 6eb5a28

Browse files
committed
update hid generic inout exmaple to work with esp32s2, update changelog
1 parent c00c628 commit 6eb5a28

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Adafruit TinyUSB Arduino Library Changelog
22

3+
## 1.5.0 - 2021.09.29
4+
5+
- Add support for ESP32-S2 core version 2.0.0
6+
- ESP32 port relies on Espressif's [esp32-hal-tinyusb.c](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-tinyusb.c) for building usb descriptors which requires all descriptors must be specified in usb objects declaration i.e constructors. Therefore all descriptor-related fields must be part of object declaration and descriptor-related API have no effect afterwards for this port.
7+
8+
- Add new constructor for Adafruit_USBD_HID(desc_report, len, protocol, interval_ms, has_out_endpoint)
9+
310
## 1.4.4 - 2021.08.18
411

512
- Update tinyusb stack

examples/HID/hid_generic_inout/hid_generic_inout.ino

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ uint8_t const desc_hid_report[] =
4444
TUD_HID_REPORT_DESC_GENERIC_INOUT(64)
4545
};
4646

47-
Adafruit_USBD_HID usb_hid;
47+
// USB HID object. For ESP32 these values cannot be changed after this declaration
48+
// desc report, desc len, protocol, interval, use out endpoint
49+
Adafruit_USBD_HID usb_hid(desc_hid_report, sizeof(desc_hid_report), HID_ITF_PROTOCOL_NONE, 2, true);
4850

4951
// the setup function runs once when you press reset or power the board
5052
void setup()
@@ -54,12 +56,13 @@ void setup()
5456
TinyUSB_Device_Init(0);
5557
#endif
5658

57-
usb_hid.enableOutEndpoint(true);
58-
usb_hid.setPollInterval(2);
59-
usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report));
60-
usb_hid.setReportCallback(get_report_callback, set_report_callback);
61-
//usb_hid.setStringDescriptor("TinyUSB HID Generic");
59+
// Notes: following commented-out functions has no affect on ESP32
60+
// usb_hid.enableOutEndpoint(true);
61+
// usb_hid.setPollInterval(2);
62+
// usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report));
63+
// usb_hid.setStringDescriptor("TinyUSB HID Generic");
6264

65+
usb_hid.setReportCallback(get_report_callback, set_report_callback);
6366
usb_hid.begin();
6467

6568
Serial.begin(115200);

0 commit comments

Comments
 (0)