stm32f30x_rtc.h
Go to the documentation of this file.
1 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F30x_RTC_H
31 #define __STM32F30x_RTC_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f30x.h"
39 
48 /* Exported types ------------------------------------------------------------*/
49 
53 typedef struct
54 {
55  uint32_t RTC_HourFormat;
58  uint32_t RTC_AsynchPrediv;
61  uint32_t RTC_SynchPrediv;
64 
68 typedef struct
69 {
70  uint8_t RTC_Hours;
75  uint8_t RTC_Minutes;
78  uint8_t RTC_Seconds;
81  uint8_t RTC_H12;
84 
88 typedef struct
89 {
90  uint8_t RTC_WeekDay;
93  uint8_t RTC_Month;
96  uint8_t RTC_Date;
99  uint8_t RTC_Year;
102 
106 typedef struct
107 {
108  RTC_TimeTypeDef RTC_AlarmTime;
110  uint32_t RTC_AlarmMask;
113  uint32_t RTC_AlarmDateWeekDaySel;
116  uint8_t RTC_AlarmDateWeekDay;
122 
123 /* Exported constants --------------------------------------------------------*/
124 
133 #define RTC_HourFormat_24 ((uint32_t)0x00000000)
134 #define RTC_HourFormat_12 ((uint32_t)0x00000040)
135 #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HourFormat_12) || \
136  ((FORMAT) == RTC_HourFormat_24))
137 
144 #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7F)
145 
154 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFF)
155 
163 #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0) && ((HOUR) <= 12))
164 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23)
165 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59)
166 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59)
167 
175 #define RTC_H12_AM ((uint8_t)0x00)
176 #define RTC_H12_PM ((uint8_t)0x40)
177 #define IS_RTC_H12(PM) (((PM) == RTC_H12_AM) || ((PM) == RTC_H12_PM))
178 
186 #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99)
187 
196 /* Coded in BCD format */
197 #define RTC_Month_January ((uint8_t)0x01)
198 #define RTC_Month_February ((uint8_t)0x02)
199 #define RTC_Month_March ((uint8_t)0x03)
200 #define RTC_Month_April ((uint8_t)0x04)
201 #define RTC_Month_May ((uint8_t)0x05)
202 #define RTC_Month_June ((uint8_t)0x06)
203 #define RTC_Month_July ((uint8_t)0x07)
204 #define RTC_Month_August ((uint8_t)0x08)
205 #define RTC_Month_September ((uint8_t)0x09)
206 #define RTC_Month_October ((uint8_t)0x10)
207 #define RTC_Month_November ((uint8_t)0x11)
208 #define RTC_Month_December ((uint8_t)0x12)
209 #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1) && ((MONTH) <= 12))
210 #define IS_RTC_DATE(DATE) (((DATE) >= 1) && ((DATE) <= 31))
211 
220 #define RTC_Weekday_Monday ((uint8_t)0x01)
221 #define RTC_Weekday_Tuesday ((uint8_t)0x02)
222 #define RTC_Weekday_Wednesday ((uint8_t)0x03)
223 #define RTC_Weekday_Thursday ((uint8_t)0x04)
224 #define RTC_Weekday_Friday ((uint8_t)0x05)
225 #define RTC_Weekday_Saturday ((uint8_t)0x06)
226 #define RTC_Weekday_Sunday ((uint8_t)0x07)
227 #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
228  ((WEEKDAY) == RTC_Weekday_Tuesday) || \
229  ((WEEKDAY) == RTC_Weekday_Wednesday) || \
230  ((WEEKDAY) == RTC_Weekday_Thursday) || \
231  ((WEEKDAY) == RTC_Weekday_Friday) || \
232  ((WEEKDAY) == RTC_Weekday_Saturday) || \
233  ((WEEKDAY) == RTC_Weekday_Sunday))
234 
242 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0) && ((DATE) <= 31))
243 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
244  ((WEEKDAY) == RTC_Weekday_Tuesday) || \
245  ((WEEKDAY) == RTC_Weekday_Wednesday) || \
246  ((WEEKDAY) == RTC_Weekday_Thursday) || \
247  ((WEEKDAY) == RTC_Weekday_Friday) || \
248  ((WEEKDAY) == RTC_Weekday_Saturday) || \
249  ((WEEKDAY) == RTC_Weekday_Sunday))
250 
259 #define RTC_AlarmDateWeekDaySel_Date ((uint32_t)0x00000000)
260 #define RTC_AlarmDateWeekDaySel_WeekDay ((uint32_t)0x40000000)
261 
262 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_AlarmDateWeekDaySel_Date) || \
263  ((SEL) == RTC_AlarmDateWeekDaySel_WeekDay))
264 
273 #define RTC_AlarmMask_None ((uint32_t)0x00000000)
274 #define RTC_AlarmMask_DateWeekDay ((uint32_t)0x80000000)
275 #define RTC_AlarmMask_Hours ((uint32_t)0x00800000)
276 #define RTC_AlarmMask_Minutes ((uint32_t)0x00008000)
277 #define RTC_AlarmMask_Seconds ((uint32_t)0x00000080)
278 #define RTC_AlarmMask_All ((uint32_t)0x80808080)
279 #define IS_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
280 
288 #define RTC_Alarm_A ((uint32_t)0x00000100)
289 #define RTC_Alarm_B ((uint32_t)0x00000200)
290 #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_Alarm_A) || ((ALARM) == RTC_Alarm_B))
291 #define IS_RTC_CMD_ALARM(ALARM) (((ALARM) & (RTC_Alarm_A | RTC_Alarm_B)) != (uint32_t)RESET)
292 
300 #define RTC_AlarmSubSecondMask_All ((uint32_t)0x00000000)
303 #define RTC_AlarmSubSecondMask_SS14_1 ((uint32_t)0x01000000)
305 #define RTC_AlarmSubSecondMask_SS14_2 ((uint32_t)0x02000000)
307 #define RTC_AlarmSubSecondMask_SS14_3 ((uint32_t)0x03000000)
309 #define RTC_AlarmSubSecondMask_SS14_4 ((uint32_t)0x04000000)
311 #define RTC_AlarmSubSecondMask_SS14_5 ((uint32_t)0x05000000)
313 #define RTC_AlarmSubSecondMask_SS14_6 ((uint32_t)0x06000000)
315 #define RTC_AlarmSubSecondMask_SS14_7 ((uint32_t)0x07000000)
317 #define RTC_AlarmSubSecondMask_SS14_8 ((uint32_t)0x08000000)
319 #define RTC_AlarmSubSecondMask_SS14_9 ((uint32_t)0x09000000)
321 #define RTC_AlarmSubSecondMask_SS14_10 ((uint32_t)0x0A000000)
323 #define RTC_AlarmSubSecondMask_SS14_11 ((uint32_t)0x0B000000)
325 #define RTC_AlarmSubSecondMask_SS14_12 ((uint32_t)0x0C000000)
327 #define RTC_AlarmSubSecondMask_SS14_13 ((uint32_t)0x0D000000)
329 #define RTC_AlarmSubSecondMask_SS14 ((uint32_t)0x0E000000)
331 #define RTC_AlarmSubSecondMask_None ((uint32_t)0x0F000000)
333 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_AlarmSubSecondMask_All) || \
334  ((MASK) == RTC_AlarmSubSecondMask_SS14_1) || \
335  ((MASK) == RTC_AlarmSubSecondMask_SS14_2) || \
336  ((MASK) == RTC_AlarmSubSecondMask_SS14_3) || \
337  ((MASK) == RTC_AlarmSubSecondMask_SS14_4) || \
338  ((MASK) == RTC_AlarmSubSecondMask_SS14_5) || \
339  ((MASK) == RTC_AlarmSubSecondMask_SS14_6) || \
340  ((MASK) == RTC_AlarmSubSecondMask_SS14_7) || \
341  ((MASK) == RTC_AlarmSubSecondMask_SS14_8) || \
342  ((MASK) == RTC_AlarmSubSecondMask_SS14_9) || \
343  ((MASK) == RTC_AlarmSubSecondMask_SS14_10) || \
344  ((MASK) == RTC_AlarmSubSecondMask_SS14_11) || \
345  ((MASK) == RTC_AlarmSubSecondMask_SS14_12) || \
346  ((MASK) == RTC_AlarmSubSecondMask_SS14_13) || \
347  ((MASK) == RTC_AlarmSubSecondMask_SS14) || \
348  ((MASK) == RTC_AlarmSubSecondMask_None))
349 
357 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFF)
358 
366 #define RTC_WakeUpClock_RTCCLK_Div16 ((uint32_t)0x00000000)
367 #define RTC_WakeUpClock_RTCCLK_Div8 ((uint32_t)0x00000001)
368 #define RTC_WakeUpClock_RTCCLK_Div4 ((uint32_t)0x00000002)
369 #define RTC_WakeUpClock_RTCCLK_Div2 ((uint32_t)0x00000003)
370 #define RTC_WakeUpClock_CK_SPRE_16bits ((uint32_t)0x00000004)
371 #define RTC_WakeUpClock_CK_SPRE_17bits ((uint32_t)0x00000006)
372 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WakeUpClock_RTCCLK_Div16) || \
373  ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div8) || \
374  ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div4) || \
375  ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div2) || \
376  ((CLOCK) == RTC_WakeUpClock_CK_SPRE_16bits) || \
377  ((CLOCK) == RTC_WakeUpClock_CK_SPRE_17bits))
378 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
379 
386 #define RTC_TimeStampEdge_Rising ((uint32_t)0x00000000)
387 #define RTC_TimeStampEdge_Falling ((uint32_t)0x00000008)
388 #define IS_RTC_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TimeStampEdge_Rising) || \
389  ((EDGE) == RTC_TimeStampEdge_Falling))
390 
397 #define RTC_Output_Disable ((uint32_t)0x00000000)
398 #define RTC_Output_AlarmA ((uint32_t)0x00200000)
399 #define RTC_Output_AlarmB ((uint32_t)0x00400000)
400 #define RTC_Output_WakeUp ((uint32_t)0x00600000)
401 
402 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_Output_Disable) || \
403  ((OUTPUT) == RTC_Output_AlarmA) || \
404  ((OUTPUT) == RTC_Output_AlarmB) || \
405  ((OUTPUT) == RTC_Output_WakeUp))
406 
414 #define RTC_OutputPolarity_High ((uint32_t)0x00000000)
415 #define RTC_OutputPolarity_Low ((uint32_t)0x00100000)
416 #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OutputPolarity_High) || \
417  ((POL) == RTC_OutputPolarity_Low))
418 
425 #define RTC_CalibSign_Positive ((uint32_t)0x00000000)
426 #define RTC_CalibSign_Negative ((uint32_t)0x00000080)
427 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CalibSign_Positive) || \
428  ((SIGN) == RTC_CalibSign_Negative))
429 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)
430 
438 #define RTC_CalibOutput_512Hz ((uint32_t)0x00000000)
439 #define RTC_CalibOutput_1Hz ((uint32_t)0x00080000)
440 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CalibOutput_512Hz) || \
441  ((OUTPUT) == RTC_CalibOutput_1Hz))
449 #define RTC_SmoothCalibPeriod_32sec ((uint32_t)0x00000000)
451 #define RTC_SmoothCalibPeriod_16sec ((uint32_t)0x00002000)
453 #define RTC_SmoothCalibPeriod_8sec ((uint32_t)0x00004000)
455 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SmoothCalibPeriod_32sec) || \
456  ((PERIOD) == RTC_SmoothCalibPeriod_16sec) || \
457  ((PERIOD) == RTC_SmoothCalibPeriod_8sec))
458 
466 #define RTC_SmoothCalibPlusPulses_Set ((uint32_t)0x00008000)
469 #define RTC_SmoothCalibPlusPulses_Reset ((uint32_t)0x00000000)
471 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SmoothCalibPlusPulses_Set) || \
472  ((PLUS) == RTC_SmoothCalibPlusPulses_Reset))
473 
481 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
482 
490 #define RTC_DayLightSaving_SUB1H ((uint32_t)0x00020000)
491 #define RTC_DayLightSaving_ADD1H ((uint32_t)0x00010000)
492 #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DayLightSaving_SUB1H) || \
493  ((SAVE) == RTC_DayLightSaving_ADD1H))
495 #define RTC_StoreOperation_Reset ((uint32_t)0x00000000)
496 #define RTC_StoreOperation_Set ((uint32_t)0x00040000)
497 #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_StoreOperation_Reset) || \
498  ((OPERATION) == RTC_StoreOperation_Set))
499 
506 #define RTC_TamperTrigger_RisingEdge ((uint32_t)0x00000000)
507 #define RTC_TamperTrigger_FallingEdge ((uint32_t)0x00000001)
508 #define RTC_TamperTrigger_LowLevel ((uint32_t)0x00000000)
509 #define RTC_TamperTrigger_HighLevel ((uint32_t)0x00000001)
510 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TamperTrigger_RisingEdge) || \
511  ((TRIGGER) == RTC_TamperTrigger_FallingEdge) || \
512  ((TRIGGER) == RTC_TamperTrigger_LowLevel) || \
513  ((TRIGGER) == RTC_TamperTrigger_HighLevel))
522 #define RTC_TamperFilter_Disable ((uint32_t)0x00000000)
524 #define RTC_TamperFilter_2Sample ((uint32_t)0x00000800)
526 #define RTC_TamperFilter_4Sample ((uint32_t)0x00001000)
528 #define RTC_TamperFilter_8Sample ((uint32_t)0x00001800)
530 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TamperFilter_Disable) || \
531  ((FILTER) == RTC_TamperFilter_2Sample) || \
532  ((FILTER) == RTC_TamperFilter_4Sample) || \
533  ((FILTER) == RTC_TamperFilter_8Sample))
534 
541 #define RTC_TamperSamplingFreq_RTCCLK_Div32768 ((uint32_t)0x00000000)
543 #define RTC_TamperSamplingFreq_RTCCLK_Div16384 ((uint32_t)0x000000100)
545 #define RTC_TamperSamplingFreq_RTCCLK_Div8192 ((uint32_t)0x00000200)
547 #define RTC_TamperSamplingFreq_RTCCLK_Div4096 ((uint32_t)0x00000300)
549 #define RTC_TamperSamplingFreq_RTCCLK_Div2048 ((uint32_t)0x00000400)
551 #define RTC_TamperSamplingFreq_RTCCLK_Div1024 ((uint32_t)0x00000500)
553 #define RTC_TamperSamplingFreq_RTCCLK_Div512 ((uint32_t)0x00000600)
555 #define RTC_TamperSamplingFreq_RTCCLK_Div256 ((uint32_t)0x00000700)
557 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div32768) || \
558  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div16384) || \
559  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div8192) || \
560  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div4096) || \
561  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div2048) || \
562  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div1024) || \
563  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div512) || \
564  ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div256))
565 
573 #define RTC_TamperPrechargeDuration_1RTCCLK ((uint32_t)0x00000000)
575 #define RTC_TamperPrechargeDuration_2RTCCLK ((uint32_t)0x00002000)
577 #define RTC_TamperPrechargeDuration_4RTCCLK ((uint32_t)0x00004000)
579 #define RTC_TamperPrechargeDuration_8RTCCLK ((uint32_t)0x00006000)
582 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TamperPrechargeDuration_1RTCCLK) || \
583  ((DURATION) == RTC_TamperPrechargeDuration_2RTCCLK) || \
584  ((DURATION) == RTC_TamperPrechargeDuration_4RTCCLK) || \
585  ((DURATION) == RTC_TamperPrechargeDuration_8RTCCLK))
586 
593 #define RTC_Tamper_1 RTC_TAFCR_TAMP1E
595 #define RTC_Tamper_2 RTC_TAFCR_TAMP2E
597 #define RTC_Tamper_3 RTC_TAFCR_TAMP3E
600 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6) == 0x00) && ((TAMPER) != (uint32_t)RESET))
601 
602 
610 #define RTC_OutputType_OpenDrain ((uint32_t)0x00000000)
611 #define RTC_OutputType_PushPull ((uint32_t)0x00040000)
612 #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OutputType_OpenDrain) || \
613  ((TYPE) == RTC_OutputType_PushPull))
614 
622 #define RTC_ShiftAdd1S_Reset ((uint32_t)0x00000000)
623 #define RTC_ShiftAdd1S_Set ((uint32_t)0x80000000)
624 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_ShiftAdd1S_Reset) || \
625  ((SEL) == RTC_ShiftAdd1S_Set))
626 
633 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
643 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
644 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
645 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
646 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
647 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
648 #define RTC_BKP_DR5 ((uint32_t)0x00000005)
649 #define RTC_BKP_DR6 ((uint32_t)0x00000006)
650 #define RTC_BKP_DR7 ((uint32_t)0x00000007)
651 #define RTC_BKP_DR8 ((uint32_t)0x00000008)
652 #define RTC_BKP_DR9 ((uint32_t)0x00000009)
653 #define RTC_BKP_DR10 ((uint32_t)0x0000000A)
654 #define RTC_BKP_DR11 ((uint32_t)0x0000000B)
655 #define RTC_BKP_DR12 ((uint32_t)0x0000000C)
656 #define RTC_BKP_DR13 ((uint32_t)0x0000000D)
657 #define RTC_BKP_DR14 ((uint32_t)0x0000000E)
658 #define RTC_BKP_DR15 ((uint32_t)0x0000000F)
659 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
660  ((BKP) == RTC_BKP_DR1) || \
661  ((BKP) == RTC_BKP_DR2) || \
662  ((BKP) == RTC_BKP_DR3) || \
663  ((BKP) == RTC_BKP_DR4) || \
664  ((BKP) == RTC_BKP_DR5) || \
665  ((BKP) == RTC_BKP_DR6) || \
666  ((BKP) == RTC_BKP_DR7) || \
667  ((BKP) == RTC_BKP_DR8) || \
668  ((BKP) == RTC_BKP_DR9) || \
669  ((BKP) == RTC_BKP_DR10) || \
670  ((BKP) == RTC_BKP_DR11) || \
671  ((BKP) == RTC_BKP_DR12) || \
672  ((BKP) == RTC_BKP_DR13) || \
673  ((BKP) == RTC_BKP_DR14) || \
674  ((BKP) == RTC_BKP_DR15))
675 
682 #define RTC_Format_BIN ((uint32_t)0x000000000)
683 #define RTC_Format_BCD ((uint32_t)0x000000001)
684 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_Format_BIN) || ((FORMAT) == RTC_Format_BCD))
693 #define RTC_FLAG_RECALPF ((uint32_t)0x00010000)
694 #define RTC_FLAG_TAMP3F ((uint32_t)0x00008000)
695 #define RTC_FLAG_TAMP2F ((uint32_t)0x00004000)
696 #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000)
697 #define RTC_FLAG_TSOVF ((uint32_t)0x00001000)
698 #define RTC_FLAG_TSF ((uint32_t)0x00000800)
699 #define RTC_FLAG_WUTF ((uint32_t)0x00000400)
700 #define RTC_FLAG_ALRBF ((uint32_t)0x00000200)
701 #define RTC_FLAG_ALRAF ((uint32_t)0x00000100)
702 #define RTC_FLAG_INITF ((uint32_t)0x00000040)
703 #define RTC_FLAG_RSF ((uint32_t)0x00000020)
704 #define RTC_FLAG_INITS ((uint32_t)0x00000010)
705 #define RTC_FLAG_SHPF ((uint32_t)0x00000008)
706 #define RTC_FLAG_WUTWF ((uint32_t)0x00000004)
707 #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002)
708 #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001)
709 #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_TSOVF) || ((FLAG) == RTC_FLAG_TSF) || \
710  ((FLAG) == RTC_FLAG_WUTF) || ((FLAG) == RTC_FLAG_ALRBF) || \
711  ((FLAG) == RTC_FLAG_ALRAF) || ((FLAG) == RTC_FLAG_INITF) || \
712  ((FLAG) == RTC_FLAG_RSF) || ((FLAG) == RTC_FLAG_WUTWF) || \
713  ((FLAG) == RTC_FLAG_ALRBWF) || ((FLAG) == RTC_FLAG_ALRAWF) || \
714  ((FLAG) == RTC_FLAG_TAMP1F) || ((FLAG) == RTC_FLAG_TAMP2F) || \
715  ((FLAG) == RTC_FLAG_TAMP3F) || ((FLAG) == RTC_FLAG_RECALPF) || \
716  ((FLAG) == RTC_FLAG_SHPF))
717 #define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG) != (uint32_t)RESET) && (((FLAG) & 0xFFFF00DF) == (uint32_t)RESET))
718 
726 #define RTC_IT_TS ((uint32_t)0x00008000)
727 #define RTC_IT_WUT ((uint32_t)0x00004000)
728 #define RTC_IT_ALRB ((uint32_t)0x00002000)
729 #define RTC_IT_ALRA ((uint32_t)0x00001000)
730 #define RTC_IT_TAMP ((uint32_t)0x00000004) /* Used only to Enable the Tamper Interrupt */
731 #define RTC_IT_TAMP1 ((uint32_t)0x00020000)
732 #define RTC_IT_TAMP2 ((uint32_t)0x00040000)
733 #define RTC_IT_TAMP3 ((uint32_t)0x00080000)
736 #define IS_RTC_CONFIG_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFF0FFB) == (uint32_t)RESET))
737 #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_TS) || ((IT) == RTC_IT_WUT) || \
738  ((IT) == RTC_IT_ALRB) || ((IT) == RTC_IT_ALRA) || \
739  ((IT) == RTC_IT_TAMP1) || ((IT) == RTC_IT_TAMP2) || \
740  ((IT) == RTC_IT_TAMP3))
741 #define IS_RTC_CLEAR_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFF10FFF) == (uint32_t)RESET))
752 /* Exported macro ------------------------------------------------------------*/
753 /* Exported functions ------------------------------------------------------- */
754 
755 /* Function used to set the RTC configuration to the default reset state *****/
756 ErrorStatus RTC_DeInit(void);
757 
759 /* Initialization and Configuration functions *********************************/
760 ErrorStatus RTC_Init(RTC_InitTypeDef* RTC_InitStruct);
761 void RTC_StructInit(RTC_InitTypeDef* RTC_InitStruct);
764 void RTC_ExitInitMode(void);
769 /* Time and Date configuration functions **************************************/
770 ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
771 void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct);
772 void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
773 uint32_t RTC_GetSubSecond(void);
774 ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
775 void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct);
776 void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
778 /* Alarms (Alarm A and Alarm B) configuration functions **********************/
779 void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
780 void RTC_AlarmStructInit(RTC_AlarmTypeDef* RTC_AlarmStruct);
781 void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
782 ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState);
783 void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask);
784 uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm);
785 
786 /* WakeUp Timer configuration functions ***************************************/
787 void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock);
788 void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter);
789 uint32_t RTC_GetWakeUpCounter(void);
791 
792 /* Daylight Saving configuration functions ************************************/
793 void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation);
794 uint32_t RTC_GetStoreOperation(void);
795 
796 /* Output pin Configuration function ******************************************/
797 void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity);
798 
799 /* Digital Calibration configuration functions ********************************/
800 void RTC_CalibOutputCmd(FunctionalState NewState);
801 void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput);
802 ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod,
803  uint32_t RTC_SmoothCalibPlusPulses,
804  uint32_t RTC_SmouthCalibMinusPulsesValue);
805 
806 /* TimeStamp configuration functions ******************************************/
807 void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState);
808 void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_StampTimeStruct,
809  RTC_DateTypeDef* RTC_StampDateStruct);
810 uint32_t RTC_GetTimeStampSubSecond(void);
811 
812 /* Tampers configuration functions ********************************************/
813 void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger);
814 void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState);
815 void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter);
816 void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq);
817 void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration);
819 void RTC_TamperPullUpCmd(FunctionalState NewState);
820 
821 /* Backup Data Registers configuration functions ******************************/
822 void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);
823 uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
824 
825 /* Output Type Config configuration functions *********************************/
826 void RTC_OutputTypeConfig(uint32_t RTC_OutputType);
827 
828 /* RTC_Shift_control_synchonisation_functions *********************************/
829 ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS);
830 
831 /* Interrupts and flags management functions **********************************/
832 void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState);
833 FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG);
834 void RTC_ClearFlag(uint32_t RTC_FLAG);
835 ITStatus RTC_GetITStatus(uint32_t RTC_IT);
836 void RTC_ClearITPendingBit(uint32_t RTC_IT);
837 
838 #ifdef __cplusplus
839 }
840 #endif
841 
842 #endif /*__STM32F30x_RTC_H */
843 
852 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ErrorStatus RTC_Init(RTC_InitTypeDef *RTC_InitStruct)
Initializes the RTC registers according to the specified parameters in RTC_InitStruct.
FlagStatus
Definition: stm32f4xx.h:706
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
Set the RTC current time.
ErrorStatus RTC_RefClockCmd(FunctionalState NewState)
Enables or disables the RTC reference clock detection.
ErrorStatus RTC_WakeUpCmd(FunctionalState NewState)
Enables or Disables the RTC WakeUp timer.
ErrorStatus RTC_WaitForSynchro(void)
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock...
FunctionalState
Definition: stm32f4xx.h:708
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). ...
void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState)
Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edg...
ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod, uint32_t RTC_SmoothCalibPlusPulses, uint32_t RTC_SmouthCalibMinusPulsesValue)
Configures the Smooth Calibration Settings.
void RTC_CalibOutputCmd(FunctionalState NewState)
Enables or disables the RTC clock to be output through the relative pin.
void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState)
Enables or Disables the Tamper detection.
void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState)
Enables or disables the specified RTC interrupts.
RTC Init structures definition.
Definition: stm32f4xx_rtc.h:53
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
Checks whether the specified RTC interrupt has occurred or not.
ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
Set the RTC current date.
void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_StampTimeStruct, RTC_DateTypeDef *RTC_StampDateStruct)
Gets the RTC TimeStamp value and masks.
void RTC_ClearITPendingBit(uint32_t RTC_IT)
Clears the RTC&#39;s interrupt pending bits.
ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState)
Enables or disables the specified RTC Alarm.
ErrorStatus RTC_EnterInitMode(void)
Enters the RTC Initialization mode.
ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS)
Configures the Synchronization Shift Control Settings.
void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter)
Configures the Tampers Filter.
void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput)
Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
enum FlagStatus ITStatus
uint32_t RTC_GetWakeUpCounter(void)
Returns the RTC WakeUp timer counter value.
uint32_t RTC_GetSubSecond(void)
Gets the RTC current Calendar Subseconds value.
RTC Date structure definition.
Definition: stm32f4xx_rtc.h:88
void RTC_DateStructInit(RTC_DateTypeDef *RTC_DateStruct)
Fills each RTC_DateStruct member with its default value (Monday, January 01 xx00).
void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
Get the RTC Alarm value and masks.
void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger)
Configures the select Tamper pin edge.
uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR)
Reads data from the specified RTC Backup data Register.
uint32_t RTC_GetStoreOperation(void)
Returns the RTC Day Light Saving stored operation.
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
Fills each RTC_InitStruct member with its default value.
void RTC_ExitInitMode(void)
Exits the RTC Initialization mode.
uint32_t RTC_GetTimeStampSubSecond(void)
Gets the RTC timestamp Subseconds value.
void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration)
Configures the Tampers Pins input Precharge Duration.
void RTC_ClearFlag(uint32_t RTC_FLAG)
Clears the RTC&#39;s pending flags.
void RTC_OutputTypeConfig(uint32_t RTC_OutputType)
Configures the RTC Output Pin mode.
ErrorStatus
Definition: stm32f4xx.h:711
void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock)
Configures the RTC Wakeup clock source.
void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq)
Configures the Tampers Sampling Frequency.
void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity)
Configures the RTC output source (AFO_ALARM).
FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG)
Checks whether the specified RTC flag is set or not.
void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef *RTC_TimeStruct)
Get the RTC current Time.
uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm)
Gets the RTC Alarm Subseconds value.
RTC Time structure definition.
Definition: stm32f4xx_rtc.h:68
void RTC_BypassShadowCmd(FunctionalState NewState)
Enables or Disables the Bypass Shadow feature.
void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter)
Configures the RTC Wakeup counter.
void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
Writes a data in a specified RTC Backup data register.
void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask)
Configures the RTC AlarmA/B Subseconds value and mask.
void RTC_TamperPullUpCmd(FunctionalState NewState)
Enables or Disables the Precharge of Tamper pin.
void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef *RTC_AlarmStruct)
Set the specified RTC Alarm.
ErrorStatus RTC_DeInit(void)
Deinitializes the RTC registers to their default reset values.
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_GetDate(uint32_t RTC_Format, RTC_DateTypeDef *RTC_DateStruct)
Get the RTC current date.
RTC Alarm structure definition.
void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation)
Adds or substract one hour from the current time.
void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState)
Enables or Disables the TimeStamp on Tamper Detection Event.
void RTC_WriteProtectionCmd(FunctionalState NewState)
Enables or disables the RTC registers write protection.


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:48