refactor(vd960Loop): 算法回退到 DLD154V4B,四通道适配
- 用 DLD154V4B vd1_task/per_channel 替换 vds_task 复杂算法
- 移除 FUNCTION_B/二次判断/快速变化/多重确认等增强特性
- 保留平坦性离开算法 (CN200910309382),每通道独立状态
- 灵敏度表改为 DLD154V4B 4级: {216,108,36,10} / {108,72,18,9}
- 清理废弃类型: FltHistoryManager, Loop_ACS_Info, StageRangeConfig 等
- 首次添加 vd960DBN 完整源码
This commit is contained in:
149
vd960Loop/libraries/drivers/src/at32f421_wwdt.c
Normal file
149
vd960Loop/libraries/drivers/src/at32f421_wwdt.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f421_wwdt.c
|
||||
* @brief contains all the functions for the wwdt firmware library
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
#include "at32f421_conf.h"
|
||||
|
||||
/** @addtogroup AT32F421_periph_driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup WWDT
|
||||
* @brief WWDT driver modules
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef WWDT_MODULE_ENABLED
|
||||
|
||||
/** @defgroup WWDT_private_functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief wwdt reset by crm reset register
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_reset(void)
|
||||
{
|
||||
crm_periph_reset(CRM_WWDT_PERIPH_RESET, TRUE);
|
||||
crm_periph_reset(CRM_WWDT_PERIPH_RESET, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt division set
|
||||
* @param division
|
||||
* this parameter can be one of the following values:
|
||||
* - WWDT_PCLK1_DIV_4096 (wwdt counter clock = (pclk1/4096)/1)
|
||||
* - WWDT_PCLK1_DIV_8192 (wwdt counter clock = (pclk1/4096)/2)
|
||||
* - WWDT_PCLK1_DIV_16384 (wwdt counter clock = (pclk1/4096)/4)
|
||||
* - WWDT_PCLK1_DIV_32768 (wwdt counter clock = (pclk1/4096)/8)
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_divider_set(wwdt_division_type division)
|
||||
{
|
||||
WWDT->cfg_bit.div = division;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt reload counter interrupt flag clear
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_flag_clear(void)
|
||||
{
|
||||
WWDT->sts = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt enable and the counter value load
|
||||
* @param wwdt_cnt (0x40~0x7f)
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_enable(uint8_t wwdt_cnt)
|
||||
{
|
||||
WWDT->ctrl = wwdt_cnt | WWDT_EN_BIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt reload counter interrupt enable
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_interrupt_enable(void)
|
||||
{
|
||||
WWDT->cfg_bit.rldien = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt reload counter interrupt flag get
|
||||
* @param none
|
||||
* @retval state of reload counter interrupt flag
|
||||
*/
|
||||
flag_status wwdt_flag_get(void)
|
||||
{
|
||||
return (flag_status)WWDT->sts_bit.rldf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt reload counter interrupt flag get
|
||||
* @param none
|
||||
* @retval state of reload counter interrupt flag
|
||||
*/
|
||||
flag_status wwdt_interrupt_flag_get(void)
|
||||
{
|
||||
return (flag_status)(WWDT->sts_bit.rldf && WWDT->cfg_bit.rldien);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt counter value set
|
||||
* @param wwdt_cnt (0x40~0x7f)
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_counter_set(uint8_t wwdt_cnt)
|
||||
{
|
||||
WWDT->ctrl_bit.cnt = wwdt_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wwdt window counter value set
|
||||
* @param window_cnt (0x40~0x7f)
|
||||
* @retval none
|
||||
*/
|
||||
void wwdt_window_counter_set(uint8_t window_cnt)
|
||||
{
|
||||
WWDT->cfg_bit.win = window_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
Reference in New Issue
Block a user