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:
wangfq
2026-06-25 16:21:57 +08:00
parent 6fd4e564e3
commit 95808f9f25
966 changed files with 406958 additions and 84 deletions

113
vd960DBN/BLE/HAL/RTC.c Normal file
View File

@@ -0,0 +1,113 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : RTC.c
* Author : WCH
* Version : V1.2
* Date : 2022/01/18
* Description : RTC configuration and its initialization
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
/******************************************************************************/
/* Header file contains */
#include "HAL.h"
/*********************************************************************
* CONSTANTS
*/
#define RTC_INIT_TIME_HOUR 0
#define RTC_INIT_TIME_MINUTE 0
#define RTC_INIT_TIME_SECEND 0
/***************************************************
* Global variables
*/
volatile uint32_t RTCTigFlag;
/*******************************************************************************
* @fn RTC_SetTignTime
*
* @brief Configure RTC trigger time
*
* @param time - Trigger time.
*
* @return None.
*/
void RTC_SetTignTime(uint32_t time)
{
RTC_WaitForLastTask();
RTC_SetAlarm(time);
RTC_WaitForLastTask();
RTCTigFlag = 0;
}
/*******************************************************************************
* @fn HAL_Time0Init
*
* @brief System timer initialization
*
* @param None.
*
* @return None.
*/
void HAL_TimeInit(void)
{
uint16_t temp=0;
uint8_t state=0;
bleClockConfig_t conf={0};
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR|RCC_APB1Periph_BKP, ENABLE);
PWR_BackupAccessCmd(ENABLE);
#if( CLK_OSC32K )
RCC_LSICmd(ENABLE);
RCC_LSEConfig(RCC_LSE_OFF);
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
#else
RCC_LSEConfig(RCC_LSE_ON);
/* Check the specified RCC logo position settings or not,
* wait for the low-speed crystal oscillator to be ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{
temp++;
Delay_Ms(10);
}
if(temp>=250)
{
printf("time error..\n");
}
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
#endif
RCC_RTCCLKCmd(ENABLE);
RTC_WaitForLastTask();
RTC_WaitForLastTask();
RTC_SetPrescaler(1);
RTC_WaitForLastTask();
RTC_SetCounter(0);
RTC_WaitForLastTask();
#if( CLK_OSC32K )
Lib_Calibration_LSI();
#endif
conf.ClockAccuracy = CLK_OSC32K?1000:100;
conf.ClockFrequency = CAB_LSIFQ/2;
conf.ClockMaxCount = 0xFFFFFFFF;
conf.getClockValue = RTC_GetCounter;
state = TMOS_TimerInit( &conf );
if(state)
{
PRINT("TMOS_TimerInit err %x\n",state);
}
}
__attribute__((interrupt("WCH-Interrupt-fast")))
void RTCAlarm_IRQHandler(void)
{
RTCTigFlag = 1;
EXTI_ClearITPendingBit(EXTI_Line17);
RTC_ClearITPendingBit(RTC_IT_ALR);
RTC_WaitForLastTask();
}
/******************************** endfile @ time ******************************/