From c1e6196d3da930a82f12313bce04205b3488f7f1 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期日, 24 三月 2024 09:22:59 +0800 Subject: [PATCH] Merge branch '免布线标签-lora-泰斗GPS' of http://47.108.70.204:60062/r/XRange_Tag into 免布线标签-lora-泰斗GPS --- Src/OnChipDevices/RTC.c | 88 ++++++++++++++++++++++---------------------- 1 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Src/OnChipDevices/RTC.c b/Src/OnChipDevices/RTC.c index 65ebfd8..b228016 100644 --- a/Src/OnChipDevices/RTC.c +++ b/Src/OnChipDevices/RTC.c @@ -3,66 +3,66 @@ 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(uint16_t interval) { - EXTI_InitTypeDef EXTI_InitStructure; - - /* Enable PWR and BKP clocks */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); + EXTI_InitTypeDef EXTI_InitStructure; - /* Allow access to BKP Domain */ - PWR_BackupAccessCmd(ENABLE); + /* Enable PWR and BKP clocks */ + RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); - /* Reset Backup Domain */ - //BKP_DeInit(); + /* Allow access to BKP Domain */ + PWR_BackupAccessCmd(ENABLE); - RCC_LSICmd(ENABLE); - /* Enable LSE */ - //RCC_LSEConfig(RCC_LSE_ON); - /* Wait till LSE is ready */ - while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET){} + /* Reset Backup Domain */ + //BKP_DeInit(); - /* Select LSE as RTC Clock Source */ - RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI); + RCC_LSICmd(ENABLE); + /* Enable LSE */ + //RCC_LSEConfig(RCC_LSE_ON); + /* Wait till LSE is ready */ + while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET) {} - /* Enable RTC Clock */ - RCC_RTCCLKCmd(ENABLE); + /* Select LSE as RTC Clock Source */ + RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI); - /* Wait for RTC registers synchronization */ - RTC_WaitForSynchro(); + /* Enable RTC Clock */ + RCC_RTCCLKCmd(ENABLE); - /* Wait until last write operation on RTC registers has finished */ - RTC_WaitForLastTask(); + /* Wait for RTC registers synchronization */ + RTC_WaitForSynchro(); - /* Enable the RTC Second */ - //RTC_ITConfig(RTC_IT_SEC, ENABLE); + /* Wait until last write operation on RTC registers has finished */ + RTC_WaitForLastTask(); - /* Wait until last write operation on RTC registers has finished */ - RTC_WaitForLastTask(); - - RTC_ITConfig(RTC_IT_ALR,ENABLE); //?? RTC ??? - RTC_WaitForLastTask(); - /* Set RTC prescaler: set RTC period to 1sec */ - RTC_SetPrescaler(interval); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) */ + /* Enable the RTC Second */ + //RTC_ITConfig(RTC_IT_SEC, ENABLE); - /* Wait until last write operation on RTC registers has finished */ - RTC_WaitForLastTask(); - RTC_SET_ALARM(1); - - //RTC外部中断使能 - EXTI_InitStructure.EXTI_Line = EXTI_Line17; + /* Wait until last write operation on RTC registers has finished */ + RTC_WaitForLastTask(); + + RTC_ITConfig(RTC_IT_ALR,ENABLE); //?? RTC ??? + RTC_WaitForLastTask(); + /* Set RTC prescaler: set RTC period to 1sec */ + 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); + + //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); - + EXTI_Init(&EXTI_InitStructure); + } -- Gitblit v1.9.3