Add DFU_DETACH support

This commit is contained in:
Mengsk 2021-07-07 12:07:10 +02:00
parent 88478594bc
commit 3949fb9e8c
2 changed files with 8 additions and 1 deletions

View File

@ -263,6 +263,12 @@ bool dfu_moded_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_reque
switch (request->bRequest)
{
case DFU_REQUEST_DETACH:
{
tud_control_status(rhport, request);
if (tud_dfu_reboot_cb) tud_dfu_reboot_cb();
break;
}
case DFU_REQUEST_DNLOAD:
{
if ( (stage == CONTROL_STAGE_ACK)
@ -273,7 +279,6 @@ bool dfu_moded_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_reque
return true;
}
} // fallthrough
case DFU_REQUEST_DETACH:
case DFU_REQUEST_UPLOAD:
case DFU_REQUEST_GETSTATUS:
case DFU_REQUEST_CLRSTATUS:

View File

@ -81,6 +81,8 @@ TU_ATTR_WEAK void tud_dfu_abort_cb(void);
// Return the number of bytes to write
TU_ATTR_WEAK uint16_t tud_dfu_req_upload_data_cb(uint8_t alt, uint16_t block_num, uint8_t* data, uint16_t length);
// Invoked when a DFU_DETACH request is received
TU_ATTR_WEAK void tud_dfu_reboot_cb(void);
//--------------------------------------------------------------------+
// Internal Class Driver API
//--------------------------------------------------------------------+