From a296a263b2bca35a9c30de375f10cf4d64e8a62f Mon Sep 17 00:00:00 2001 From: YuanHongbin <975559679@qq.com> Date: Wed, 29 Jul 2026 14:54:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DRTC=E9=97=B9=E9=92=9F?= =?UTF-8?q?=E4=B8=AD=E6=96=AD=E9=A3=8E=E6=9A=B4=E5=AF=BC=E8=87=B4=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=81=87=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 关闭未使用的闹钟中断(Rtc_AlmIeCmd改为FALSE) 2. Rtc_IRQHandler增加闹钟标志清除,防止残留标志引发中断死循环 --- source/src/bsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/src/bsp.c b/source/src/bsp.c index d916d5b..6d07e16 100644 --- a/source/src/bsp.c +++ b/source/src/bsp.c @@ -1,4 +1,4 @@ -#include +#include #include #include "sysctrl.h" #include "gpio.h" @@ -303,7 +303,7 @@ void RTCInit(uint8_t sec) RtcInitStruct.rtcCompen = RtcCompenEnable; RtcInitStruct.rtcCompValue = 0; //补偿值 根据实际情况进行补偿 Rtc_Init(&RtcInitStruct); - Rtc_AlmIeCmd(TRUE); //使能闹钟中断 + Rtc_AlmIeCmd(FALSE); //关闭闹钟中断(未使用) EnableNvic(RTC_IRQn, IrqLevel3, TRUE); //使能RTC中断向量 Rtc_Cmd(TRUE); //使能RTC开始计数 Rtc_StartWait(); //启动RTC计数,如果要立即切换到低功耗,需要执行此函数 @@ -813,6 +813,8 @@ void Uart0_IRQHandler(void) void Rtc_IRQHandler(void) { + if(Rtc_GetAlmItStatus() == TRUE) + Rtc_ClearAlmItStatus(); if(Rtc_GetPridItStatus() == TRUE) { Rtc_ClearPrdfItStatus(); //清除中断标志位 RtcIRQHander();