ze9hyr 563d11f8cd 警告消除及代码格式化
修改文件头信息

修改ACM32F030 BSP的文件格式

新增BSP驱动中的lib文件

IAR和GCC支持备份

1. 修复不能包含HAL_EFLASH.h问题, 2. 消除GCC编译的几个警告

1. gcc启动文件重命名;2. 文件头信息修改; 3. 硬件timer支持修改

移动 .ignore_format.yml到bsp的目录下

修改目录成相对目录
2021-09-08 13:10:39 +08:00

72 lines
1.6 KiB
C

/***********************************************************************
* Filename : HAL_IWDT.c
* Description : HAL IWDT driver source file
* Author(s) : CWT
* version : V1.0
* Modify date : 2020-04-17
***********************************************************************/
#include "ACM32Fxx_HAL.h"
HAL_StatusTypeDef HAL_IWDT_Init(IWDT_HandleTypeDef * hidt)
{
if (hidt == NULL)
{
return HAL_ERROR;
}
System_Delay(1);
System_Enable_Disable_RTC_Domain_Access(FUNC_ENABLE);
System_Enable_RC32K();
System_Enable_Disable_Reset(RESET_ENABLE_SOURCE_IWDT, FUNC_ENABLE);
/*Enable IWDT */
hidt->Instance->CMDR = IWDT_ENABLE_COMMAND;
System_Delay(10);
/*Enable Write */
hidt->Instance->CMDR = IWDT_WRITE_ENABLE_COMMAND;
System_Delay(10);
hidt->Instance->PR = hidt->Init.Prescaler;
hidt->Instance->RLR = hidt->Init.Reload;
hidt->Instance->WINR = hidt->Init.Window;
hidt->Instance->WUTR = hidt->Init.Wakeup;
System_Delay(1);
while(hidt->Instance->SR & (0x0F)){}; // wait for configuration done
if (hidt->Init.Reload > hidt->Init.Wakeup)
{
/*Enable Wake up */
hidt->Instance->CMDR = IWDT_WAKEUP_ENABLE_COMMAND;
}
hidt->Instance->CMDR = IWDT_RELOAD_COMMAND;
System_Delay(1);
while(hidt->Instance->SR & (1 << 4)){};
return HAL_OK;
}
HAL_StatusTypeDef HAL_IWDT_Kick_Watchdog_Wait_For_Done(IWDT_HandleTypeDef * hidt)
{
hidt->Instance->CMDR = IWDT_RELOAD_COMMAND;
System_Delay(1);
while(hidt->Instance->SR & (1 << 4)){}; //wait for kick watchdog done
return HAL_OK;
}