我在STM32L1的RTC警报中断方面遇到问题。我希望我的程序每5秒触发一次RTC警报中断,但它每1秒触发一次中断...
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) {
wakeUpCounter++;
HAL_RTC_GetTime(hrtc, &sTime, RTC_FORMAT_BIN);
next_second = sTime.Seconds+5;
if (next_second > 59) next_second = 0;
sAlarm.AlarmTime.Hours = sTime.Hours;
sAlarm.AlarmTime.Minutes = sTime.Minutes;
sAlarm.AlarmTime.Seconds = next_second;
sAlarm.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM;
sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET;
sAlarm.AlarmMask = RTC_ALARMMASK_ALL;
sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
sAlarm.AlarmDateWeekDay = 1;
sAlarm.Alarm = RTC_ALARM_A;
HAL_RTC_SetAlarm_IT(hrtc, &sAlarm, FORMAT_BIN);
}