dfu: add DFU to USB description
This commit is contained in:
parent
96557190bf
commit
46d8a07dac
|
@ -49,6 +49,7 @@ if(CONFIG_TINYUSB_DFU)
|
||||||
"${tusb_idf}/tinyusb/src/class/midi/midi_device.c"
|
"${tusb_idf}/tinyusb/src/class/midi/midi_device.c"
|
||||||
"${tusb_idf}/tinyusb/src/class/msc/msc_device.c"
|
"${tusb_idf}/tinyusb/src/class/msc/msc_device.c"
|
||||||
"${tusb_idf}/tinyusb/src/class/vendor/vendor_device.c"
|
"${tusb_idf}/tinyusb/src/class/vendor/vendor_device.c"
|
||||||
|
"${tusb_idf}/tinyusb/src/class/dfu/dfu_rt_device.c"
|
||||||
"${tusb_idf}/tinyusb/src/common/tusb_fifo.c"
|
"${tusb_idf}/tinyusb/src/common/tusb_fifo.c"
|
||||||
"${tusb_idf}/tinyusb/src/device/usbd_control.c"
|
"${tusb_idf}/tinyusb/src/device/usbd_control.c"
|
||||||
"${tusb_idf}/tinyusb/src/device/usbd.c"
|
"${tusb_idf}/tinyusb/src/device/usbd.c"
|
||||||
|
|
|
@ -19,7 +19,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USB_ESPRESSIF_VID 0x303A
|
#define USB_ESPRESSIF_VID 0x303A
|
||||||
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE 7
|
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE 8
|
||||||
|
|
||||||
typedef enum{
|
typedef enum{
|
||||||
TINYUSB_USBDEV_0,
|
TINYUSB_USBDEV_0,
|
||||||
|
|
|
@ -91,6 +91,7 @@ extern "C" {
|
||||||
#define CFG_TUD_HID CONFIG_TINYUSB_DFU_HID_ENABLED
|
#define CFG_TUD_HID CONFIG_TINYUSB_DFU_HID_ENABLED
|
||||||
#define CFG_TUD_MIDI CONFIG_TINYUSB_DFU_MIDI_ENABLED
|
#define CFG_TUD_MIDI CONFIG_TINYUSB_DFU_MIDI_ENABLED
|
||||||
#define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_DFU_CUSTOM_CLASS_ENABLED
|
#define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_DFU_CUSTOM_CLASS_ENABLED
|
||||||
|
#define CFG_TUD_DFU_RUNTIME 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,13 @@ enum {
|
||||||
ITF_NUM_HID,
|
ITF_NUM_HID,
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
ITF_NUM_DFU_RT,
|
||||||
ITF_NUM_TOTAL
|
ITF_NUM_TOTAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TUSB_DESC_TOTAL_LEN = TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + CFG_TUD_MSC * TUD_MSC_DESC_LEN +
|
TUSB_DESC_TOTAL_LEN = TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + CFG_TUD_MSC * TUD_MSC_DESC_LEN +
|
||||||
CFG_TUD_HID * TUD_HID_DESC_LEN
|
CFG_TUD_HID * TUD_HID_DESC_LEN + TUD_DFU_RT_DESC_LEN
|
||||||
};
|
};
|
||||||
|
|
||||||
bool tusb_desc_set;
|
bool tusb_desc_set;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "descriptors_control.h"
|
#include "descriptors_control.h"
|
||||||
|
#include "class/dfu/dfu_rt_device.h"
|
||||||
|
|
||||||
static const char *TAG = "tusb_desc";
|
static const char *TAG = "tusb_desc";
|
||||||
static tusb_desc_device_t s_descriptor;
|
static tusb_desc_device_t s_descriptor;
|
||||||
|
@ -41,8 +42,11 @@ uint8_t const desc_configuration[] = {
|
||||||
# endif
|
# endif
|
||||||
# if CFG_TUD_HID
|
# if CFG_TUD_HID
|
||||||
// Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval
|
// Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval
|
||||||
TUD_HID_DESCRIPTOR(ITF_NUM_HID, 6, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x84, 16, 10)
|
TUD_HID_DESCRIPTOR(ITF_NUM_HID, 6, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x84, 16, 10),
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
// Interface number, string index, attributes, detach timeout, transfer size */
|
||||||
|
TUD_DFU_RT_DESCRIPTOR(ITF_NUM_DFU_RT, 7, 0x0d, 1000, 4096),
|
||||||
};
|
};
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
|
@ -56,7 +56,8 @@ tusb_desc_strarray_device_t descriptor_str_tinyusb = {
|
||||||
"123456", // 3: Serials, should use chip ID
|
"123456", // 3: Serials, should use chip ID
|
||||||
"TinyUSB CDC", // 4: CDC Interface
|
"TinyUSB CDC", // 4: CDC Interface
|
||||||
"TinyUSB MSC", // 5: MSC Interface
|
"TinyUSB MSC", // 5: MSC Interface
|
||||||
"TinyUSB HID" // 6: HID
|
"TinyUSB HID", // 6: HID
|
||||||
|
"TinyUSB DFU RT" // 7: DFU RT
|
||||||
};
|
};
|
||||||
/* End of TinyUSB default */
|
/* End of TinyUSB default */
|
||||||
|
|
||||||
|
@ -121,10 +122,10 @@ tusb_desc_strarray_device_t descriptor_str_kconfig = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_TINYUSB_DFU_HID_ENABLED
|
#if CONFIG_TINYUSB_DFU_HID_ENABLED
|
||||||
CONFIG_TINYUSB_DFU_DESC_HID_STRING // 6: HIDs
|
CONFIG_TINYUSB_DFU_DESC_HID_STRING, // 6: HIDs
|
||||||
#else
|
#else
|
||||||
"",
|
"",
|
||||||
#endif
|
#endif
|
||||||
|
"DFU (runtime mode)" // 7: DFU RT
|
||||||
};
|
};
|
||||||
/* End of Kconfig driven Descriptor */
|
/* End of Kconfig driven Descriptor */
|
||||||
|
|
Loading…
Reference in New Issue