充能统计添加中间值滤波

修改晶振起振超时时间和flash相关以适应gd32
This commit is contained in:
ranchuan
2024-02-03 16:50:16 +08:00
parent caa4e61b89
commit 87ad52847e
19 changed files with 532 additions and 63 deletions

View File

@@ -82,8 +82,8 @@
#define FLASH_BANK1_END_ADDRESS ((uint32_t)0x807FFFF)
/* Delay definition */
#define EraseTimeout ((uint32_t)0x000B0000)
#define ProgramTimeout ((uint32_t)0x00002000)
#define EraseTimeout ((uint32_t)0x000FFFFF)
#define ProgramTimeout ((uint32_t)0x0000FFFF)
/**
* @}
*/
@@ -632,6 +632,8 @@ FLASH_Status FLASH_EraseOptionBytes(void)
/* Authorize the small information block programming */
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
__NOP();
__NOP();
/* if the previous operation is completed, proceed to erase the option bytes */
FLASH->CR |= CR_OPTER_Set;
@@ -938,6 +940,8 @@ FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
/* Authorize the small information block programming */
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
__NOP();
__NOP();
/* Enables the Option Bytes Programming operation */
FLASH->CR |= CR_OPTPG_Set;
*(__IO uint16_t*)Address = Data;
@@ -995,6 +999,8 @@ FLASH_Status FLASH_EnableWriteProtection(uint32_t FLASH_Pages)
/* Authorizes the small information block programming */
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
__NOP();
__NOP();
FLASH->CR |= CR_OPTPG_Set;
if(WRP0_Data != 0xFF)
{
@@ -1057,6 +1063,8 @@ FLASH_Status FLASH_ReadOutProtection(FunctionalState NewState)
/* Authorizes the small information block programming */
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
__NOP();
__NOP();
FLASH->CR |= CR_OPTER_Set;
FLASH->CR |= CR_STRT_Set;
/* Wait for last operation to be completed */