mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 10:20:57 +00:00
Fix bug during initialization of DFU Mode
This commit is contained in:
parent
c5b8ef1529
commit
fdc91f8d2c
@ -67,7 +67,7 @@ static bool dfu_mode_state_machine(uint8_t rhport, tusb_control_request_t const
|
||||
//--------------------------------------------------------------------+
|
||||
void dfu_mode_init(void)
|
||||
{
|
||||
_dfu_state_ctx.state = DFU_IDLE;
|
||||
_dfu_state_ctx.state = APP_DETACH; // After init, reset will occur. We want to be in APP_DETACH to move to DFU_IDLE
|
||||
_dfu_state_ctx.status = DFU_STATUS_OK;
|
||||
_dfu_state_ctx.attrs = tud_dfu_mode_init_attrs_cb();
|
||||
_dfu_state_ctx.blk_transfer_in_proc = false;
|
||||
@ -79,6 +79,10 @@ void dfu_mode_init(void)
|
||||
|
||||
void dfu_mode_reset(uint8_t rhport)
|
||||
{
|
||||
if (_dfu_state_ctx.state == APP_DETACH)
|
||||
{
|
||||
_dfu_state_ctx.state = DFU_IDLE;
|
||||
} else {
|
||||
if ( tud_dfu_mode_usb_reset_cb )
|
||||
{
|
||||
tud_dfu_mode_usb_reset_cb(rhport, &_dfu_state_ctx.state);
|
||||
@ -106,6 +110,7 @@ void dfu_mode_reset(uint8_t rhport)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(_dfu_state_ctx.state == APP_IDLE)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user