300 #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F)
301 #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F)
302 #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF)
303 #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
304 #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
305 RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \
306 RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \
307 RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F | \
308 RTC_FLAG_RECALPF | RTC_FLAG_SHPF))
310 #define INITMODE_TIMEOUT ((uint32_t) 0x00010000)
311 #define SYNCHRO_TIMEOUT ((uint32_t) 0x00020000)
312 #define RECALPF_TIMEOUT ((uint32_t) 0x00020000)
313 #define SHPF_TIMEOUT ((uint32_t) 0x00001000)
377 __IO uint32_t wutcounter = 0x00;
378 uint32_t wutwfstatus = 0x00;
379 ErrorStatus status = ERROR;
393 RTC->TR = (uint32_t)0x00000000;
394 RTC->DR = (uint32_t)0x00002101;
396 RTC->CR &= (uint32_t)0x00000007;
401 wutwfstatus = RTC->ISR & RTC_ISR_WUTWF;
403 }
while((wutcounter != INITMODE_TIMEOUT) && (wutwfstatus == 0x00));
405 if ((RTC->ISR & RTC_ISR_WUTWF) == RESET)
412 RTC->CR &= (uint32_t)0x00000000;
413 RTC->WUTR = (uint32_t)0x0000FFFF;
414 RTC->PRER = (uint32_t)0x007F00FF;
415 RTC->CALIBR = (uint32_t)0x00000000;
416 RTC->ALRMAR = (uint32_t)0x00000000;
417 RTC->ALRMBR = (uint32_t)0x00000000;
418 RTC->SHIFTR = (uint32_t)0x00000000;
419 RTC->CALR = (uint32_t)0x00000000;
420 RTC->ALRMASSR = (uint32_t)0x00000000;
421 RTC->ALRMBSSR = (uint32_t)0x00000000;
424 RTC->ISR = (uint32_t)0x00000000;
427 RTC->TAFCR = 0x00000000;
459 ErrorStatus status = ERROR;
478 RTC->CR &= ((uint32_t)~(RTC_CR_FMT));
528 assert_param(IS_FUNCTIONAL_STATE(NewState));
530 if (NewState != DISABLE)
554 __IO uint32_t initcounter = 0x00;
555 ErrorStatus status = ERROR;
556 uint32_t initstatus = 0x00;
559 if ((RTC->ISR & RTC_ISR_INITF) == (uint32_t)RESET)
562 RTC->ISR = (uint32_t)RTC_INIT_MASK;
567 initstatus = RTC->ISR & RTC_ISR_INITF;
569 }
while((initcounter != INITMODE_TIMEOUT) && (initstatus == 0x00));
571 if ((RTC->ISR & RTC_ISR_INITF) != RESET)
600 RTC->ISR &= (uint32_t)~RTC_ISR_INIT;
621 __IO uint32_t synchrocounter = 0;
622 ErrorStatus status = ERROR;
623 uint32_t synchrostatus = 0x00;
630 RTC->ISR &= (uint32_t)RTC_RSF_MASK;
635 synchrostatus = RTC->ISR & RTC_ISR_RSF;
637 }
while((synchrocounter != SYNCHRO_TIMEOUT) && (synchrostatus == 0x00));
639 if ((RTC->ISR & RTC_ISR_RSF) != RESET)
664 ErrorStatus status = ERROR;
667 assert_param(IS_FUNCTIONAL_STATE(NewState));
680 if (NewState != DISABLE)
683 RTC->CR |= RTC_CR_REFCKON;
688 RTC->CR &= ~RTC_CR_REFCKON;
713 assert_param(IS_FUNCTIONAL_STATE(NewState));
719 if (NewState != DISABLE)
722 RTC->CR |= (uint8_t)RTC_CR_BYPSHAD;
727 RTC->CR &= (uint8_t)~RTC_CR_BYPSHAD;
768 ErrorStatus status = ERROR;
771 assert_param(IS_RTC_FORMAT(RTC_Format));
773 if (RTC_Format == RTC_Format_BIN)
775 if ((RTC->CR & RTC_CR_FMT) != (uint32_t)RESET)
777 assert_param(IS_RTC_HOUR12(RTC_TimeStruct->
RTC_Hours));
778 assert_param(IS_RTC_H12(RTC_TimeStruct->
RTC_H12));
782 RTC_TimeStruct->
RTC_H12 = 0x00;
783 assert_param(IS_RTC_HOUR24(RTC_TimeStruct->
RTC_Hours));
785 assert_param(IS_RTC_MINUTES(RTC_TimeStruct->
RTC_Minutes));
786 assert_param(IS_RTC_SECONDS(RTC_TimeStruct->
RTC_Seconds));
790 if ((RTC->CR & RTC_CR_FMT) != (uint32_t)RESET)
793 assert_param(IS_RTC_HOUR12(tmpreg));
794 assert_param(IS_RTC_H12(RTC_TimeStruct->
RTC_H12));
798 RTC_TimeStruct->
RTC_H12 = 0x00;
806 if (RTC_Format != RTC_Format_BIN)
808 tmpreg = (((uint32_t)(RTC_TimeStruct->
RTC_Hours) << 16) | \
811 ((uint32_t)(RTC_TimeStruct->
RTC_H12) << 16));
818 (((uint32_t)RTC_TimeStruct->
RTC_H12) << 16));
833 RTC->TR = (uint32_t)(tmpreg & RTC_TR_RESERVED_MASK);
839 if ((RTC->CR & RTC_CR_BYPSHAD) == RESET)
871 RTC_TimeStruct->
RTC_H12 = RTC_H12_AM;
892 assert_param(IS_RTC_FORMAT(RTC_Format));
895 tmpreg = (uint32_t)(RTC->TR & RTC_TR_RESERVED_MASK);
898 RTC_TimeStruct->
RTC_Hours = (uint8_t)((tmpreg & (RTC_TR_HT | RTC_TR_HU)) >> 16);
899 RTC_TimeStruct->
RTC_Minutes = (uint8_t)((tmpreg & (RTC_TR_MNT | RTC_TR_MNU)) >>8);
900 RTC_TimeStruct->
RTC_Seconds = (uint8_t)(tmpreg & (RTC_TR_ST | RTC_TR_SU));
901 RTC_TimeStruct->
RTC_H12 = (uint8_t)((tmpreg & (RTC_TR_PM)) >> 16);
904 if (RTC_Format == RTC_Format_BIN)
925 tmpreg = (uint32_t)(RTC->SSR);
948 ErrorStatus status = ERROR;
951 assert_param(IS_RTC_FORMAT(RTC_Format));
953 if ((RTC_Format == RTC_Format_BIN) && ((RTC_DateStruct->
RTC_Month & 0x10) == 0x10))
957 if (RTC_Format == RTC_Format_BIN)
959 assert_param(IS_RTC_YEAR(RTC_DateStruct->
RTC_Year));
960 assert_param(IS_RTC_MONTH(RTC_DateStruct->
RTC_Month));
961 assert_param(IS_RTC_DATE(RTC_DateStruct->
RTC_Date));
967 assert_param(IS_RTC_MONTH(tmpreg));
969 assert_param(IS_RTC_DATE(tmpreg));
971 assert_param(IS_RTC_WEEKDAY(RTC_DateStruct->
RTC_WeekDay));
974 if (RTC_Format != RTC_Format_BIN)
976 tmpreg = ((((uint32_t)RTC_DateStruct->
RTC_Year) << 16) | \
977 (((uint32_t)RTC_DateStruct->
RTC_Month) << 8) | \
978 ((uint32_t)RTC_DateStruct->
RTC_Date) | \
1001 RTC->DR = (uint32_t)(tmpreg & RTC_DR_RESERVED_MASK);
1007 if ((RTC->CR & RTC_CR_BYPSHAD) == RESET)
1041 RTC_DateStruct->
RTC_Month = RTC_Month_January;
1057 uint32_t tmpreg = 0;
1060 assert_param(IS_RTC_FORMAT(RTC_Format));
1063 tmpreg = (uint32_t)(RTC->DR & RTC_DR_RESERVED_MASK);
1066 RTC_DateStruct->
RTC_Year = (uint8_t)((tmpreg & (RTC_DR_YT | RTC_DR_YU)) >> 16);
1067 RTC_DateStruct->
RTC_Month = (uint8_t)((tmpreg & (RTC_DR_MT | RTC_DR_MU)) >> 8);
1068 RTC_DateStruct->
RTC_Date = (uint8_t)(tmpreg & (RTC_DR_DT | RTC_DR_DU));
1069 RTC_DateStruct->
RTC_WeekDay = (uint8_t)((tmpreg & (RTC_DR_WDU)) >> 13);
1072 if (RTC_Format == RTC_Format_BIN)
1117 uint32_t tmpreg = 0;
1120 assert_param(IS_RTC_FORMAT(RTC_Format));
1121 assert_param(IS_RTC_ALARM(RTC_Alarm));
1122 assert_param(IS_ALARM_MASK(RTC_AlarmStruct->
RTC_AlarmMask));
1125 if (RTC_Format == RTC_Format_BIN)
1127 if ((RTC->CR & RTC_CR_FMT) != (uint32_t)RESET)
1151 if ((RTC->CR & RTC_CR_FMT) != (uint32_t)RESET)
1154 assert_param(IS_RTC_HOUR12(tmpreg));
1169 assert_param(IS_RTC_ALARM_DATE_WEEKDAY_DATE(tmpreg));
1174 assert_param(IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(tmpreg));
1179 if (RTC_Format != RTC_Format_BIN)
1205 if (RTC_Alarm == RTC_Alarm_A)
1207 RTC->ALRMAR = (uint32_t)tmpreg;
1211 RTC->ALRMBR = (uint32_t)tmpreg;
1258 uint32_t tmpreg = 0;
1261 assert_param(IS_RTC_FORMAT(RTC_Format));
1262 assert_param(IS_RTC_ALARM(RTC_Alarm));
1265 if (RTC_Alarm == RTC_Alarm_A)
1267 tmpreg = (uint32_t)(RTC->ALRMAR);
1271 tmpreg = (uint32_t)(RTC->ALRMBR);
1276 RTC_ALRMAR_HU)) >> 16);
1278 RTC_ALRMAR_MNU)) >> 8);
1282 RTC_AlarmStruct->
RTC_AlarmDateWeekDay = (uint32_t)((tmpreg & (RTC_ALRMAR_DT | RTC_ALRMAR_DU)) >> 24);
1284 RTC_AlarmStruct->
RTC_AlarmMask = (uint32_t)(tmpreg & RTC_AlarmMask_All);
1286 if (RTC_Format == RTC_Format_BIN)
1289 RTC_AlarmTime.RTC_Hours);
1291 RTC_AlarmTime.RTC_Minutes);
1293 RTC_AlarmTime.RTC_Seconds);
1312 __IO uint32_t alarmcounter = 0x00;
1313 uint32_t alarmstatus = 0x00;
1314 ErrorStatus status = ERROR;
1317 assert_param(IS_RTC_CMD_ALARM(RTC_Alarm));
1318 assert_param(IS_FUNCTIONAL_STATE(NewState));
1325 if (NewState != DISABLE)
1327 RTC->CR |= (uint32_t)RTC_Alarm;
1334 RTC->CR &= (uint32_t)~RTC_Alarm;
1339 alarmstatus = RTC->ISR & (RTC_Alarm >> 8);
1341 }
while((alarmcounter != INITMODE_TIMEOUT) && (alarmstatus == 0x00));
1343 if ((RTC->ISR & (RTC_Alarm >> 8)) == RESET)
1406 uint32_t tmpreg = 0;
1409 assert_param(IS_RTC_ALARM(RTC_Alarm));
1410 assert_param(IS_RTC_ALARM_SUB_SECOND_VALUE(RTC_AlarmSubSecondValue));
1411 assert_param(IS_RTC_ALARM_SUB_SECOND_MASK(RTC_AlarmSubSecondMask));
1418 tmpreg = (uint32_t) (uint32_t)(RTC_AlarmSubSecondValue) | (uint32_t)(RTC_AlarmSubSecondMask);
1420 if (RTC_Alarm == RTC_Alarm_A)
1423 RTC->ALRMASSR = tmpreg;
1428 RTC->ALRMBSSR = tmpreg;
1447 uint32_t tmpreg = 0;
1450 if (RTC_Alarm == RTC_Alarm_A)
1452 tmpreg = (uint32_t)((RTC->ALRMASSR) & RTC_ALRMASSR_SS);
1456 tmpreg = (uint32_t)((RTC->ALRMBSSR) & RTC_ALRMBSSR_SS);
1497 assert_param(IS_RTC_WAKEUP_CLOCK(RTC_WakeUpClock));
1504 RTC->CR &= (uint32_t)~RTC_CR_WUCKSEL;
1507 RTC->CR |= (uint32_t)RTC_WakeUpClock;
1524 assert_param(IS_RTC_WAKEUP_COUNTER(RTC_WakeUpCounter));
1531 RTC->WUTR = (uint32_t)RTC_WakeUpCounter;
1545 return ((uint32_t)(RTC->WUTR & RTC_WUTR_WUT));
1556 __IO uint32_t wutcounter = 0x00;
1557 uint32_t wutwfstatus = 0x00;
1558 ErrorStatus status = ERROR;
1561 assert_param(IS_FUNCTIONAL_STATE(NewState));
1567 if (NewState != DISABLE)
1570 RTC->CR |= (uint32_t)RTC_CR_WUTE;
1576 RTC->CR &= (uint32_t)~RTC_CR_WUTE;
1580 wutwfstatus = RTC->ISR & RTC_ISR_WUTWF;
1582 }
while((wutcounter != INITMODE_TIMEOUT) && (wutwfstatus == 0x00));
1584 if ((RTC->ISR & RTC_ISR_WUTWF) == RESET)
1634 assert_param(IS_RTC_DAYLIGHT_SAVING(RTC_DayLightSaving));
1635 assert_param(IS_RTC_STORE_OPERATION(RTC_StoreOperation));
1642 RTC->CR &= (uint32_t)~(RTC_CR_BCK);
1645 RTC->CR |= (uint32_t)(RTC_DayLightSaving | RTC_StoreOperation);
1660 return (RTC->CR & RTC_CR_BCK);
1700 assert_param(IS_RTC_OUTPUT(RTC_Output));
1701 assert_param(IS_RTC_OUTPUT_POL(RTC_OutputPolarity));
1708 RTC->CR &= (uint32_t)~(RTC_CR_OSEL | RTC_CR_POL);
1711 RTC->CR |= (uint32_t)(RTC_Output | RTC_OutputPolarity);
1753 ErrorStatus status = ERROR;
1756 assert_param(IS_RTC_CALIB_SIGN(RTC_CalibSign));
1757 assert_param(IS_RTC_CALIB_VALUE(Value));
1771 RTC->CALIBR = (uint32_t)(RTC_CalibSign | Value);
1794 ErrorStatus status = ERROR;
1797 assert_param(IS_FUNCTIONAL_STATE(NewState));
1810 if (NewState != DISABLE)
1813 RTC->CR |= (uint32_t)RTC_CR_DCE;
1818 RTC->CR &= (uint32_t)~RTC_CR_DCE;
1841 assert_param(IS_FUNCTIONAL_STATE(NewState));
1847 if (NewState != DISABLE)
1850 RTC->CR |= (uint32_t)RTC_CR_COE;
1855 RTC->CR &= (uint32_t)~RTC_CR_COE;
1873 assert_param(IS_RTC_CALIB_OUTPUT(RTC_CalibOutput));
1880 RTC->CR &= (uint32_t)~(RTC_CR_COSEL);
1883 RTC->CR |= (uint32_t)RTC_CalibOutput;
1907 uint32_t RTC_SmoothCalibPlusPulses,
1908 uint32_t RTC_SmouthCalibMinusPulsesValue)
1910 ErrorStatus status = ERROR;
1911 uint32_t recalpfcount = 0;
1914 assert_param(IS_RTC_SMOOTH_CALIB_PERIOD(RTC_SmoothCalibPeriod));
1915 assert_param(IS_RTC_SMOOTH_CALIB_PLUS(RTC_SmoothCalibPlusPulses));
1916 assert_param(IS_RTC_SMOOTH_CALIB_MINUS(RTC_SmouthCalibMinusPulsesValue));
1923 if ((RTC->ISR & RTC_ISR_RECALPF) != RESET)
1926 while (((RTC->ISR & RTC_ISR_RECALPF) != RESET) && (recalpfcount != RECALPF_TIMEOUT))
1933 if ((RTC->ISR & RTC_ISR_RECALPF) == RESET)
1936 RTC->CALR = (uint32_t)((uint32_t)RTC_SmoothCalibPeriod | (uint32_t)RTC_SmoothCalibPlusPulses | (uint32_t)RTC_SmouthCalibMinusPulsesValue);
1948 return (ErrorStatus)(status);
1984 uint32_t tmpreg = 0;
1987 assert_param(IS_RTC_TIMESTAMP_EDGE(RTC_TimeStampEdge));
1988 assert_param(IS_FUNCTIONAL_STATE(NewState));
1991 tmpreg = (uint32_t)(RTC->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE));
1994 if (NewState != DISABLE)
1996 tmpreg |= (uint32_t)(RTC_TimeStampEdge | RTC_CR_TSE);
2000 tmpreg |= (uint32_t)(RTC_TimeStampEdge);
2008 RTC->CR = (uint32_t)tmpreg;
2029 uint32_t tmptime = 0, tmpdate = 0;
2032 assert_param(IS_RTC_FORMAT(RTC_Format));
2035 tmptime = (uint32_t)(RTC->TSTR & RTC_TR_RESERVED_MASK);
2036 tmpdate = (uint32_t)(RTC->TSDR & RTC_DR_RESERVED_MASK);
2039 RTC_StampTimeStruct->
RTC_Hours = (uint8_t)((tmptime & (RTC_TR_HT | RTC_TR_HU)) >> 16);
2040 RTC_StampTimeStruct->
RTC_Minutes = (uint8_t)((tmptime & (RTC_TR_MNT | RTC_TR_MNU)) >> 8);
2041 RTC_StampTimeStruct->
RTC_Seconds = (uint8_t)(tmptime & (RTC_TR_ST | RTC_TR_SU));
2042 RTC_StampTimeStruct->
RTC_H12 = (uint8_t)((tmptime & (RTC_TR_PM)) >> 16);
2046 RTC_StampDateStruct->
RTC_Month = (uint8_t)((tmpdate & (RTC_DR_MT | RTC_DR_MU)) >> 8);
2047 RTC_StampDateStruct->
RTC_Date = (uint8_t)(tmpdate & (RTC_DR_DT | RTC_DR_DU));
2048 RTC_StampDateStruct->
RTC_WeekDay = (uint8_t)((tmpdate & (RTC_DR_WDU)) >> 13);
2051 if (RTC_Format == RTC_Format_BIN)
2073 return (uint32_t)(RTC->TSSSR);
2108 assert_param(IS_RTC_TAMPER(RTC_Tamper));
2109 assert_param(IS_RTC_TAMPER_TRIGGER(RTC_TamperTrigger));
2111 if (RTC_TamperTrigger == RTC_TamperTrigger_RisingEdge)
2114 RTC->TAFCR &= (uint32_t)((uint32_t)~(RTC_Tamper << 1));
2119 RTC->TAFCR |= (uint32_t)(RTC_Tamper << 1);
2134 assert_param(IS_RTC_TAMPER(RTC_Tamper));
2135 assert_param(IS_FUNCTIONAL_STATE(NewState));
2137 if (NewState != DISABLE)
2140 RTC->TAFCR |= (uint32_t)RTC_Tamper;
2145 RTC->TAFCR &= (uint32_t)~RTC_Tamper;
2165 assert_param(IS_RTC_TAMPER_FILTER(RTC_TamperFilter));
2168 RTC->TAFCR &= (uint32_t)~(RTC_TAFCR_TAMPFLT);
2171 RTC->TAFCR |= (uint32_t)RTC_TamperFilter;
2199 assert_param(IS_RTC_TAMPER_SAMPLING_FREQ(RTC_TamperSamplingFreq));
2202 RTC->TAFCR &= (uint32_t)~(RTC_TAFCR_TAMPFREQ);
2205 RTC->TAFCR |= (uint32_t)RTC_TamperSamplingFreq;
2222 assert_param(IS_RTC_TAMPER_PRECHARGE_DURATION(RTC_TamperPrechargeDuration));
2225 RTC->TAFCR &= (uint32_t)~(RTC_TAFCR_TAMPPRCH);
2228 RTC->TAFCR |= (uint32_t)RTC_TamperPrechargeDuration;
2242 assert_param(IS_FUNCTIONAL_STATE(NewState));
2244 if (NewState != DISABLE)
2247 RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPTS;
2252 RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPTS;
2265 assert_param(IS_FUNCTIONAL_STATE(NewState));
2267 if (NewState != DISABLE)
2270 RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPPUDIS;
2275 RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPPUDIS;
2305 __IO uint32_t tmp = 0;
2308 assert_param(IS_RTC_BKP(RTC_BKP_DR));
2310 tmp = RTC_BASE + 0x50;
2311 tmp += (RTC_BKP_DR * 4);
2314 *(__IO uint32_t *)tmp = (uint32_t)Data;
2326 __IO uint32_t tmp = 0;
2329 assert_param(IS_RTC_BKP(RTC_BKP_DR));
2331 tmp = RTC_BASE + 0x50;
2332 tmp += (RTC_BKP_DR * 4);
2335 return (*(__IO uint32_t *)tmp);
2366 assert_param(IS_RTC_TAMPER_PIN(RTC_TamperPin));
2368 RTC->TAFCR &= (uint32_t)~(RTC_TAFCR_TAMPINSEL);
2369 RTC->TAFCR |= (uint32_t)(RTC_TamperPin);
2383 assert_param(IS_RTC_TIMESTAMP_PIN(RTC_TimeStampPin));
2385 RTC->TAFCR &= (uint32_t)~(RTC_TAFCR_TSINSEL);
2386 RTC->TAFCR |= (uint32_t)(RTC_TimeStampPin);
2402 assert_param(IS_RTC_OUTPUT_TYPE(RTC_OutputType));
2404 RTC->TAFCR &= (uint32_t)~(RTC_TAFCR_ALARMOUTTYPE);
2405 RTC->TAFCR |= (uint32_t)(RTC_OutputType);
2439 ErrorStatus status = ERROR;
2440 uint32_t shpfcount = 0;
2443 assert_param(IS_RTC_SHIFT_ADD1S(RTC_ShiftAdd1S));
2444 assert_param(IS_RTC_SHIFT_SUBFS(RTC_ShiftSubFS));
2451 if ((RTC->ISR & RTC_ISR_SHPF) != RESET)
2454 while (((RTC->ISR & RTC_ISR_SHPF) != RESET) && (shpfcount != SHPF_TIMEOUT))
2461 if ((RTC->ISR & RTC_ISR_SHPF) == RESET)
2464 if((RTC->CR & RTC_CR_REFCKON) == RESET)
2467 RTC->SHIFTR = (uint32_t)(uint32_t)(RTC_ShiftSubFS) | (uint32_t)(RTC_ShiftAdd1S);
2491 return (ErrorStatus)(status);
2560 assert_param(IS_RTC_CONFIG_IT(RTC_IT));
2561 assert_param(IS_FUNCTIONAL_STATE(NewState));
2567 if (NewState != DISABLE)
2570 RTC->CR |= (uint32_t)(RTC_IT & ~RTC_TAFCR_TAMPIE);
2572 RTC->TAFCR |= (uint32_t)(RTC_IT & RTC_TAFCR_TAMPIE);
2577 RTC->CR &= (uint32_t)~(RTC_IT & (uint32_t)~RTC_TAFCR_TAMPIE);
2579 RTC->TAFCR &= (uint32_t)~(RTC_IT & RTC_TAFCR_TAMPIE);
2607 FlagStatus bitstatus = RESET;
2608 uint32_t tmpreg = 0;
2611 assert_param(IS_RTC_GET_FLAG(RTC_FLAG));
2614 tmpreg = (uint32_t)(RTC->ISR & RTC_FLAGS_MASK);
2617 if ((tmpreg & RTC_FLAG) != (uint32_t)RESET)
2644 assert_param(IS_RTC_CLEAR_FLAG(RTC_FLAG));
2647 RTC->ISR = (uint32_t)((uint32_t)(~((RTC_FLAG | RTC_ISR_INIT)& 0x0000FFFF) | (uint32_t)(RTC->ISR & RTC_ISR_INIT)));
2663 ITStatus bitstatus = RESET;
2664 uint32_t tmpreg = 0, enablestatus = 0;
2667 assert_param(IS_RTC_GET_IT(RTC_IT));
2670 tmpreg = (uint32_t)(RTC->TAFCR & (RTC_TAFCR_TAMPIE));
2673 enablestatus = (uint32_t)((RTC->CR & RTC_IT) | (tmpreg & (RTC_IT >> 15)));
2676 tmpreg = (uint32_t)((RTC->ISR & (uint32_t)(RTC_IT >> 4)));
2679 if ((enablestatus != (uint32_t)RESET) && ((tmpreg & 0x0000FFFF) != (uint32_t)RESET))
2703 uint32_t tmpreg = 0;
2706 assert_param(IS_RTC_CLEAR_IT(RTC_IT));
2709 tmpreg = (uint32_t)(RTC_IT >> 4);
2712 RTC->ISR = (uint32_t)((uint32_t)(~((tmpreg | RTC_ISR_INIT)& 0x0000FFFF) | (uint32_t)(RTC->ISR & RTC_ISR_INIT)));
2726 uint8_t bcdhigh = 0;
2734 return ((uint8_t)(bcdhigh << 4) | Value);
2745 tmp = ((uint8_t)(Value & (uint8_t)0xF0) >> (uint8_t)0x4) * 10;
2746 return (tmp + (Value & (uint8_t)0x0F));
ErrorStatus RTC_Init(RTC_InitTypeDef *RTC_InitStruct)
Initializes the RTC registers according to the specified parameters in RTC_InitStruct.
void RTC_TimeStampPinSelection(uint32_t RTC_TimeStampPin)
Selects the RTC TimeStamp Pin.
void RTC_ExitInitMode(void)
Exits the RTC Initialization mode.
uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR)
Reads data from the specified RTC Backup data Register.
ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod, uint32_t RTC_SmoothCalibPlusPulses, uint32_t RTC_SmouthCalibMinusPulsesValue)
Configures the Smooth Calibration Settings.
static uint8_t RTC_Bcd2ToByte(uint8_t Value)
Convert from 2 digit BCD to Binary.
uint32_t RTC_GetTimeStampSubSecond(void)
Get the RTC timestamp Sub seconds value.
void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState)
Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edg...
void RTC_WriteProtectionCmd(FunctionalState NewState)
Enables or disables the RTC registers write protection.
void RTC_DateStructInit(RTC_DateTypeDef *RTC_DateStruct)
Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00).
ErrorStatus RTC_RefClockCmd(FunctionalState NewState)
Enables or disables the RTC reference clock detection.
void RTC_CalibOutputCmd(FunctionalState NewState)
Enables or disables the RTC clock to be output through the relative pin.
void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput)
Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
Set the RTC current time.
void RTC_OutputTypeConfig(uint32_t RTC_OutputType)
Configures the RTC Output Pin mode.
This file contains all the functions prototypes for the RTC firmware library.
void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq)
Configures the Tampers Sampling Frequency.
RTC Date structure definition.
ErrorStatus RTC_EnterInitMode(void)
Enters the RTC Initialization mode.
FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG)
Checks whether the specified RTC flag is set or not.
uint32_t RTC_GetStoreOperation(void)
Returns the RTC Day Light Saving stored operation.
uint32_t RTC_AsynchPrediv
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
Fills each RTC_InitStruct member with its default value.
ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState)
Enables or disables the specified RTC Alarm.
void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration)
Configures the Tampers Pins input Precharge Duration.
uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm)
Gets the RTC Alarm Sub seconds value.
ErrorStatus RTC_DeInit(void)
Deinitializes the RTC registers to their default reset values.
void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_StampTimeStruct, RTC_DateTypeDef *RTC_StampDateStruct)
Get the RTC TimeStamp value and masks.
void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState)
Enables or Disables the Tamper detection.
void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity)
Configures the RTC output source (AFO_ALARM).
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). ...
void RTC_ClearITPendingBit(uint32_t RTC_IT)
Clears the RTC's interrupt pending bits.
RTC_TimeTypeDef RTC_AlarmTime
RTC Time structure definition.
void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
Writes a data in a specified RTC Backup data register.
uint32_t RTC_GetSubSecond(void)
Gets the RTC current Calendar Sub seconds value.
void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation)
Adds or substract one hour from the current time.
void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
Get the RTC current Time.
void RTC_BypassShadowCmd(FunctionalState NewState)
Enables or Disables the Bypass Shadow feature.
void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
Get the RTC current date.
uint32_t RTC_GetWakeUpCounter(void)
Returns the RTC WakeUp timer counter value.
void RTC_TamperPullUpCmd(FunctionalState NewState)
Enables or Disables the Precharge of Tamper pin.
static uint8_t RTC_ByteToBcd2(uint8_t Value)
Converts a 2 digit decimal to BCD format.
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
Checks whether the specified RTC interrupt has occurred or not.
void RTC_ClearFlag(uint32_t RTC_FLAG)
Clears the RTC's pending flags.
void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter)
Configures the RTC Wakeup counter.
uint32_t RTC_AlarmDateWeekDaySel
ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
Set the RTC current date.
void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
Get the RTC Alarm value and masks.
ErrorStatus RTC_CoarseCalibCmd(FunctionalState NewState)
Enables or disables the Coarse calibration process.
void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState)
Enables or disables the specified RTC interrupts.
void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter)
Configures the Tampers Filter.
void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
Set the specified RTC Alarm.
void RTC_AlarmStructInit(RTC_AlarmTypeDef *RTC_AlarmStruct)
Fills each RTC_AlarmStruct member with its default value (Time = 00h:00mn:00sec / Date = 1st day of t...
void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask)
Configure the RTC AlarmA/B Sub seconds value and mask.*.
ErrorStatus RTC_CoarseCalibConfig(uint32_t RTC_CalibSign, uint32_t Value)
Configures the Coarse calibration parameters.
uint8_t RTC_AlarmDateWeekDay
ErrorStatus RTC_WaitForSynchro(void)
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock...
void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger)
Configures the select Tamper pin edge.
void RTC_TamperPinSelection(uint32_t RTC_TamperPin)
Selects the RTC Tamper Pin.
void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState)
Enables or Disables the TimeStamp on Tamper Detection Event.
ErrorStatus RTC_WakeUpCmd(FunctionalState NewState)
Enables or Disables the RTC WakeUp timer.
ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS)
Configures the Synchronization Shift Control Settings.
RTC Init structures definition.
RTC Alarm structure definition.
void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock)
Configures the RTC Wakeup clock source.