diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/dfu/src/main.c | 7 | ||||
| -rw-r--r-- | examples/device/dfu/src/usb_descriptors.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/examples/device/dfu/src/main.c b/examples/device/dfu/src/main.c index 81532ee90..f7c27174a 100644 --- a/examples/device/dfu/src/main.c +++ b/examples/device/dfu/src/main.c @@ -125,6 +125,13 @@ bool tud_dfu_firmware_valid_check_cb(uint8_t alt) return true; } +uint16_t tud_dfu_set_timeout_cb(uint8_t alt) +{ + // For example Alt1 (EEPROM) is slow, add 2000ms timeout + if (alt == 1) return 2000; + return 0; +} + void tud_dfu_req_dnload_data_cb(uint8_t alt, uint16_t wBlockNum, uint8_t* data, uint16_t length) { (void) data; diff --git a/examples/device/dfu/src/usb_descriptors.c b/examples/device/dfu/src/usb_descriptors.c index 200817eb4..8c5eee455 100644 --- a/examples/device/dfu/src/usb_descriptors.c +++ b/examples/device/dfu/src/usb_descriptors.c @@ -96,8 +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, 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), + // Interface number, attributes, detach timeout, transfer size, string index 0, [string index 1 ... string index n] + TUD_DFU_MODE_DESCRIPTOR(ITF_NUM_DFU_MODE, FUNC_ATTRS, 1000, CFG_TUD_DFU_TRANSFER_BUFFER_SIZE, 4, 5), }; // Invoked when received GET CONFIGURATION DESCRIPTOR |
