00001
00029
00030 #ifndef __STM32F4xx_RTC_H
00031 #define __STM32F4xx_RTC_H
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037
00038 #include "stm32f4xx.h"
00039
00048
00049
00053 typedef struct
00054 {
00055 uint32_t RTC_HourFormat;
00058 uint32_t RTC_AsynchPrediv;
00061 uint32_t RTC_SynchPrediv;
00063 }RTC_InitTypeDef;
00064
00068 typedef struct
00069 {
00070 uint8_t RTC_Hours;
00075 uint8_t RTC_Minutes;
00078 uint8_t RTC_Seconds;
00081 uint8_t RTC_H12;
00083 }RTC_TimeTypeDef;
00084
00088 typedef struct
00089 {
00090 uint8_t RTC_WeekDay;
00093 uint8_t RTC_Month;
00096 uint8_t RTC_Date;
00099 uint8_t RTC_Year;
00101 }RTC_DateTypeDef;
00102
00106 typedef struct
00107 {
00108 RTC_TimeTypeDef RTC_AlarmTime;
00110 uint32_t RTC_AlarmMask;
00113 uint32_t RTC_AlarmDateWeekDaySel;
00116 uint8_t RTC_AlarmDateWeekDay;
00121 }RTC_AlarmTypeDef;
00122
00123
00124
00133 #define RTC_HourFormat_24 ((uint32_t)0x00000000)
00134 #define RTC_HourFormat_12 ((uint32_t)0x00000040)
00135 #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HourFormat_12) || \
00136 ((FORMAT) == RTC_HourFormat_24))
00137
00144 #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7F)
00145
00154 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFF)
00155
00163 #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0) && ((HOUR) <= 12))
00164 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23)
00165 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59)
00166 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59)
00167
00175 #define RTC_H12_AM ((uint8_t)0x00)
00176 #define RTC_H12_PM ((uint8_t)0x40)
00177 #define IS_RTC_H12(PM) (((PM) == RTC_H12_AM) || ((PM) == RTC_H12_PM))
00178
00186 #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99)
00187
00196
00197 #define RTC_Month_January ((uint8_t)0x01)
00198 #define RTC_Month_February ((uint8_t)0x02)
00199 #define RTC_Month_March ((uint8_t)0x03)
00200 #define RTC_Month_April ((uint8_t)0x04)
00201 #define RTC_Month_May ((uint8_t)0x05)
00202 #define RTC_Month_June ((uint8_t)0x06)
00203 #define RTC_Month_July ((uint8_t)0x07)
00204 #define RTC_Month_August ((uint8_t)0x08)
00205 #define RTC_Month_September ((uint8_t)0x09)
00206 #define RTC_Month_October ((uint8_t)0x10)
00207 #define RTC_Month_November ((uint8_t)0x11)
00208 #define RTC_Month_December ((uint8_t)0x12)
00209 #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1) && ((MONTH) <= 12))
00210 #define IS_RTC_DATE(DATE) (((DATE) >= 1) && ((DATE) <= 31))
00211
00220 #define RTC_Weekday_Monday ((uint8_t)0x01)
00221 #define RTC_Weekday_Tuesday ((uint8_t)0x02)
00222 #define RTC_Weekday_Wednesday ((uint8_t)0x03)
00223 #define RTC_Weekday_Thursday ((uint8_t)0x04)
00224 #define RTC_Weekday_Friday ((uint8_t)0x05)
00225 #define RTC_Weekday_Saturday ((uint8_t)0x06)
00226 #define RTC_Weekday_Sunday ((uint8_t)0x07)
00227 #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
00228 ((WEEKDAY) == RTC_Weekday_Tuesday) || \
00229 ((WEEKDAY) == RTC_Weekday_Wednesday) || \
00230 ((WEEKDAY) == RTC_Weekday_Thursday) || \
00231 ((WEEKDAY) == RTC_Weekday_Friday) || \
00232 ((WEEKDAY) == RTC_Weekday_Saturday) || \
00233 ((WEEKDAY) == RTC_Weekday_Sunday))
00234
00242 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0) && ((DATE) <= 31))
00243 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
00244 ((WEEKDAY) == RTC_Weekday_Tuesday) || \
00245 ((WEEKDAY) == RTC_Weekday_Wednesday) || \
00246 ((WEEKDAY) == RTC_Weekday_Thursday) || \
00247 ((WEEKDAY) == RTC_Weekday_Friday) || \
00248 ((WEEKDAY) == RTC_Weekday_Saturday) || \
00249 ((WEEKDAY) == RTC_Weekday_Sunday))
00250
00259 #define RTC_AlarmDateWeekDaySel_Date ((uint32_t)0x00000000)
00260 #define RTC_AlarmDateWeekDaySel_WeekDay ((uint32_t)0x40000000)
00261
00262 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_AlarmDateWeekDaySel_Date) || \
00263 ((SEL) == RTC_AlarmDateWeekDaySel_WeekDay))
00264
00273 #define RTC_AlarmMask_None ((uint32_t)0x00000000)
00274 #define RTC_AlarmMask_DateWeekDay ((uint32_t)0x80000000)
00275 #define RTC_AlarmMask_Hours ((uint32_t)0x00800000)
00276 #define RTC_AlarmMask_Minutes ((uint32_t)0x00008000)
00277 #define RTC_AlarmMask_Seconds ((uint32_t)0x00000080)
00278 #define RTC_AlarmMask_All ((uint32_t)0x80808080)
00279 #define IS_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
00280
00288 #define RTC_Alarm_A ((uint32_t)0x00000100)
00289 #define RTC_Alarm_B ((uint32_t)0x00000200)
00290 #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_Alarm_A) || ((ALARM) == RTC_Alarm_B))
00291 #define IS_RTC_CMD_ALARM(ALARM) (((ALARM) & (RTC_Alarm_A | RTC_Alarm_B)) != (uint32_t)RESET)
00292
00300 #define RTC_AlarmSubSecondMask_All ((uint32_t)0x00000000)
00303 #define RTC_AlarmSubSecondMask_SS14_1 ((uint32_t)0x01000000)
00305 #define RTC_AlarmSubSecondMask_SS14_2 ((uint32_t)0x02000000)
00307 #define RTC_AlarmSubSecondMask_SS14_3 ((uint32_t)0x03000000)
00309 #define RTC_AlarmSubSecondMask_SS14_4 ((uint32_t)0x04000000)
00311 #define RTC_AlarmSubSecondMask_SS14_5 ((uint32_t)0x05000000)
00313 #define RTC_AlarmSubSecondMask_SS14_6 ((uint32_t)0x06000000)
00315 #define RTC_AlarmSubSecondMask_SS14_7 ((uint32_t)0x07000000)
00317 #define RTC_AlarmSubSecondMask_SS14_8 ((uint32_t)0x08000000)
00319 #define RTC_AlarmSubSecondMask_SS14_9 ((uint32_t)0x09000000)
00321 #define RTC_AlarmSubSecondMask_SS14_10 ((uint32_t)0x0A000000)
00323 #define RTC_AlarmSubSecondMask_SS14_11 ((uint32_t)0x0B000000)
00325 #define RTC_AlarmSubSecondMask_SS14_12 ((uint32_t)0x0C000000)
00327 #define RTC_AlarmSubSecondMask_SS14_13 ((uint32_t)0x0D000000)
00329 #define RTC_AlarmSubSecondMask_SS14 ((uint32_t)0x0E000000)
00331 #define RTC_AlarmSubSecondMask_None ((uint32_t)0x0F000000)
00333 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_AlarmSubSecondMask_All) || \
00334 ((MASK) == RTC_AlarmSubSecondMask_SS14_1) || \
00335 ((MASK) == RTC_AlarmSubSecondMask_SS14_2) || \
00336 ((MASK) == RTC_AlarmSubSecondMask_SS14_3) || \
00337 ((MASK) == RTC_AlarmSubSecondMask_SS14_4) || \
00338 ((MASK) == RTC_AlarmSubSecondMask_SS14_5) || \
00339 ((MASK) == RTC_AlarmSubSecondMask_SS14_6) || \
00340 ((MASK) == RTC_AlarmSubSecondMask_SS14_7) || \
00341 ((MASK) == RTC_AlarmSubSecondMask_SS14_8) || \
00342 ((MASK) == RTC_AlarmSubSecondMask_SS14_9) || \
00343 ((MASK) == RTC_AlarmSubSecondMask_SS14_10) || \
00344 ((MASK) == RTC_AlarmSubSecondMask_SS14_11) || \
00345 ((MASK) == RTC_AlarmSubSecondMask_SS14_12) || \
00346 ((MASK) == RTC_AlarmSubSecondMask_SS14_13) || \
00347 ((MASK) == RTC_AlarmSubSecondMask_SS14) || \
00348 ((MASK) == RTC_AlarmSubSecondMask_None))
00349
00357 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFF)
00358
00366 #define RTC_WakeUpClock_RTCCLK_Div16 ((uint32_t)0x00000000)
00367 #define RTC_WakeUpClock_RTCCLK_Div8 ((uint32_t)0x00000001)
00368 #define RTC_WakeUpClock_RTCCLK_Div4 ((uint32_t)0x00000002)
00369 #define RTC_WakeUpClock_RTCCLK_Div2 ((uint32_t)0x00000003)
00370 #define RTC_WakeUpClock_CK_SPRE_16bits ((uint32_t)0x00000004)
00371 #define RTC_WakeUpClock_CK_SPRE_17bits ((uint32_t)0x00000006)
00372 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WakeUpClock_RTCCLK_Div16) || \
00373 ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div8) || \
00374 ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div4) || \
00375 ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div2) || \
00376 ((CLOCK) == RTC_WakeUpClock_CK_SPRE_16bits) || \
00377 ((CLOCK) == RTC_WakeUpClock_CK_SPRE_17bits))
00378 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
00379
00386 #define RTC_TimeStampEdge_Rising ((uint32_t)0x00000000)
00387 #define RTC_TimeStampEdge_Falling ((uint32_t)0x00000008)
00388 #define IS_RTC_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TimeStampEdge_Rising) || \
00389 ((EDGE) == RTC_TimeStampEdge_Falling))
00390
00397 #define RTC_Output_Disable ((uint32_t)0x00000000)
00398 #define RTC_Output_AlarmA ((uint32_t)0x00200000)
00399 #define RTC_Output_AlarmB ((uint32_t)0x00400000)
00400 #define RTC_Output_WakeUp ((uint32_t)0x00600000)
00401
00402 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_Output_Disable) || \
00403 ((OUTPUT) == RTC_Output_AlarmA) || \
00404 ((OUTPUT) == RTC_Output_AlarmB) || \
00405 ((OUTPUT) == RTC_Output_WakeUp))
00406
00414 #define RTC_OutputPolarity_High ((uint32_t)0x00000000)
00415 #define RTC_OutputPolarity_Low ((uint32_t)0x00100000)
00416 #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OutputPolarity_High) || \
00417 ((POL) == RTC_OutputPolarity_Low))
00418
00426 #define RTC_CalibSign_Positive ((uint32_t)0x00000000)
00427 #define RTC_CalibSign_Negative ((uint32_t)0x00000080)
00428 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CalibSign_Positive) || \
00429 ((SIGN) == RTC_CalibSign_Negative))
00430 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)
00431
00439 #define RTC_CalibOutput_512Hz ((uint32_t)0x00000000)
00440 #define RTC_CalibOutput_1Hz ((uint32_t)0x00080000)
00441 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CalibOutput_512Hz) || \
00442 ((OUTPUT) == RTC_CalibOutput_1Hz))
00443
00450 #define RTC_SmoothCalibPeriod_32sec ((uint32_t)0x00000000)
00452 #define RTC_SmoothCalibPeriod_16sec ((uint32_t)0x00002000)
00454 #define RTC_SmoothCalibPeriod_8sec ((uint32_t)0x00004000)
00456 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SmoothCalibPeriod_32sec) || \
00457 ((PERIOD) == RTC_SmoothCalibPeriod_16sec) || \
00458 ((PERIOD) == RTC_SmoothCalibPeriod_8sec))
00459
00467 #define RTC_SmoothCalibPlusPulses_Set ((uint32_t)0x00008000)
00470 #define RTC_SmoothCalibPlusPulses_Reset ((uint32_t)0x00000000)
00472 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SmoothCalibPlusPulses_Set) || \
00473 ((PLUS) == RTC_SmoothCalibPlusPulses_Reset))
00474
00482 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
00483
00491 #define RTC_DayLightSaving_SUB1H ((uint32_t)0x00020000)
00492 #define RTC_DayLightSaving_ADD1H ((uint32_t)0x00010000)
00493 #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DayLightSaving_SUB1H) || \
00494 ((SAVE) == RTC_DayLightSaving_ADD1H))
00495
00496 #define RTC_StoreOperation_Reset ((uint32_t)0x00000000)
00497 #define RTC_StoreOperation_Set ((uint32_t)0x00040000)
00498 #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_StoreOperation_Reset) || \
00499 ((OPERATION) == RTC_StoreOperation_Set))
00500
00507 #define RTC_TamperTrigger_RisingEdge ((uint32_t)0x00000000)
00508 #define RTC_TamperTrigger_FallingEdge ((uint32_t)0x00000001)
00509 #define RTC_TamperTrigger_LowLevel ((uint32_t)0x00000000)
00510 #define RTC_TamperTrigger_HighLevel ((uint32_t)0x00000001)
00511 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TamperTrigger_RisingEdge) || \
00512 ((TRIGGER) == RTC_TamperTrigger_FallingEdge) || \
00513 ((TRIGGER) == RTC_TamperTrigger_LowLevel) || \
00514 ((TRIGGER) == RTC_TamperTrigger_HighLevel))
00515
00523 #define RTC_TamperFilter_Disable ((uint32_t)0x00000000)
00525 #define RTC_TamperFilter_2Sample ((uint32_t)0x00000800)
00527 #define RTC_TamperFilter_4Sample ((uint32_t)0x00001000)
00529 #define RTC_TamperFilter_8Sample ((uint32_t)0x00001800)
00531 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TamperFilter_Disable) || \
00532 ((FILTER) == RTC_TamperFilter_2Sample) || \
00533 ((FILTER) == RTC_TamperFilter_4Sample) || \
00534 ((FILTER) == RTC_TamperFilter_8Sample))
00535
00542 #define RTC_TamperSamplingFreq_RTCCLK_Div32768 ((uint32_t)0x00000000)
00544 #define RTC_TamperSamplingFreq_RTCCLK_Div16384 ((uint32_t)0x000000100)
00546 #define RTC_TamperSamplingFreq_RTCCLK_Div8192 ((uint32_t)0x00000200)
00548 #define RTC_TamperSamplingFreq_RTCCLK_Div4096 ((uint32_t)0x00000300)
00550 #define RTC_TamperSamplingFreq_RTCCLK_Div2048 ((uint32_t)0x00000400)
00552 #define RTC_TamperSamplingFreq_RTCCLK_Div1024 ((uint32_t)0x00000500)
00554 #define RTC_TamperSamplingFreq_RTCCLK_Div512 ((uint32_t)0x00000600)
00556 #define RTC_TamperSamplingFreq_RTCCLK_Div256 ((uint32_t)0x00000700)
00558 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div32768) || \
00559 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div16384) || \
00560 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div8192) || \
00561 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div4096) || \
00562 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div2048) || \
00563 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div1024) || \
00564 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div512) || \
00565 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div256))
00566
00574 #define RTC_TamperPrechargeDuration_1RTCCLK ((uint32_t)0x00000000)
00576 #define RTC_TamperPrechargeDuration_2RTCCLK ((uint32_t)0x00002000)
00578 #define RTC_TamperPrechargeDuration_4RTCCLK ((uint32_t)0x00004000)
00580 #define RTC_TamperPrechargeDuration_8RTCCLK ((uint32_t)0x00006000)
00583 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TamperPrechargeDuration_1RTCCLK) || \
00584 ((DURATION) == RTC_TamperPrechargeDuration_2RTCCLK) || \
00585 ((DURATION) == RTC_TamperPrechargeDuration_4RTCCLK) || \
00586 ((DURATION) == RTC_TamperPrechargeDuration_8RTCCLK))
00587
00594 #define RTC_Tamper_1 RTC_TAFCR_TAMP1E
00595 #define IS_RTC_TAMPER(TAMPER) (((TAMPER) == RTC_Tamper_1))
00596
00604 #define RTC_TamperPin_PC13 ((uint32_t)0x00000000)
00605 #define RTC_TamperPin_PI8 ((uint32_t)0x00010000)
00606 #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TamperPin_PC13) || \
00607 ((PIN) == RTC_TamperPin_PI8))
00608
00615 #define RTC_TimeStampPin_PC13 ((uint32_t)0x00000000)
00616 #define RTC_TimeStampPin_PI8 ((uint32_t)0x00020000)
00617 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TimeStampPin_PC13) || \
00618 ((PIN) == RTC_TimeStampPin_PI8))
00619
00626 #define RTC_OutputType_OpenDrain ((uint32_t)0x00000000)
00627 #define RTC_OutputType_PushPull ((uint32_t)0x00040000)
00628 #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OutputType_OpenDrain) || \
00629 ((TYPE) == RTC_OutputType_PushPull))
00630
00638 #define RTC_ShiftAdd1S_Reset ((uint32_t)0x00000000)
00639 #define RTC_ShiftAdd1S_Set ((uint32_t)0x80000000)
00640 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_ShiftAdd1S_Reset) || \
00641 ((SEL) == RTC_ShiftAdd1S_Set))
00642
00649 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
00650
00659 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
00660 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
00661 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
00662 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
00663 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
00664 #define RTC_BKP_DR5 ((uint32_t)0x00000005)
00665 #define RTC_BKP_DR6 ((uint32_t)0x00000006)
00666 #define RTC_BKP_DR7 ((uint32_t)0x00000007)
00667 #define RTC_BKP_DR8 ((uint32_t)0x00000008)
00668 #define RTC_BKP_DR9 ((uint32_t)0x00000009)
00669 #define RTC_BKP_DR10 ((uint32_t)0x0000000A)
00670 #define RTC_BKP_DR11 ((uint32_t)0x0000000B)
00671 #define RTC_BKP_DR12 ((uint32_t)0x0000000C)
00672 #define RTC_BKP_DR13 ((uint32_t)0x0000000D)
00673 #define RTC_BKP_DR14 ((uint32_t)0x0000000E)
00674 #define RTC_BKP_DR15 ((uint32_t)0x0000000F)
00675 #define RTC_BKP_DR16 ((uint32_t)0x00000010)
00676 #define RTC_BKP_DR17 ((uint32_t)0x00000011)
00677 #define RTC_BKP_DR18 ((uint32_t)0x00000012)
00678 #define RTC_BKP_DR19 ((uint32_t)0x00000013)
00679 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
00680 ((BKP) == RTC_BKP_DR1) || \
00681 ((BKP) == RTC_BKP_DR2) || \
00682 ((BKP) == RTC_BKP_DR3) || \
00683 ((BKP) == RTC_BKP_DR4) || \
00684 ((BKP) == RTC_BKP_DR5) || \
00685 ((BKP) == RTC_BKP_DR6) || \
00686 ((BKP) == RTC_BKP_DR7) || \
00687 ((BKP) == RTC_BKP_DR8) || \
00688 ((BKP) == RTC_BKP_DR9) || \
00689 ((BKP) == RTC_BKP_DR10) || \
00690 ((BKP) == RTC_BKP_DR11) || \
00691 ((BKP) == RTC_BKP_DR12) || \
00692 ((BKP) == RTC_BKP_DR13) || \
00693 ((BKP) == RTC_BKP_DR14) || \
00694 ((BKP) == RTC_BKP_DR15) || \
00695 ((BKP) == RTC_BKP_DR16) || \
00696 ((BKP) == RTC_BKP_DR17) || \
00697 ((BKP) == RTC_BKP_DR18) || \
00698 ((BKP) == RTC_BKP_DR19))
00699
00706 #define RTC_Format_BIN ((uint32_t)0x000000000)
00707 #define RTC_Format_BCD ((uint32_t)0x000000001)
00708 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_Format_BIN) || ((FORMAT) == RTC_Format_BCD))
00709
00717 #define RTC_FLAG_RECALPF ((uint32_t)0x00010000)
00718 #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000)
00719 #define RTC_FLAG_TSOVF ((uint32_t)0x00001000)
00720 #define RTC_FLAG_TSF ((uint32_t)0x00000800)
00721 #define RTC_FLAG_WUTF ((uint32_t)0x00000400)
00722 #define RTC_FLAG_ALRBF ((uint32_t)0x00000200)
00723 #define RTC_FLAG_ALRAF ((uint32_t)0x00000100)
00724 #define RTC_FLAG_INITF ((uint32_t)0x00000040)
00725 #define RTC_FLAG_RSF ((uint32_t)0x00000020)
00726 #define RTC_FLAG_INITS ((uint32_t)0x00000010)
00727 #define RTC_FLAG_SHPF ((uint32_t)0x00000008)
00728 #define RTC_FLAG_WUTWF ((uint32_t)0x00000004)
00729 #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002)
00730 #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001)
00731 #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_TSOVF) || ((FLAG) == RTC_FLAG_TSF) || \
00732 ((FLAG) == RTC_FLAG_WUTF) || ((FLAG) == RTC_FLAG_ALRBF) || \
00733 ((FLAG) == RTC_FLAG_ALRAF) || ((FLAG) == RTC_FLAG_INITF) || \
00734 ((FLAG) == RTC_FLAG_RSF) || ((FLAG) == RTC_FLAG_WUTWF) || \
00735 ((FLAG) == RTC_FLAG_ALRBWF) || ((FLAG) == RTC_FLAG_ALRAWF) || \
00736 ((FLAG) == RTC_FLAG_TAMP1F) || ((FLAG) == RTC_FLAG_RECALPF) || \
00737 ((FLAG) == RTC_FLAG_SHPF))
00738 #define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG) != (uint32_t)RESET) && (((FLAG) & 0xFFFF00DF) == (uint32_t)RESET))
00739
00746 #define RTC_IT_TS ((uint32_t)0x00008000)
00747 #define RTC_IT_WUT ((uint32_t)0x00004000)
00748 #define RTC_IT_ALRB ((uint32_t)0x00002000)
00749 #define RTC_IT_ALRA ((uint32_t)0x00001000)
00750 #define RTC_IT_TAMP ((uint32_t)0x00000004)
00751 #define RTC_IT_TAMP1 ((uint32_t)0x00020000)
00752
00753 #define IS_RTC_CONFIG_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFF0FFB) == (uint32_t)RESET))
00754 #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_TS) || ((IT) == RTC_IT_WUT) || \
00755 ((IT) == RTC_IT_ALRB) || ((IT) == RTC_IT_ALRA) || \
00756 ((IT) == RTC_IT_TAMP1))
00757 #define IS_RTC_CLEAR_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFD0FFF) == (uint32_t)RESET))
00758
00766 #define RTC_DigitalCalibConfig RTC_CoarseCalibConfig
00767 #define RTC_DigitalCalibCmd RTC_CoarseCalibCmd
00768
00777
00778
00779
00780
00781 ErrorStatus RTC_DeInit(void);
00782
00783
00784 ErrorStatus RTC_Init(RTC_InitTypeDef* RTC_InitStruct);
00785 void RTC_StructInit(RTC_InitTypeDef* RTC_InitStruct);
00786 void RTC_WriteProtectionCmd(FunctionalState NewState);
00787 ErrorStatus RTC_EnterInitMode(void);
00788 void RTC_ExitInitMode(void);
00789 ErrorStatus RTC_WaitForSynchro(void);
00790 ErrorStatus RTC_RefClockCmd(FunctionalState NewState);
00791 void RTC_BypassShadowCmd(FunctionalState NewState);
00792
00793
00794 ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
00795 void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct);
00796 void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
00797 uint32_t RTC_GetSubSecond(void);
00798 ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
00799 void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct);
00800 void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
00801
00802
00803 void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
00804 void RTC_AlarmStructInit(RTC_AlarmTypeDef* RTC_AlarmStruct);
00805 void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
00806 ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState);
00807 void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask);
00808 uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm);
00809
00810
00811 void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock);
00812 void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter);
00813 uint32_t RTC_GetWakeUpCounter(void);
00814 ErrorStatus RTC_WakeUpCmd(FunctionalState NewState);
00815
00816
00817 void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation);
00818 uint32_t RTC_GetStoreOperation(void);
00819
00820
00821 void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity);
00822
00823
00824 ErrorStatus RTC_CoarseCalibConfig(uint32_t RTC_CalibSign, uint32_t Value);
00825 ErrorStatus RTC_CoarseCalibCmd(FunctionalState NewState);
00826 void RTC_CalibOutputCmd(FunctionalState NewState);
00827 void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput);
00828 ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod,
00829 uint32_t RTC_SmoothCalibPlusPulses,
00830 uint32_t RTC_SmouthCalibMinusPulsesValue);
00831
00832
00833 void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState);
00834 void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_StampTimeStruct,
00835 RTC_DateTypeDef* RTC_StampDateStruct);
00836 uint32_t RTC_GetTimeStampSubSecond(void);
00837
00838
00839 void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger);
00840 void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState);
00841 void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter);
00842 void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq);
00843 void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration);
00844 void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState);
00845 void RTC_TamperPullUpCmd(FunctionalState NewState);
00846
00847
00848 void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);
00849 uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
00850
00851
00852
00853 void RTC_TamperPinSelection(uint32_t RTC_TamperPin);
00854 void RTC_TimeStampPinSelection(uint32_t RTC_TimeStampPin);
00855 void RTC_OutputTypeConfig(uint32_t RTC_OutputType);
00856
00857
00858 ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS);
00859
00860
00861 void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState);
00862 FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG);
00863 void RTC_ClearFlag(uint32_t RTC_FLAG);
00864 ITStatus RTC_GetITStatus(uint32_t RTC_IT);
00865 void RTC_ClearITPendingBit(uint32_t RTC_IT);
00866
00867 #ifdef __cplusplus
00868 }
00869 #endif
00870
00871 #endif
00872
00881