2023-03-05 17:17:19 +00:00
|
|
|
#include "usb_dfu.h"
|
|
|
|
#include "stm32f3xx_hal.h"
|
|
|
|
#include "tusb.h"
|
|
|
|
|
|
|
|
// Invoked on DFU_DETACH request to reboot to the bootloader
|
|
|
|
void tud_dfu_runtime_reboot_to_dfu_cb(void)
|
|
|
|
{
|
2023-03-12 20:44:55 +00:00
|
|
|
/* Use the watchdog timer for a timed reset. This assures
|
|
|
|
* the host can close the open pipe before the device reboots. */
|
2023-03-05 17:17:19 +00:00
|
|
|
|
|
|
|
IWDG_HandleTypeDef IWDGHandle = {
|
|
|
|
.Instance = IWDG,
|
|
|
|
.Init = {
|
|
|
|
.Prescaler = IWDG_PRESCALER_4,
|
|
|
|
.Reload = 128,
|
|
|
|
.Window = 0x0FFF
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
HAL_IWDG_Init(&IWDGHandle);
|
|
|
|
}
|