add reboot to bootloader on 1200baud callback to family to support auto reboot
This commit is contained in:
parent
177503b03e
commit
146f7bcc73
|
@ -31,6 +31,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stm32h7xx_hal_rtc_ex.h>
|
||||
|
||||
#define LED_PORT GPIOK
|
||||
#define LED_PIN GPIO_PIN_7
|
||||
#define LED_STATE_ON 1
|
||||
|
@ -138,6 +140,14 @@ static inline void board_stm32h7_clock_init(void)
|
|||
|
||||
}
|
||||
|
||||
static inline void reboot1200bps(void)
|
||||
{
|
||||
RTC_HandleTypeDef RTCHandle;
|
||||
RTCHandle.Instance = RTC;
|
||||
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR0, 0xDF59);
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
static inline void board_stm32h7_post_init(void)
|
||||
{
|
||||
// For this board does nothing
|
||||
|
|
|
@ -242,7 +242,6 @@ int board_uart_write(void const * buf, int len)
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
volatile uint32_t system_ticks = 0;
|
||||
void SysTick_Handler(void)
|
||||
|
@ -256,6 +255,15 @@ uint32_t board_millis(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
void tud_cdc_line_coding_cb(__unused uint8_t itf, cdc_line_coding_t const* p_line_coding) {
|
||||
if (p_line_coding->bit_rate == 1200) {
|
||||
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_7, 1);
|
||||
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_6, 0);
|
||||
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_5, 0);
|
||||
reboot1200bps();
|
||||
}
|
||||
}
|
||||
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
asm("bkpt");
|
||||
|
|
|
@ -42,6 +42,8 @@ SRC_C += \
|
|||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rcc_ex.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rtc.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_rtc_ex.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_gpio.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_uart.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_pwr_ex.c \
|
||||
|
|
|
@ -89,7 +89,8 @@
|
|||
/* #define HAL_RAMECC_MODULE_ENABLED */
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
/* #define HAL_RTC_MODULE_ENABLED */
|
||||
#define HAL_RTC_MODULE_ENABLED
|
||||
#define HAL_RTC_EX_MODULE_ENABLED
|
||||
/* #define HAL_SAI_MODULE_ENABLED */
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||
|
@ -396,6 +397,10 @@
|
|||
#include "stm32h7xx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_EX_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_rtc_ex.h"
|
||||
#endif /* HAL_RTC_EX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SAI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_sai.h"
|
||||
#endif /* HAL_SAI_MODULE_ENABLED */
|
||||
|
|
Loading…
Reference in New Issue