summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-03-18 18:10:32 +0700
committerGitHub <[email protected]>2026-03-18 18:10:32 +0700
commit766ac4f7a2c223bb85312c8bb99f8c478c211bae (patch)
tree795c7b40c1d8567378ae052a783b0d8b28531ec5 /examples/device
parent8f7f286ae347ec1adbfd0888d65fb1aeb263b7d2 (diff)
parent0521e6698eb0719c27ef7c2473c9152be30ae172 (diff)
Merge pull request #3557 from hathach/hil-host-cdc
add more hil tests
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/hid_generic_inout/src/usb_descriptors.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/device/hid_generic_inout/src/usb_descriptors.c b/examples/device/hid_generic_inout/src/usb_descriptors.c
index f26333d50..929b2fd3a 100644
--- a/examples/device/hid_generic_inout/src/usb_descriptors.c
+++ b/examples/device/hid_generic_inout/src/usb_descriptors.c
@@ -97,7 +97,15 @@ enum
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_HID_INOUT_DESC_LEN)
-#define EPNUM_HID 0x01
+#if defined(TUD_ENDPOINT_ONE_DIRECTION_ONLY)
+ // MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
+ // e.g EP1 OUT & EP1 IN cannot exist together
+ #define EPNUM_HID_OUT 0x01
+ #define EPNUM_HID_IN 0x82
+#else
+ #define EPNUM_HID_OUT 0x01
+ #define EPNUM_HID_IN 0x81
+#endif
uint8_t const desc_configuration[] =
{
@@ -105,7 +113,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
// Interface number, string index, protocol, report descriptor len, EP Out & In address, size & polling interval
- TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, 0x80 | EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
+ TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID_OUT, EPNUM_HID_IN, CFG_TUD_HID_EP_BUFSIZE, 10)
};
// Invoked when received GET CONFIGURATION DESCRIPTOR