43 lines
597 B
C
Raw Normal View History

2021-12-27 15:16:32 +08:00
#include <stdio.h>
#include "wm_hal.h"
void Error_Handler(void);
2022-02-18 11:27:58 +08:00
static void WDG_Init(void);
WDG_HandleTypeDef hwdg;
2021-12-27 15:16:32 +08:00
int main(void)
{
2022-02-18 11:27:58 +08:00
SystemClock_Config(CPU_CLK_160M);
2021-12-27 15:16:32 +08:00
printf("enter main\r\n");
2022-02-18 11:27:58 +08:00
WDG_Init();
2021-12-27 15:16:32 +08:00
while (1)
{
printf(".");
HAL_Delay(1000);
}
}
2022-02-18 11:27:58 +08:00
static void WDG_Init(void)
{
hwdg.Instance = WDG;
hwdg.Init.Reload = 5 * 1000 * 1000; // 5s
if (HAL_WDG_Init(&hwdg) != HAL_OK)
{
Error_Handler();
}
}
2021-12-27 15:16:32 +08:00
void Error_Handler(void)
{
while (1)
{
}
}
void assert_failed(uint8_t *file, uint32_t line)
{
printf("Wrong parameters value: file %s on line %d\r\n", file, line);
}