汇集网友智慧,解决技术难题
RTC tc
赞0
评论
2020-09-09
点击图片添加到编辑器内容中
点击文件名将附件添加到文章中
提交
tyw
314个答案
天意无罪
284个答案
xch
203个答案
jjjyufan
197个答案
coody
183个答案
LcwSwust
136个答案
chunyang
135个答案
呐咯密密
108个答案
赞0
唉,还是没有什么结果,算了,多谢大家啦
评论
2020-09-09
赞0
评论
2020-09-09
赞0
评论
2020-09-09
赞0
评论
2020-09-09
赞0
{
NVIC_InitTypeDef NVIC_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
/* 2 bit for pre-emption priority, 2 bits for subpriority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
//------RTC闹钟-------------------------------------------------------
NVIC_InitStructure.NVIC_IRQChannel = RTC_Alarm_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
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);
// 键盘
NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//蓝牙
NVIC_InitStructure.NVIC_IRQChannel = BLE_INT_EXTI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//恢复出厂按键
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#if WATCHDOG_ENABLE
NVIC_InitStructure.NVIC_IRQChannel = WWDG_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 4;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#endif
//------TIM6-------------------------------------------------------
NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 5;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#if LOCK_WITH_FINGERPRINT
// 指纹
NVIC_InitStructure.NVIC_IRQChannel = FP_MODULE_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 6;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#endif
//------TIM4读卡-------------------------------------------------------
NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 7;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//------TIM3-------------------------------------------------------
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 8;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// console串口
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 9;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 10;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 11;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 12;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);void RTC_Alarm_IRQHandler(void)
{
keylock_t * keylock=Keylock_Msg_Accept();
RFID_ChkCard_Disable();
if (RTC_GetITStatus(RTC_IT_ALRA) != RESET)
{
RTC_ClearITPendingBit(RTC_IT_ALRA);
EXTI_ClearITPendingBit(EXTI_Line17);
//System_Sleep_Disable();
IntWakeupSce.Sys_sync_flag= SYNC_RECYCLE;
}
if (RTC_GetITStatus(RTC_IT_ALRB) != RESET)
{
RTC_ClearITPendingBit(RTC_IT_ALRB);
EXTI_ClearITPendingBit(EXTI_Line17);
if (keylock->lockedflag == TRUE)
{
IntWakeupSce.lockedrelease = TRUE;
}
}
#ifdef CHECK_WAKEUP_MODE
wakeup_mode |= WAKEUP_BY_RTC;
#endif
void RTC_RandomPwUpdate_Alarm(void)
{
RTC_TimeTypeDef RTC_TimeStruct;
RTC_AlarmTypeDef RTC_AlarmStruct;
APP_TRACE_DBG("%s %d\n", __FUNCTION__, __LINE__);
RTC_GetTime(RTC_Format_BIN, &RTC_TimeStruct);
RTCTime_AddCalculate(1, CALCULATE_HOUR, &RTC_TimeStruct);
/* Allow access to BKP Domain */
PWR_RTCAccessCmd(ENABLE);
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
RTC_AlarmStruct.RTC_AlarmTime.RTC_H12 = RTC_TimeStruct.RTC_H12;
RTC_AlarmStruct.RTC_AlarmTime.RTC_Hours = RTC_TimeStruct.RTC_Hours;
RTC_AlarmStruct.RTC_AlarmTime.RTC_Minutes = (RTC_TimeStruct.RTC_Minutes + 10) % 60;
RTC_AlarmStruct.RTC_AlarmTime.RTC_Seconds = 0;
RTC_AlarmStruct.RTC_AlarmDateWeekDay = 0x31;
RTC_AlarmStruct.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
RTC_AlarmStruct.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay| RTC_AlarmMask_Hours;
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStruct);
RTC_WaitForSynchro();
RTC_ClearFlag(RTC_FLAG_ALRAF);
EXTI_ClearITPendingBit(EXTI_Line17);
RTC_ITConfig(RTC_IT_ALRA, ENABLE);
RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
我这里改成10分钟一次.
本来我要的是1个小时一次中断
评论
2020-09-09
赞0
评论
2020-09-09
赞0
评论
2020-09-09
赞0
评论
2020-09-09
您需要登录后才可以回复 登录 | 注册