mirror of
https://github.com/hathach/tinyusb.git
synced 2026-03-23 07:54:58 +00:00
fix hid_generic_inout for TUD_ENDPOINT_ONE_DIRECTION_ONLY MCUs
Use separate endpoint numbers (EP1 OUT, EP2 IN) on MCUs with shared FIFO that cannot support the same endpoint number in both directions. Also add missing static qualifier to print_musb_info(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -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
|
||||
|
||||
@ -494,7 +494,7 @@ static void process_bus_reset(uint8_t rhport) {
|
||||
*------------------------------------------------------------------*/
|
||||
|
||||
#if CFG_TUSB_DEBUG >= MUSB_DEBUG
|
||||
void print_musb_info(musb_regs_t* musb_regs) {
|
||||
static void print_musb_info(musb_regs_t* musb_regs) {
|
||||
// print version, epinfo, raminfo, config_data0, fifo_size
|
||||
TU_LOG1("musb version = %u.%u\r\n", musb_regs->hwvers_bit.major, musb_regs->hwvers_bit.minor);
|
||||
TU_LOG1("Number of endpoints: %u TX, %u RX\r\n", musb_regs->epinfo_bit.tx_ep_num, musb_regs->epinfo_bit.rx_ep_num);
|
||||
|
||||
Reference in New Issue
Block a user