From 4410c6d09af90006414d442a9b1a9043f5596ed4 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期四, 24 二月 2022 16:19:14 +0800
Subject: [PATCH] V1.67

---
 源码/核心板/Src/OnChipDevices/RTC.c |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/RTC.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/RTC.c"
index 6b53987..65ebfd8 100644
--- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/RTC.c"
+++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/RTC.c"
@@ -1,15 +1,20 @@
 #include "RTC.h"
+
+
 void RTC_SET_ALARM(u32 sec)
 {
-//DEBUG_COM_STREAM("-??-",NULL);
-RTC_SetAlarm(RTC_GetCounter()+sec);
-//DEBUG_COM_STREAM("-??1-",NULL);
-RTC_WaitForLastTask();
-//DEBUG_COM_STREAM("-??2-",NULL);
-RTC_ITConfig(RTC_FLAG_ALR,ENABLE);
+	//DEBUG_COM_STREAM("-??-",NULL);
+	RTC_SetAlarm(RTC_GetCounter()+sec);
+	//DEBUG_COM_STREAM("-??1-",NULL);
+	RTC_WaitForLastTask();
+	//DEBUG_COM_STREAM("-??2-",NULL);
+	RTC_ITConfig(RTC_FLAG_ALR,ENABLE);
 }
-void RTC_Configuration(void)
+
+void RTC_Configuration(uint16_t interval)
 {
+	EXTI_InitTypeDef EXTI_InitStructure;
+	
 	/* Enable PWR and BKP clocks */
 	RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
 
@@ -46,9 +51,18 @@
 	RTC_ITConfig(RTC_IT_ALR,ENABLE); //?? RTC ???  
 		RTC_WaitForLastTask();
 	/* Set RTC prescaler: set RTC period to 1sec */
-	RTC_SetPrescaler(40000); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) */
+	RTC_SetPrescaler(interval); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) */
 
 	/* Wait until last write operation on RTC registers has finished */
 	RTC_WaitForLastTask();
 	RTC_SET_ALARM(1);
-}
\ No newline at end of file
+	
+	//RTC外部中断使能
+	EXTI_InitStructure.EXTI_Line = EXTI_Line17;
+    EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
+    EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
+    EXTI_InitStructure.EXTI_LineCmd = ENABLE;
+    EXTI_Init(&EXTI_InitStructure); 
+	
+}
+

--
Gitblit v1.9.3