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:
37
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/ch32v20x_conf.h
Normal file
37
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/ch32v20x_conf.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : ch32v20x_conf.h
|
||||
* Author : WCH
|
||||
* Version : V1.0.0
|
||||
* Date : 2022/06/16
|
||||
* Description : Library configuration file.
|
||||
*********************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __CH32V20x_CONF_H
|
||||
#define __CH32V20x_CONF_H
|
||||
|
||||
#include "ch32v20x_adc.h"
|
||||
#include "ch32v20x_bkp.h"
|
||||
#include "ch32v20x_can.h"
|
||||
#include "ch32v20x_crc.h"
|
||||
#include "ch32v20x_dbgmcu.h"
|
||||
#include "ch32v20x_dma.h"
|
||||
#include "ch32v20x_exti.h"
|
||||
#include "ch32v20x_flash.h"
|
||||
#include "ch32v20x_gpio.h"
|
||||
#include "ch32v20x_i2c.h"
|
||||
#include "ch32v20x_iwdg.h"
|
||||
#include "ch32v20x_pwr.h"
|
||||
#include "ch32v20x_rcc.h"
|
||||
#include "ch32v20x_rtc.h"
|
||||
#include "ch32v20x_spi.h"
|
||||
#include "ch32v20x_tim.h"
|
||||
#include "ch32v20x_usart.h"
|
||||
#include "ch32v20x_wwdg.h"
|
||||
#include "ch32v20x_it.h"
|
||||
#include "ch32v20x_misc.h"
|
||||
|
||||
#endif /* __CH32V20x_CONF_H */
|
||||
18
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/ch32v20x_it.h
Normal file
18
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/ch32v20x_it.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : ch32v20x_it.h
|
||||
* Author : WCH
|
||||
* Version : V1.0.0
|
||||
* Date : 2022/06/16
|
||||
* Description : This file contains the headers of the interrupt handlers.
|
||||
*********************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __CH32V20x_IT_H
|
||||
#define __CH32V20x_IT_H
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#endif /* __CH32V20x_IT_H */
|
||||
111
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/ota.h
Normal file
111
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/ota.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : ota.h
|
||||
* Author : WCH
|
||||
* Version : V1.10
|
||||
* Date : 2018/12/14
|
||||
* Description : oad相关配置定义
|
||||
*********************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef __OTA_H
|
||||
#define __OTA_H
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* OTA FLASH
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* 整个用户code区分成3块,依次为16K,240K,192K 分别叫做imageIAP(IAP),imageA(APP),LIB */
|
||||
|
||||
/* FLASH定义 */
|
||||
|
||||
#define FLASH_BLOCK_SIZE 4096
|
||||
#define FLASH_PAGE_SIZE 256
|
||||
|
||||
/* imageIAP定义 */
|
||||
#define IMAGE_IAP_FLAG 0x02
|
||||
#define IMAGE_IAP_START_ADD 0x08000000
|
||||
#define IMAGE_IAP_SIZE 16 * 1024
|
||||
|
||||
/* imageA定义 */
|
||||
#define IMAGE_A_FLAG 0x01
|
||||
#define IMAGE_A_START_ADD (IMAGE_IAP_START_ADD+IMAGE_IAP_SIZE)
|
||||
#define IMAGE_A_SIZE 240 * 1024
|
||||
|
||||
#define IMAGE_OTA_FLAG 0x03
|
||||
|
||||
#define jumpApp ((void (*)(void))((int *)(IMAGE_A_START_ADD-0x08000000)))
|
||||
|
||||
/* IAP定义 */
|
||||
/* 以下为IAP下载命令定义 */
|
||||
#define CMD_IAP_PROM 0x80 // IAP编程命令
|
||||
#define CMD_IAP_ERASE 0x81 // IAP擦除命令
|
||||
#define CMD_IAP_VERIFY 0x82 // IAP校验命令
|
||||
#define CMD_IAP_END 0x83 // IAP结束标志
|
||||
#define CMD_IAP_INFO 0x84 // IAP获取设备信息
|
||||
|
||||
/* 数据帧长度定义 */
|
||||
#define IAP_LEN 247
|
||||
|
||||
/* 存放在DataFlash地址,不能占用蓝牙的位置 */
|
||||
#define OTA_DATAFLASH_ADD 0x08077000
|
||||
|
||||
/* 存放在DataFlash里的OTA信息 */
|
||||
typedef struct
|
||||
{
|
||||
unsigned char ImageFlag; //记录的当前的image标志
|
||||
unsigned char flag[3];
|
||||
} OTADataFlashInfo_t;
|
||||
|
||||
/* OTA IAP通讯协议定义 */
|
||||
/* 地址使用4倍偏移 */
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned char cmd; /* 命令码 0x81 */
|
||||
unsigned char len; /* 后续数据长度 */
|
||||
unsigned char addr[2]; /* 擦除地址 */
|
||||
unsigned char block_num[2]; /* 擦除块数 */
|
||||
|
||||
} erase; /* 擦除命令 */
|
||||
struct
|
||||
{
|
||||
unsigned char cmd; /* 命令码 0x83 */
|
||||
unsigned char len; /* 后续数据长度 */
|
||||
unsigned char status[2]; /* 两字节状态,保留 */
|
||||
} end; /* 结束命令 */
|
||||
struct
|
||||
{
|
||||
unsigned char cmd; /* 命令码 0x82 */
|
||||
unsigned char len; /* 后续数据长度 */
|
||||
unsigned char addr[2]; /* 校验地址 */
|
||||
unsigned char buf[IAP_LEN - 4]; /* 校验数据 */
|
||||
} verify; /* 校验命令 */
|
||||
struct
|
||||
{
|
||||
unsigned char cmd; /* 命令码 0x80 */
|
||||
unsigned char len; /* 后续数据长度 */
|
||||
unsigned char addr[2]; /* 地址 */
|
||||
unsigned char buf[IAP_LEN - 4]; /* 后续数据 */
|
||||
} program; /* 编程命令 */
|
||||
struct
|
||||
{
|
||||
unsigned char cmd; /* 命令码 0x84 */
|
||||
unsigned char len; /* 后续数据长度 */
|
||||
unsigned char buf[IAP_LEN - 2]; /* 后续数据 */
|
||||
} info; /* 编程命令 */
|
||||
struct
|
||||
{
|
||||
unsigned char buf[IAP_LEN]; /* 接收数据包*/
|
||||
} other;
|
||||
} OTA_IAP_CMD_t;
|
||||
|
||||
/* 记录当前的Image */
|
||||
extern unsigned char CurrImageFlag;
|
||||
|
||||
#endif
|
||||
63
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/peripheral.h
Normal file
63
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/peripheral.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : peripheral.h
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2018/12/11
|
||||
* Description :
|
||||
*********************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef PERIPHERAL_H
|
||||
#define PERIPHERAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
||||
// Simple BLE Peripheral Task Events
|
||||
#define SBP_START_DEVICE_EVT 0x0001
|
||||
#define SBP_PERIODIC_EVT 0x0002
|
||||
#define OTA_FLASH_ERASE_EVT 0x0004 //OTA Flash²Á³ýÈÎÎñ
|
||||
|
||||
/*********************************************************************
|
||||
* MACROS
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
* FUNCTIONS
|
||||
*/
|
||||
|
||||
/*
|
||||
* Task Initialization for the BLE Application
|
||||
*/
|
||||
extern void Peripheral_Init(void);
|
||||
|
||||
/*
|
||||
* Task Event Processor for the BLE Application
|
||||
*/
|
||||
extern uint16_t Peripheral_ProcessEvent(uint8_t task_id, uint16_t events);
|
||||
|
||||
/*
|
||||
* Read flash
|
||||
*/
|
||||
void FLASH_read(uint32_t addr, uint8_t *pData, uint32_t len);
|
||||
|
||||
/*********************************************************************
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
31
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/system_ch32v20x.h
Normal file
31
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/include/system_ch32v20x.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : system_ch32v20x.h
|
||||
* Author : WCH
|
||||
* Version : V1.0.0
|
||||
* Date : 2022/06/16
|
||||
* Description : CH32V20x Device Peripheral Access Layer System Header File.
|
||||
*********************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __SYSTEM_ch32v20x_H
|
||||
#define __SYSTEM_ch32v20x_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
|
||||
|
||||
/* System_Exported_Functions */
|
||||
extern void SystemInit(void);
|
||||
extern void SystemCoreClockUpdate(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__CH32V20x_SYSTEM_H */
|
||||
Reference in New Issue
Block a user