Reactor to one functional descriptor.

This commit is contained in:
Mengsk
2021-07-07 18:02:04 +02:00
parent 71c0043261
commit 941b02c6a9
5 changed files with 72 additions and 48 deletions

View File

@@ -76,14 +76,16 @@
#define CFG_TUD_ENDPOINT0_SIZE 64
#endif
// DFU buffer size, must to be set to the largest buffer size used by an any given storage type
#define CFG_TUD_DFU_TRANSFER_BUFFER_SIZE 4096
//------------- CLASS -------------//
#define CFG_TUD_DFU_RUNTIME 0
#define CFG_TUD_DFU_MODE 1
// Count of all alt settings, typically it's the partition count (Flash, EEPROM, etc.)
#define CFG_TUD_DFU_ALT_COUNT 2
// DFU buffer size, it has to be set to the buffer size used in TUD_DFU_MODE_DESCRIPTOR
#define CFG_TUD_DFU_TRANSFER_BUFFER_SIZE 4096
#ifdef __cplusplus
}
#endif

View File

@@ -87,7 +87,7 @@ enum
ITF_NUM_TOTAL
};
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + 2 * TUD_DFU_MODE_DESC_LEN)
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_DFU_MODE_DESC_LEN)
#define FUNC_ATTRS (DFU_FUNC_ATTR_CAN_UPLOAD_BITMASK | DFU_FUNC_ATTR_CAN_DOWNLOAD_BITMASK)
@@ -96,9 +96,8 @@ uint8_t const desc_configuration[] =
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, attributes, detach timeout, transfer size */
TUD_DFU_MODE_DESCRIPTOR(ITF_NUM_DFU_MODE, 0, 4, FUNC_ATTRS, 1000, CFG_TUD_DFU_TRANSFER_BUFFER_SIZE),
TUD_DFU_MODE_DESCRIPTOR(ITF_NUM_DFU_MODE, 1, 5, FUNC_ATTRS, 1000, CFG_TUD_DFU_TRANSFER_BUFFER_SIZE),
// Interface number, detach timeout, transfer size, string index 0, [string index 1 ... string index n]
TUD_DFU_MODE_DESCRIPTOR(ITF_NUM_DFU_MODE, 0, FUNC_ATTRS, 1000, CFG_TUD_DFU_TRANSFER_BUFFER_SIZE, 4, 5),
};
// Invoked when received GET CONFIGURATION DESCRIPTOR