01. 概述6 v) }2 j9 b( y/ O$ @
RTC相关函数和类型主要在stm32f4xx_rtc.h和stm32f4xx_rtc.c文件中。
; C K" p6 L/ A: a6 l( b$ b" G/ D9 B: d& P; y, k' f
02. 相关类型3 y9 a* ~2 K" t- ~$ X, e, F8 y
- /**
2 A* o+ y) Y0 u/ m! v - * @brief RTC Init structures definition ; ?9 o$ v, ?& p: t2 n4 T" r
- */ # V, w$ d# R5 Q2 b
- typedef struct( `- F% h; J6 D) C$ v/ W- c
- {4 q7 ~ u+ \/ n) [1 L/ Z9 ^
- uint32_t RTC_HourFormat; /*!< Specifies the RTC Hour Format.. w+ Q' k: @6 r+ V" y
- This parameter can be a value of @ref RTC_Hour_Formats */
; {( ]0 t+ @+ I3 O
4 j+ |( B" w# z0 E1 a1 ^- uint32_t RTC_AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value./ N* V3 Z" N* {6 `
- This parameter must be set to a value lower than 0x7F */
6 g- U3 N& x, { E+ J t% N
% t1 t7 ]9 j! U* l1 w- uint32_t RTC_SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value., k& Z+ p% U, u: {' ~2 h
- This parameter must be set to a value lower than 0x7FFF */
) U2 @6 H4 T( ^8 b1 {: B8 d/ _ - }RTC_InitTypeDef;
4 T6 |, F/ U3 z$ ?7 T" u
- {7 Z* r- }+ e' [: p- /** 2 e! ]8 q+ y) j' Y6 E4 \2 m1 ]
- * @brief RTC Time structure definition
* `: e* u( ?, E# s- G& i2 | - */5 _6 z9 R. T+ @# V. `1 F
- typedef struct4 Y( K# R$ ^" t) N
- {
r. Z: h. k0 W. Z8 n* ]. D - uint8_t RTC_Hours; /*!< Specifies the RTC Time Hour.
; z3 J8 A' b+ q- l - This parameter must be set to a value in the 0-12 range5 a% S: F. I0 L- s: R
- if the RTC_HourFormat_12 is selected or 0-23 range if$ I# o' C. u7 t$ H9 M; T" c
- the RTC_HourFormat_24 is selected. */3 k" T d4 M; k" n& O
6 v6 U# @! @# _* `4 o8 Q. N d4 o* {- uint8_t RTC_Minutes; /*!< Specifies the RTC Time Minutes.
$ m5 {$ f- j( {9 D2 ]; t0 W - This parameter must be set to a value in the 0-59 range. */% d: j! N( q) u
2 T7 y6 I9 S! U* a- uint8_t RTC_Seconds; /*!< Specifies the RTC Time Seconds.5 m1 @& F! K3 U+ Q
- This parameter must be set to a value in the 0-59 range. */5 o7 S- W6 ]2 W- n) a9 \
- 0 M2 d5 `- [. C8 p* z
- uint8_t RTC_H12; /*!< Specifies the RTC AM/PM Time.4 {2 L! N! Z1 L* S* s
- This parameter can be a value of @ref RTC_AM_PM_Definitions */
; O3 G) R8 H0 U6 ^9 d; N% g - }RTC_TimeTypeDef;
: t5 }1 ~* k1 }& ~: U - 3 b0 V. I* c% b) |
- /**
' L8 c0 t+ ]* Q7 l) G- } - * @brief RTC Date structure definition
$ Q7 b, m9 s/ d: _& G4 h - */- D6 ^0 P" o9 ]0 I( V
- typedef struct
$ j5 b- V; ]+ W - {6 e4 t) |4 i6 U. @2 @9 K) v5 @6 U
- uint8_t RTC_WeekDay; /*!< Specifies the RTC Date WeekDay.
+ M8 h: Z" a& r4 F. y" u - This parameter can be a value of @ref RTC_WeekDay_Definitions */. M/ o7 P% x$ b$ o7 t7 P8 u# ~
- ' k z4 P' ^% |7 I; H
- uint8_t RTC_Month; /*!< Specifies the RTC Date Month (in BCD format).# @2 D4 j0 i' s: U! x( s I
- This parameter can be a value of @ref RTC_Month_Date_Definitions */5 o% X" Z& o* G' }
' z6 q+ t! B z3 {$ i- uint8_t RTC_Date; /*!< Specifies the RTC Date.
# ?8 }: s% F* @/ u% N. ]7 v! |9 P - This parameter must be set to a value in the 1-31 range. */, `% j4 X# |" h) u
6 B( d. Y9 w, T- {- uint8_t RTC_Year; /*!< Specifies the RTC Date Year.2 F) V- }" ?0 R! U z
- This parameter must be set to a value in the 0-99 range. */4 m3 ^- P" |8 |) a
- }RTC_DateTypeDef;$ b" l; s. L) {. U( @
- / z8 j5 H+ h$ a7 m& h! {
- /**
+ `8 m0 K9 `$ S4 f2 c7 X - * @brief RTC Alarm structure definition
- O2 P) M% f$ M: j - */$ Q# j! T% C! Q9 ~3 z y, @% o; |
- typedef struct; k. v! }- r8 E! z2 e
- {
/ A4 G7 _7 e e7 ~7 t- F6 n5 u - RTC_TimeTypeDef RTC_AlarmTime; /*!< Specifies the RTC Alarm Time members. */, X( a7 [* \, F- U. _
7 U5 N1 R( i1 K# D! C+ J$ P- uint32_t RTC_AlarmMask; /*!< Specifies the RTC Alarm Masks.# Q" b/ {( P! E9 b4 \- y
- This parameter can be a value of @ref RTC_AlarmMask_Definitions */- R% |; U" l+ d8 ]$ h6 w" |
# o9 A6 }1 W! D3 a$ Z- uint32_t RTC_AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.8 f( [7 N4 m$ Z4 }
- This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */* y0 t5 R: U/ x0 F
- / @# h$ `% Y2 }6 O# F5 j9 ]
- uint8_t RTC_AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.; s# `' ~9 b8 ^
- If the Alarm Date is selected, this parameter9 W" J l! H- S8 G& q
- must be set to a value in the 1-31 range.
! s q# B5 I6 F6 I- ]" P - If the Alarm WeekDay is selected, this
. }( }* Z$ b, C8 f% ]4 Q, B - parameter can be a value of @ref RTC_WeekDay_Definitions */! V3 i3 L- a K! X
- }RTC_AlarmTypeDef;1 |/ Z) p- X' K. ^# d I9 i$ A
3 g* z/ K2 X1 c& L' i9 j- /* Exported constants --------------------------------------------------------*/
& n* C1 R2 H/ P, ]* s+ b; s! a
* Q" Y+ |0 f: n7 k- /** @defgroup RTC_Exported_Constants
! q" ]" x) n& C- F5 S6 j* ~6 h. f - * @{
5 r& K3 V# g# \ - */ ; w% j/ D+ Y3 g5 ]9 L
- 9 l/ t, ^$ s0 b5 U; f
- 5 g/ b2 Y( d. H: E# [2 t9 {1 ?$ o
- /** @defgroup RTC_Hour_Formats : A3 y! H K1 F: _4 u7 Z
- * @{4 {( w5 x, v P( E' @- Q {' o
- */ ! e& Q1 N. n& ^' T) \3 z
- #define RTC_HourFormat_24 ((uint32_t)0x00000000)0 B( G1 G% ]+ C* M
- #define RTC_HourFormat_12 ((uint32_t)0x00000040)+ D1 g6 y ]6 _ S4 j* \; F
- #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HourFormat_12) || \
* H- ] F* b, Z - ((FORMAT) == RTC_HourFormat_24))+ k7 C7 e; [6 j% e4 }; r' T
- /**! Y5 O( e( G; g7 {$ I! m) ~9 Q
- * @}
" C9 {) w! x; d8 Y - */
6 h! s+ o) d1 {4 U' { - 5 X. f$ [" ~6 R* y$ P
- /** @defgroup RTC_Asynchronous_Predivider
' T% o8 W8 Y% l3 T9 ^ - * @{
Q9 {; p& T1 V, \& W: i - */ , M9 w: @% o7 h( v. @
- #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7F)
# U6 Z Y3 [$ e, ~# i - , _$ Y( d$ v3 o5 }* p
- /**
7 A( O$ R/ ~7 q( J. G* X2 q) j - * @}
& K% k/ _/ Y" J; u( ]+ Y' c6 q - */ ' }1 _5 p! M- M3 J8 Z
2 U8 G, F7 y ?' g
. V; S+ J; y8 p# I0 f- /** @defgroup RTC_Synchronous_Predivider 0 q7 q) M- C' v: D) ^) L9 J/ ~
- * @{
/ i0 E( u5 U0 j - */
3 H- }" Q* N/ ?' D* g8 h T - #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFF) i- L4 q& ?" ~, _) {; E- d
2 ]) H: e2 {! D4 ?. i- /*** S2 L! b5 m" w% c
- * @}
/ Q% v$ q. R$ E8 Z" M - */ 3 H7 R% h9 ^/ N& `7 g) X. `
- 6 O( R# I0 B5 t1 a* M. t0 Q
- /** @defgroup RTC_Time_Definitions
3 D& T3 U" ?. c) J3 A* q: _ - * @{' p4 l4 h1 e/ o* p0 l8 v
- */ $ s! x4 s* \9 ~+ t5 W, B& M: j
- #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0) && ((HOUR) <= 12))
) ^/ ?9 n/ a( I5 L+ s - #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23)( [, d+ C5 A. X4 K% S
- #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59)
8 P8 B! @ t9 M! z& w/ c - #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59)& K# M j1 D) o
( G, N' j/ r+ ^) p0 P- A' t3 U- /**
- c# p+ s; J9 r7 l - * @}
0 I! I! w) N8 T1 L0 W' [ - */
5 z; g1 k& P( o( Z" Y - # e a) g" t. J, A' P
- /** @defgroup RTC_AM_PM_Definitions
8 U6 ^) h Z7 ]; h% n& ~5 p/ E+ \ - * @{
. j2 `1 b! j) i - */
2 q' _. D9 Q$ y8 N2 H- Q - #define RTC_H12_AM ((uint8_t)0x00)3 X) F t) R; j
- #define RTC_H12_PM ((uint8_t)0x40)/ Y& W. c: N: v' M4 b6 E
- #define IS_RTC_H12(PM) (((PM) == RTC_H12_AM) || ((PM) == RTC_H12_PM))8 w- l; I* r; U! |
- ; R5 U& K: O. X% @5 z- [0 j8 |1 j
- /**
) T1 H1 K6 t& @$ V1 a: o6 n - * @}8 v& I# R- ]6 t5 S9 A2 S4 C. Q
- */
* K; ? k$ i( _6 z* e6 @" R6 \7 b - # ^0 C/ A- x3 ~. z0 z n
- /** @defgroup RTC_Year_Date_Definitions 6 }5 n9 ^* [( s1 I+ k
- * @{
8 w+ H- d3 g5 `4 w, `2 S - */ + ?$ C* n5 `; s
- #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99)
! V& h* _/ w3 r) V* p$ d; I4 V - % r, _4 I$ l8 u; v8 ~3 p" t) G( v- ]
- /**( b; P0 b& l( G
- * @}
0 K$ }( v8 \% ^* L3 v1 V/ `6 A - */ ; ] R9 Y2 p$ l1 @
- ( r: x! s; b- O0 s7 P
- /** @defgroup RTC_Month_Date_Definitions + t" M- a* ^# C) f; I- \6 x9 r; P9 [
- * @{
- W$ g" m! W1 f! W( ]' x' u4 ] - */ " S7 v, g6 _8 p# l' D
- ; X; l/ m% W2 ~/ p2 \6 S8 v
- /* Coded in BCD format */
8 \$ n! X' ~/ k0 C6 E5 ~ - #define RTC_Month_January ((uint8_t)0x01)
9 }# ^5 n! `2 x; j - #define RTC_Month_February ((uint8_t)0x02)6 t9 _: ~7 b7 ]: [. N0 ^
- #define RTC_Month_March ((uint8_t)0x03)
, Y8 V# }' s$ O1 Y - #define RTC_Month_April ((uint8_t)0x04)
4 Y6 b" c3 `" @4 y- W/ ] Z6 W - #define RTC_Month_May ((uint8_t)0x05)
6 L/ ]3 {7 R% L; |7 B L& N - #define RTC_Month_June ((uint8_t)0x06)! U7 ^' a: P- ?0 Y
- #define RTC_Month_July ((uint8_t)0x07)! n( v' w8 H2 r
- #define RTC_Month_August ((uint8_t)0x08)
% ^6 A7 O6 i* ~9 c9 R - #define RTC_Month_September ((uint8_t)0x09)
+ N# Z3 Q4 i9 _; t" [8 f' y - #define RTC_Month_October ((uint8_t)0x10)
! @9 O3 Z- m) Z1 v, a) T7 t' w2 Z) h2 a - #define RTC_Month_November ((uint8_t)0x11)/ _# Q* Y( w4 K* `1 g. C
- #define RTC_Month_December ((uint8_t)0x12)
5 F( \1 L0 O# {& `( `) s" a - #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1) && ((MONTH) <= 12))
# n4 l3 h9 M- ]* u - #define IS_RTC_DATE(DATE) (((DATE) >= 1) && ((DATE) <= 31))
* d6 C3 L9 j1 g
2 a; L7 ?2 G! r1 f- /**
7 D: o3 \& }' \# k - * @}. e; I5 \# t6 R8 b
- */
: l3 g0 @9 h7 K& k+ Y - , l9 P& G* j: b- D z% [2 v, W
- /** @defgroup RTC_WeekDay_Definitions 6 r4 m: z' _- t6 {
- * @{
4 X1 Q; m- \8 d. {5 ] - */ - y; s# c/ ^: K9 ]' \
- 0 E! l$ J$ t( x
- #define RTC_Weekday_Monday ((uint8_t)0x01)1 m- M2 ^8 B$ P. Q& b. o
- #define RTC_Weekday_Tuesday ((uint8_t)0x02)3 O6 |7 r2 f! C z& Y6 d, n/ r
- #define RTC_Weekday_Wednesday ((uint8_t)0x03)
E6 I; p- q7 p2 z - #define RTC_Weekday_Thursday ((uint8_t)0x04)
$ w+ _5 D ]" D" O - #define RTC_Weekday_Friday ((uint8_t)0x05)
1 u6 L9 e3 ~+ S& K1 T: g - #define RTC_Weekday_Saturday ((uint8_t)0x06); n% G- l0 P1 V! u/ l
- #define RTC_Weekday_Sunday ((uint8_t)0x07)
0 o- p4 G6 y1 q% I* ? - #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
0 k+ z; i2 `9 ^' c7 M2 C - ((WEEKDAY) == RTC_Weekday_Tuesday) || \
7 m* G0 O; r9 A' T' ] - ((WEEKDAY) == RTC_Weekday_Wednesday) || \
* X! F3 Y, e- `! ~0 k8 Q6 A - ((WEEKDAY) == RTC_Weekday_Thursday) || \
& t( }: `6 w, k2 i) L: D0 O - ((WEEKDAY) == RTC_Weekday_Friday) || \" D4 I# _6 a( ]' `, t
- ((WEEKDAY) == RTC_Weekday_Saturday) || \
( ]$ G4 _( i- a& Q - ((WEEKDAY) == RTC_Weekday_Sunday))- O+ X) ]1 h. `! w
- /**8 r& B# A: C0 N" N3 j) O8 D
- * @}
4 W4 P. O6 ]7 K, j5 F - */ 9 V9 r4 v9 k. o% G: U1 x; r8 X
- 0 q/ `$ F$ G3 M N0 z
- 9 j7 X5 i( p' M8 M. W
- /** @defgroup RTC_Alarm_Definitions
% N: l; [3 q/ F$ K - * @{
& p) W# U4 u4 W2 W$ h - */
" U0 G0 [$ `* W - #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0) && ((DATE) <= 31))
% V2 @/ T; Z: {( ^" C. t - #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \( M, ~) }, D: c
- ((WEEKDAY) == RTC_Weekday_Tuesday) || \
2 w; H9 R$ S7 p& F1 L. ?1 h" D - ((WEEKDAY) == RTC_Weekday_Wednesday) || \
6 t( h. G q7 r - ((WEEKDAY) == RTC_Weekday_Thursday) || \ h3 m. W& \0 c6 J
- ((WEEKDAY) == RTC_Weekday_Friday) || \
7 H4 {& [1 \8 F) k5 Q - ((WEEKDAY) == RTC_Weekday_Saturday) || \
% n: |1 }& E0 u2 e* R a - ((WEEKDAY) == RTC_Weekday_Sunday))
+ |; Q$ J8 O' F4 Z. a - % N7 X; D/ x7 K- e4 P
- /**9 C( i% k- ~$ S' G5 J
- * @}
9 k3 h" V, I6 @5 O" u - */
* ]( o; q8 \* _9 u5 q0 ?7 x7 J
( F8 c* r- g# X+ \9 Q: D- 7 i0 p2 b% f1 O' [& q
- /** @defgroup RTC_AlarmDateWeekDay_Definitions
0 V6 M- h; w+ Z' ~. ^' A+ [ - * @{" d# s i1 A3 E& ^, A6 B1 p. d
- */ $ y% b$ V% Q" X# G( D
- #define RTC_AlarmDateWeekDaySel_Date ((uint32_t)0x00000000)
! }! G* u/ x2 {8 h - #define RTC_AlarmDateWeekDaySel_WeekDay ((uint32_t)0x40000000)
4 g- N" D( Q9 g& a+ T2 C
# W6 Q7 B9 x% @- #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_AlarmDateWeekDaySel_Date) || \
* P9 T! ~1 N5 d4 @ - ((SEL) == RTC_AlarmDateWeekDaySel_WeekDay))
/ v, ?2 [2 U% F+ b - , @! r8 z D q/ I, Z7 Z- K# K
- /**
/ a0 e# j7 _* r, s# V; Z3 U - * @}; G- I6 O0 ~4 W/ p8 P9 t
- */ & @ Y+ z5 u! W* t9 B
9 K$ X+ F3 N) Y( g" h- 5 v( A* r0 x" l6 g
- /** @defgroup RTC_AlarmMask_Definitions
, |% ~0 `- w. c4 | - * @{
9 l; i7 J0 c4 O% v - */ 4 i8 ?$ h/ C7 n0 p
- #define RTC_AlarmMask_None ((uint32_t)0x00000000)' @2 d3 @8 {, ^' V
- #define RTC_AlarmMask_DateWeekDay ((uint32_t)0x80000000)4 W/ K7 g+ T! _9 r* p
- #define RTC_AlarmMask_Hours ((uint32_t)0x00800000)' I$ t. j p8 t; t8 @- w
- #define RTC_AlarmMask_Minutes ((uint32_t)0x00008000)! p- u/ ^: o6 m0 w
- #define RTC_AlarmMask_Seconds ((uint32_t)0x00000080)
* ^6 \2 W4 W9 v# l0 O - #define RTC_AlarmMask_All ((uint32_t)0x80808080)
- ]3 v- s" ~& U* X7 n. S - #define IS_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
" p( b3 |8 I; P$ K+ P! z' A: L
& E1 ]$ T; x) R) V9 I( A8 }: ^- /**
/ A) T; e4 n8 }2 ? - * @}
0 s M8 R" N! p- V5 C+ \' P - */
+ g0 t& N9 A: q8 T6 ]7 h" _$ }
' _/ _" B. `' v, U- /** @defgroup RTC_Alarms_Definitions $ S# m& t3 B0 b+ \
- * @{- V5 {$ s) S# {
- */
1 M$ ~% `* m9 T- B - #define RTC_Alarm_A ((uint32_t)0x00000100)
; ?$ A+ l+ b0 A- l9 k+ c - #define RTC_Alarm_B ((uint32_t)0x00000200)* j9 F/ K7 J( v9 v" U! w
- #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_Alarm_A) || ((ALARM) == RTC_Alarm_B))
3 r5 E2 X+ n6 {" C n- [ - #define IS_RTC_CMD_ALARM(ALARM) (((ALARM) & (RTC_Alarm_A | RTC_Alarm_B)) != (uint32_t)RESET)6 ~2 ?. ]$ Z" o1 s/ X: j
- ! k4 M9 ~/ @( i9 H4 Y
- /**9 f1 |2 ~3 V# ?
- * @}
c# K/ y. i- y3 I* w8 l6 M - */ " A- P& Z/ D3 }! P, }
- 3 F3 ?; P6 ~6 b2 D8 Z# y! B; t {
- /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions+ z3 Z6 ]1 G" S, L3 O0 h4 ~
- * @{
8 c5 _* I( v1 q8 x - */ " q6 v' h9 T5 G2 }# c( I! ]
- #define RTC_AlarmSubSecondMask_All ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
- S- @$ z+ A1 ^: U - There is no comparison on sub seconds - u/ A$ w, w2 d2 c
- for Alarm */
1 I! h6 y4 Z8 S! m - #define RTC_AlarmSubSecondMask_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm 4 A1 v+ W5 J$ h2 d5 Y- w5 j7 P
- comparison. Only SS[0] is compared. */* g( i: v5 m6 [! }/ J
- #define RTC_AlarmSubSecondMask_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
3 |1 b! x5 O; S+ j% S. Y& {6 W; F - comparison. Only SS[1:0] are compared */
; k3 { J5 M# [! m7 _8 m( f2 Y+ Z - #define RTC_AlarmSubSecondMask_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm & ?0 c4 \4 t& b3 f
- comparison. Only SS[2:0] are compared */1 ^4 M- f) ^! ?9 D: i1 M
- #define RTC_AlarmSubSecondMask_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm + q1 y x7 p3 _$ u8 R
- comparison. Only SS[3:0] are compared */* Q2 e& P5 r: b
- #define RTC_AlarmSubSecondMask_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm , p% _3 @* N) h8 a, t1 \. g# g
- comparison. Only SS[4:0] are compared */
# ?2 o2 R1 d2 R4 D- k) }, A - #define RTC_AlarmSubSecondMask_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
/ p% K* F1 G- m+ I) p% Y5 `* R2 c - comparison. Only SS[5:0] are compared */& [6 |6 c( p, ^0 }5 }$ E: i2 R( g
- #define RTC_AlarmSubSecondMask_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
9 h% j+ v3 f5 n: ?; A - comparison. Only SS[6:0] are compared */
& V# i. r' j5 Z& G3 J8 A, v& ? - #define RTC_AlarmSubSecondMask_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
0 n0 S6 f# }3 a8 {; |7 |. ?, c - comparison. Only SS[7:0] are compared */4 }6 X' [; R: v1 q! D( ]% o
- #define RTC_AlarmSubSecondMask_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
, Z; }- E8 Y# A7 [, Z - comparison. Only SS[8:0] are compared */
# ^2 N2 H5 R) O8 r - #define RTC_AlarmSubSecondMask_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
1 V! V% C% \$ k8 b3 c' a f - comparison. Only SS[9:0] are compared */
6 L- p8 B# V! l7 U2 r* d4 A - #define RTC_AlarmSubSecondMask_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm - a" w/ C) i5 J0 e
- comparison. Only SS[10:0] are compared */
6 |, q; F- R5 r6 O# Z - #define RTC_AlarmSubSecondMask_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm - g& y4 ^$ K/ ]7 N& U% v
- comparison.Only SS[11:0] are compared */4 L% d) d5 p1 S
- #define RTC_AlarmSubSecondMask_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
8 L9 _) e6 u$ P - comparison. Only SS[12:0] are compared */
/ f7 Q, O' G$ l - #define RTC_AlarmSubSecondMask_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm 5 ~6 J& q( f) w9 Q
- comparison.Only SS[13:0] are compared */7 N5 g$ j8 f5 B' B
- #define RTC_AlarmSubSecondMask_None ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match 4 l. Z4 K9 t. J9 Z( n4 \7 r* Y
- to activate alarm. */
1 A; \9 n% N9 Q. Y" i& k1 ?: x - #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_AlarmSubSecondMask_All) || \# @# d Q) v2 W4 E/ B
- ((MASK) == RTC_AlarmSubSecondMask_SS14_1) || \4 I. r5 y1 w+ F9 ~
- ((MASK) == RTC_AlarmSubSecondMask_SS14_2) || \+ M8 D" i$ f" x
- ((MASK) == RTC_AlarmSubSecondMask_SS14_3) || \& H0 @3 }5 G2 ?% [
- ((MASK) == RTC_AlarmSubSecondMask_SS14_4) || \5 b- @4 Z' G7 k' w _; n6 f
- ((MASK) == RTC_AlarmSubSecondMask_SS14_5) || \
( U; v# @9 t# L0 l: J a" l6 b1 N - ((MASK) == RTC_AlarmSubSecondMask_SS14_6) || \
& g8 w* g& Y# a; J0 v" {; c4 s - ((MASK) == RTC_AlarmSubSecondMask_SS14_7) || \% S* H4 f6 U. Q, Y j3 @
- ((MASK) == RTC_AlarmSubSecondMask_SS14_8) || \$ i6 _( Q! L: N, g6 Q% Y$ `' c
- ((MASK) == RTC_AlarmSubSecondMask_SS14_9) || \
! X8 Q; N) ~' E0 s6 G0 Y) ^0 h' h7 S - ((MASK) == RTC_AlarmSubSecondMask_SS14_10) || \
7 {; H6 F A4 w/ \. _- h - ((MASK) == RTC_AlarmSubSecondMask_SS14_11) || \2 j- L x) S7 e- a; [2 {
- ((MASK) == RTC_AlarmSubSecondMask_SS14_12) || \ \' X0 R2 j% y+ G, w+ S- j
- ((MASK) == RTC_AlarmSubSecondMask_SS14_13) || \& M4 V% o6 n& p6 U
- ((MASK) == RTC_AlarmSubSecondMask_SS14) || \8 e- Z" I1 c, b9 H- L
- ((MASK) == RTC_AlarmSubSecondMask_None))( S8 j U# w4 O9 m3 T2 T9 H) |
- /**: a; f$ m# g+ R: i1 m. o
- * @}
0 u) E; V( l/ c8 e6 q. E6 T - */ 5 A. i( A( r5 `/ {
4 P w, e6 {( L y8 \# R, t- /** @defgroup RTC_Alarm_Sub_Seconds_Value2 G2 N3 M' b; ]! o& Y7 a, j
- * @{
' u, b6 @ R7 L9 B7 h- _4 C$ e - */
% ^. O6 i1 f, Q/ g# C1 F6 J" D( m - 3 m- ]) H& v5 @5 J6 u8 n
- #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFF)
8 E( `% b4 L' ^9 G- B+ ]4 Y
( @( d4 ~7 `& o9 B# v! o& o- /**
4 U8 |# ~( E( m' x* t% J- G - * @}. R% t+ u9 p3 g" s9 ?
- */
* h6 P! O) R$ l) A# n - # _3 g8 X6 u9 V* p" H
- /** @defgroup RTC_Wakeup_Timer_Definitions
2 V/ M# D; h$ d" G7 b4 ?: n% z - * @{
7 v K$ a" Y+ y3 J3 ^3 I5 u+ h - */
7 ~( `$ y5 R9 N7 k9 s7 q4 _" b6 g - #define RTC_WakeUpClock_RTCCLK_Div16 ((uint32_t)0x00000000)
% ]% O1 ^7 g' L/ l: T - #define RTC_WakeUpClock_RTCCLK_Div8 ((uint32_t)0x00000001)
4 B, j1 ~1 a* @; U) g2 `, f& f - #define RTC_WakeUpClock_RTCCLK_Div4 ((uint32_t)0x00000002)8 E& }' Q$ x' v
- #define RTC_WakeUpClock_RTCCLK_Div2 ((uint32_t)0x00000003)
/ ]6 g: Z2 c! @* [9 N ` - #define RTC_WakeUpClock_CK_SPRE_16bits ((uint32_t)0x00000004)7 c) D/ ^8 H9 D8 w& z
- #define RTC_WakeUpClock_CK_SPRE_17bits ((uint32_t)0x00000006)3 p2 X, f+ c* K9 V0 X% H/ y7 B8 w0 j
- #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WakeUpClock_RTCCLK_Div16) || \
: N" B& i4 @7 \0 d: u p - ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div8) || \) Y+ Z) r; `* S( |# ?3 a7 x
- ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div4) || \% W* q2 _. k$ h, t- [: N7 L+ M4 e
- ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div2) || \
6 b0 b2 r2 E" O! d7 j - ((CLOCK) == RTC_WakeUpClock_CK_SPRE_16bits) || \
) k1 g0 N7 H4 s( V8 r( l o - ((CLOCK) == RTC_WakeUpClock_CK_SPRE_17bits))
8 F5 @8 [ M1 _/ p3 B6 c- X: ~ - #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
' b- Q3 c2 T, C5 l! L5 j - /**
- v5 A) @4 ], x+ r. D( U - * @}! ~( l1 b6 T2 d& ], {2 w
- */ ^$ {" U( F: w& b1 Z# u
- 6 t/ r8 R" ]+ e2 Y- [7 l$ x- w* a
- /** @defgroup RTC_Time_Stamp_Edges_definitions ' c& X- p' K3 k
- * @{
3 q. v( K3 f1 ^% Y' c - */ ; j; w# l8 `, T* X' z2 x
- #define RTC_TimeStampEdge_Rising ((uint32_t)0x00000000)
9 S! n+ R" h8 i: K6 h% q - #define RTC_TimeStampEdge_Falling ((uint32_t)0x00000008)7 f4 Q3 \' i% o% A
- #define IS_RTC_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TimeStampEdge_Rising) || \
' S! e6 u# i [. D0 Q - ((EDGE) == RTC_TimeStampEdge_Falling))7 w) i: ], n( A" z% R
- /**
, Y+ L I- y1 ]9 M7 z. T$ [7 x$ t1 k - * @}% _) f" I q) L* _- v: ]. L3 A- r
- */ - v9 v3 y1 n* P, o+ t
- 6 L3 X6 }- }4 V
- /** @defgroup RTC_Output_selection_Definitions
0 R& N6 v3 n1 q3 `2 S. s5 L - * @{
8 K9 R/ j, Y6 _. K - */ + s( B, V& B/ p. _8 P
- #define RTC_Output_Disable ((uint32_t)0x00000000)2 Z5 z/ r) x W* x
- #define RTC_Output_AlarmA ((uint32_t)0x00200000)
' Y5 F# _* I0 ]6 u+ f t' K - #define RTC_Output_AlarmB ((uint32_t)0x00400000)
) j" ?5 _* V' r* v% K - #define RTC_Output_WakeUp ((uint32_t)0x00600000)& z7 D+ d0 O! T% I0 Y
5 W# x, x9 p8 }! _- #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_Output_Disable) || \6 ], R5 \! [- U1 i9 V
- ((OUTPUT) == RTC_Output_AlarmA) || \
4 X4 P; K) h, k z7 w! J1 W - ((OUTPUT) == RTC_Output_AlarmB) || \( l+ l: [- \: l* O
- ((OUTPUT) == RTC_Output_WakeUp)), K' K& O# R* I+ T4 X/ e3 X f) w
/ i, W. l" ^. N+ [- /**! k, n( x' D6 @
- * @}
0 D9 C: ^8 ^5 c, Y - */
- g( I/ z: Y0 b2 C - 0 n. Z/ Q* M+ X0 k
- /** @defgroup RTC_Output_Polarity_Definitions
2 f" U5 b7 r0 Y - * @{
2 V: m1 J7 @4 u. } - */ 0 f( F% r2 \% Z- N" P/ r5 V1 E. G
- #define RTC_OutputPolarity_High ((uint32_t)0x00000000)2 p1 a$ b, F# a3 N
- #define RTC_OutputPolarity_Low ((uint32_t)0x00100000)
6 C; L: y3 c9 f - #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OutputPolarity_High) || \# J$ C: \ t( W3 F" Q% z# g
- ((POL) == RTC_OutputPolarity_Low)), U# g" q$ P2 `; H- \- l
- /**
' U0 ~- N9 Z8 z' G8 {! P4 A - * @}
: T. F" G `' j! e2 T$ F - */ # M& v9 ~1 e; B7 v& s0 I2 L# E
- . S& q W) o8 ^5 x N
- ( f) S+ M/ b8 {8 ^& O
- /** @defgroup RTC_Digital_Calibration_Definitions
) T: G2 K# T* O2 i - * @{; O& D4 v- C/ T2 p% p/ g
- */ ) G$ `6 R7 C. B, \+ g) h
- #define RTC_CalibSign_Positive ((uint32_t)0x00000000) 4 r j4 G6 i8 Z1 `! I
- #define RTC_CalibSign_Negative ((uint32_t)0x00000080)
4 b' n+ e' m& y4 V4 W# ~* T# c - #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CalibSign_Positive) || \8 o; k9 I9 w, y2 F
- ((SIGN) == RTC_CalibSign_Negative))
2 r" S M0 x$ z9 N7 H2 n - #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)# a/ z& d) n# l
- * x+ u; h# i1 l8 r: A# _2 C
- /**/ p3 i( ]5 {8 }4 h/ A% i1 p/ y% s
- * @}
+ F2 a! |! u* |8 N+ {% Y - */
: @. J3 X# U% \7 W - & R+ |2 W0 L( c6 o. {8 _
- /** @defgroup RTC_Calib_Output_selection_Definitions
8 n0 b! s3 L1 g+ p* W: G$ r) b - * @{
. k. l: N1 [4 s, w; Z: _ - */ : V3 R: a( O/ e* \' p
- #define RTC_CalibOutput_512Hz ((uint32_t)0x00000000)
( z$ X3 _1 q& |0 E - #define RTC_CalibOutput_1Hz ((uint32_t)0x00080000)2 ]0 [! d+ s# g4 n5 @% G$ Z2 Z6 Y6 D
- #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CalibOutput_512Hz) || \: \8 |# t$ B! D3 g* p; n
- ((OUTPUT) == RTC_CalibOutput_1Hz))7 q1 {; o% m5 Q S9 c j* Z6 \
- /**! b3 Z& Y# A1 S' O
- * @}" |& x% x' R5 b4 A! ?( N
- */
- ]. ]9 s2 c/ L9 t
5 b/ _* _7 u% I, u( D9 Q9 R$ X6 M- /** @defgroup RTC_Smooth_calib_period_Definitions
& K# f+ c1 E5 d - * @{4 G3 ?6 j- Y' k3 ]
- */ 1 Z# H8 ^" [: l( m+ w" i
- #define RTC_SmoothCalibPeriod_32sec ((uint32_t)0x00000000) /*!< if RTCCLK = 32768 Hz, Smooth calibation" {' `" M: m( i2 d0 Y) J5 P! d
- period is 32s, else 2exp20 RTCCLK seconds */5 e1 w7 a# |) y& w
- #define RTC_SmoothCalibPeriod_16sec ((uint32_t)0x00002000) /*!< if RTCCLK = 32768 Hz, Smooth calibation
" H# Y+ p9 W! j) v - period is 16s, else 2exp19 RTCCLK seconds */
' u# N* R: G& q: v% ^) q/ X - #define RTC_SmoothCalibPeriod_8sec ((uint32_t)0x00004000) /*!< if RTCCLK = 32768 Hz, Smooth calibation . y( t0 K7 V$ e
- period is 8s, else 2exp18 RTCCLK seconds *// A' c$ @: M- F7 v) Q% W
- #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SmoothCalibPeriod_32sec) || \9 E2 i( a- i4 F* U; }, {2 g: t2 Q
- ((PERIOD) == RTC_SmoothCalibPeriod_16sec) || \) ?/ U3 V7 _' v% e- N* L" ]% P+ ~
- ((PERIOD) == RTC_SmoothCalibPeriod_8sec))3 M6 W; l' R/ V, m& U3 t4 L
- 8 s6 `! ~& I+ `* \/ g9 f5 a
- /**' j u* ]( i( @; c9 i; F8 o/ j
- * @}! m6 D* j$ c: l! B
- */
* V+ @# S' V. y" Y) P - $ ?( n6 N1 f* j5 r9 K' N& o
- /** @defgroup RTC_Smooth_calib_Plus_pulses_Definitions $ D; K9 B5 p( X
- * @{
, W, ]; `- t9 {+ F - */
6 C& g1 M4 Y: i; Z! w - #define RTC_SmoothCalibPlusPulses_Set ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added 2 U1 `5 Z1 f6 \' P0 H" M( |
- during a X -second window = Y - CALM[8:0]. 7 o& C* G" Q7 r/ ?1 I7 \" c
- with Y = 512, 256, 128 when X = 32, 16, 8 */; P1 m b6 U( f \' u/ j# e/ n
- #define RTC_SmoothCalibPlusPulses_Reset ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited) o8 A% ?5 d; P
- during a 32-second window = CALM[8:0]. */& r4 {4 V; y& ~0 {
- #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SmoothCalibPlusPulses_Set) || \
' v0 Y7 U. I) p1 o C - ((PLUS) == RTC_SmoothCalibPlusPulses_Reset)). z. b/ k9 g! j4 ^- _' C7 Y! d, P* }
- 3 n7 D) _ T: m& C& F3 j: g# [
- /*** M" N9 G6 @% M |7 b( L! k
- * @}
, A% }2 x6 I% l; x, R - */
7 M3 P) R/ z$ e) |) o7 ]
1 u4 N% B8 F3 V* ^6 l0 V! I- /** @defgroup RTC_Smooth_calib_Minus_pulses_Definitions
' d3 R5 x+ W4 `7 V - * @{' }8 k, y$ {/ Y A
- */
: Y$ U* l# \. i0 o" v) m5 h( d - #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
+ T- u" M' u c) x$ P
. ? k, n. M: ^4 H+ a9 y- /**
3 m6 H- e1 R* S6 o1 P$ x- S - * @}
6 X+ ]" E0 i" Z - *// b: y" M; u1 z) O
& R8 I( z" Z' c- /** @defgroup RTC_DayLightSaving_Definitions 6 p( s. H" @& _: h! Q; n& \' I$ ^8 i
- * @{8 A7 ~# K4 X$ H8 w( q
- */ 7 K2 O7 X) V8 }, r4 S2 g: n+ s! P/ S
- #define RTC_DayLightSaving_SUB1H ((uint32_t)0x00020000)8 L) m) p6 U! h$ d* `1 d, \+ `7 w& z
- #define RTC_DayLightSaving_ADD1H ((uint32_t)0x00010000)
3 |, K _" H/ i6 ]. \. ? - #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DayLightSaving_SUB1H) || \" T2 ^, ~ o5 \. Z5 x# P1 p% Z
- ((SAVE) == RTC_DayLightSaving_ADD1H))4 r5 Z$ h" S" y( d" G
& e- v! X1 p4 K8 h* u- g- #define RTC_StoreOperation_Reset ((uint32_t)0x00000000)) E8 X9 N1 k- \ A5 c& {
- #define RTC_StoreOperation_Set ((uint32_t)0x00040000)) z1 x8 W5 t! \ b$ j# i$ ] Q
- #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_StoreOperation_Reset) || \* D* I; T7 e% e# u3 G6 R* m
- ((OPERATION) == RTC_StoreOperation_Set))
. g a* ~8 d$ m5 q1 s - /**
- M9 F# I6 z( P5 t6 A - * @}
c O) s( f7 o* m9 ` m2 t - */ 6 b2 Q% N/ f( p3 H( Y a$ W
- 8 g, }$ B4 h/ Y x0 l* K
- /** @defgroup RTC_Tamper_Trigger_Definitions ! {5 x, V7 n g8 I5 o
- * @{3 Z/ z9 E8 [$ \8 L g6 Q
- */ , l/ T1 M) _! V* t; h) k0 V
- #define RTC_TamperTrigger_RisingEdge ((uint32_t)0x00000000)
( R8 v/ p/ A2 U5 P - #define RTC_TamperTrigger_FallingEdge ((uint32_t)0x00000001)
0 |* T# ~" v3 C6 [ - #define RTC_TamperTrigger_LowLevel ((uint32_t)0x00000000), _8 U" ?) r4 r: d
- #define RTC_TamperTrigger_HighLevel ((uint32_t)0x00000001)5 Y4 B! x4 V7 b7 B$ P% ?$ Y0 r
- #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TamperTrigger_RisingEdge) || \' u2 J6 u- e- A
- ((TRIGGER) == RTC_TamperTrigger_FallingEdge) || \
( M' f z: M1 N6 ~0 }1 i - ((TRIGGER) == RTC_TamperTrigger_LowLevel) || \
/ N) Y) t0 c1 Q. m0 { - ((TRIGGER) == RTC_TamperTrigger_HighLevel)) % a2 N. b- {# c5 y5 s* w5 Y& X
- , g8 d. Q% A2 j& \
- /**7 X9 L& G1 U ^# |# f# C& I+ A
- * @}
0 @4 h6 @+ i7 N A% |5 M - */ 8 Y" _5 Z+ u1 Y# N, | l% m7 R+ X8 }9 L
- : W3 D8 g6 k6 H6 A& q
- /** @defgroup RTC_Tamper_Filter_Definitions 3 c; ]/ f& N* V9 }( K- x, v1 d
- * @{/ v: Q5 f' S# Q" C+ r
- */
$ @( n! Z v# d) ?: d" a/ V; ~+ C - #define RTC_TamperFilter_Disable ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
% |' \, y$ i2 }0 _1 ~; I - 3 ^' G# z4 i' c: E+ N: q2 |
- #define RTC_TamperFilter_2Sample ((uint32_t)0x00000800) /*!< Tamper is activated after 2 * q+ e/ V% B9 S9 W7 Y
- consecutive samples at the active level */
- L$ R# ^" E5 ?% ^ - #define RTC_TamperFilter_4Sample ((uint32_t)0x00001000) /*!< Tamper is activated after 4 + R1 H( b* h1 O
- consecutive samples at the active level */3 D6 _, ?, {: j9 C" n$ P
- #define RTC_TamperFilter_8Sample ((uint32_t)0x00001800) /*!< Tamper is activated after 8 4 C- ^: S8 {% p+ i; N+ @
- consecutive samples at the active leve. */* g$ _2 ?6 S# Q% V; h0 y: \
- #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TamperFilter_Disable) || \4 S* p$ Q' Z# F7 w
- ((FILTER) == RTC_TamperFilter_2Sample) || \
% `: u5 j4 S9 g8 g - ((FILTER) == RTC_TamperFilter_4Sample) || \
- a: X; j. I7 j7 Z7 A, _ - ((FILTER) == RTC_TamperFilter_8Sample))4 e/ l3 P2 g: S4 A& d' p4 Z
- /**
, C; D: A1 R8 ]2 D- O - * @}
2 y* b) B7 U" ^8 I - */
/ D1 Q9 Q L6 D& w% V
8 e% T5 J2 h4 A' M7 Z- /** @defgroup RTC_Tamper_Sampling_Frequencies_Definitions 7 `% {4 ]" ~5 {7 y1 E# G
- * @{5 M" ~* ?0 Q4 y% @9 {" W
- */ 6 |) I/ T+ M' x; M! w5 q' D8 {
- #define RTC_TamperSamplingFreq_RTCCLK_Div32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled! s6 u- l0 N( V/ p/ M
- with a frequency = RTCCLK / 32768 */) [8 ]' `7 Z `
- #define RTC_TamperSamplingFreq_RTCCLK_Div16384 ((uint32_t)0x000000100) /*!< Each of the tamper inputs are sampled: h l! x# _. ~5 `2 `+ z# u- P
- with a frequency = RTCCLK / 16384 */: `; U/ I& U# f' E
- #define RTC_TamperSamplingFreq_RTCCLK_Div8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
9 A' w- v/ ~' [$ S - with a frequency = RTCCLK / 8192 */
3 Z# O, o% d2 k2 Y" w Q - #define RTC_TamperSamplingFreq_RTCCLK_Div4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled+ ~& E( }! J; O& S* m
- with a frequency = RTCCLK / 4096 */
; B( V' |: j3 p1 C, _: | - #define RTC_TamperSamplingFreq_RTCCLK_Div2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled& W' d" z* S3 _1 _
- with a frequency = RTCCLK / 2048 */
; o4 J" M3 D7 O1 R - #define RTC_TamperSamplingFreq_RTCCLK_Div1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled$ @( M3 f( X: X
- with a frequency = RTCCLK / 1024 */
6 c- x% K& q# |% d( j4 ? - #define RTC_TamperSamplingFreq_RTCCLK_Div512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
( T6 g7 E- A( ` v - with a frequency = RTCCLK / 512 */# P' k, z. i7 c4 O( R2 [" \; S
- #define RTC_TamperSamplingFreq_RTCCLK_Div256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
5 Z- {, f2 F) p9 f4 [0 s - with a frequency = RTCCLK / 256 */' z7 J9 N' T8 h9 b
- #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div32768) || \6 z2 r3 @9 D' V" Z. G
- ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div16384) || \
g" B2 r4 W$ R8 b( F9 R7 E - ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div8192) || \
/ [8 D8 V" t" t2 g& S( p7 m: T( V - ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div4096) || \4 `8 x5 m) G7 ~' `" {
- ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div2048) || \# p/ \' G# y, r# g( n$ U
- ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div1024) || \
5 V" ~# V; W5 u( D6 ]9 S5 p - ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div512) || \) R; {# A! q7 }+ n& c% S
- ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div256))8 [, ^3 ?* @6 x4 f2 \' C2 g+ Z
- 0 [- ~" d0 G% t( {5 `, d: u
- /**
. F6 \$ s7 U8 w' y - * @}
2 c' C, d* s9 t - */. ]& L8 L: h5 f' r) N z
- 9 h8 g! \4 ]6 F) N0 J+ G$ A+ N
- /** @defgroup RTC_Tamper_Pin_Precharge_Duration_Definitions " a. q8 B* T4 W* y
- * @{: L( b2 R% ]& D5 }0 B
- */ ( N; q" \* j. |, }* x
- #define RTC_TamperPrechargeDuration_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
. p7 i' R, W* k$ |+ { z - sampling during 1 RTCCLK cycle */ p5 I5 B+ r9 b5 b
- #define RTC_TamperPrechargeDuration_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before + r/ {1 e& j3 g
- sampling during 2 RTCCLK cycles */+ k/ s1 u: ]5 _, y0 _
- #define RTC_TamperPrechargeDuration_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
" @- X ^$ g' N7 {, E, u - sampling during 4 RTCCLK cycles */9 X) d4 }7 x) A
- #define RTC_TamperPrechargeDuration_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before 3 Z: M$ k8 R, g4 Y3 w
- sampling during 8 RTCCLK cycles */- L9 @$ C( _% K* l: h- K
- * {5 M1 a. j# r* [5 i4 Q
- #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TamperPrechargeDuration_1RTCCLK) || \
U* n% |/ ^. X; b# X - ((DURATION) == RTC_TamperPrechargeDuration_2RTCCLK) || \
: h0 _# `! `5 C% ^- M - ((DURATION) == RTC_TamperPrechargeDuration_4RTCCLK) || \
$ T1 l+ b5 Q" }9 m: E. f- V) R - ((DURATION) == RTC_TamperPrechargeDuration_8RTCCLK))
) w* P, A: c) ~2 X& H$ F" ^ - /**
4 Q: U% w1 ?# Y/ q( T: d - * @}1 \& H1 D8 J8 T( n
- */
; H1 x3 t1 h; o& T, E0 E
1 r& ~: l& I, T5 ^# Z' @; m- /** @defgroup RTC_Tamper_Pins_Definitions
! w( f4 K' _4 \& \ - * @{, D/ s+ y" }, G/ S T2 M
- */ ~# K9 n/ n8 C$ A0 r
- #define RTC_Tamper_1 RTC_TAFCR_TAMP1E) Q: L( p1 R# z1 p" ?
- #define IS_RTC_TAMPER(TAMPER) (((TAMPER) == RTC_Tamper_1))
( a% p l4 ~/ n$ ]5 j7 K - ' S* ?6 K* t$ [; u" t
- /**
/ B% ~1 R) n7 s; y0 D5 g - * @}, O/ p, ]. p- v1 e, R
- */
$ B4 C* H8 g# `8 C0 _( M/ C - 5 S& }- i8 E; X8 q
- /** @defgroup RTC_Tamper_Pin_Selection
9 @' A" A0 q4 w5 j% w$ a* Z - * @{
; z9 `/ G0 b( ?4 i - */ $ [ {2 x/ c( Z! G* D, Z5 S
- #define RTC_TamperPin_PC13 ((uint32_t)0x00000000)
4 C1 N: M5 k/ t% x. O# y4 u - #define RTC_TamperPin_PI8 ((uint32_t)0x00010000)
9 r" L6 J4 u+ q7 K - #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TamperPin_PC13) || \% p# Y6 ?- q% x! ?! G
- ((PIN) == RTC_TamperPin_PI8))( l0 |6 k' d! [& w6 R0 U+ k
- /**
" ~8 k/ ]# h$ R/ R/ Y* W4 P - * @}% I2 g& @4 v( c8 g# D$ C! L8 _
- */ , H, b n8 _0 ?% V4 \; H( H
" v' c9 _. ~/ Z/ `: T: O' A6 ?- /** @defgroup RTC_TimeStamp_Pin_Selection
9 |6 V& W+ C* K8 _$ y$ w - * @{ V' e8 T4 C: O
- */ ; t" _- U+ Y% n/ G0 H4 S" {
- #define RTC_TimeStampPin_PC13 ((uint32_t)0x00000000)
- U3 b0 C" s8 E - #define RTC_TimeStampPin_PI8 ((uint32_t)0x00020000)& ^3 Q% s d/ q0 j! \
- #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TimeStampPin_PC13) || \
/ e- h$ g7 @& F; A2 {, x/ G8 j4 _; |' B - ((PIN) == RTC_TimeStampPin_PI8))
# u) C2 g) E; l" N' c$ L - /**
% c8 _- N/ V1 a. y; s+ V - * @}* U. f: I1 Y% B' k7 c; |! @
- */ 1 q6 W, n4 s3 D( X$ G) j
1 n% q+ z" J& l( S1 @- /** @defgroup RTC_Output_Type_ALARM_OUT
* e9 I9 k1 y* Q# x9 { ?2 Q - * @{. m& b' ~' Z T$ @; `$ l; ~
- */
; h$ X) l& D4 r- @* d, B, k - #define RTC_OutputType_OpenDrain ((uint32_t)0x00000000)9 k1 ]& Z+ E+ m, z s2 O
- #define RTC_OutputType_PushPull ((uint32_t)0x00040000)
9 L$ I3 Q: w8 P% Q! [ - #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OutputType_OpenDrain) || \( c% ]: }& L7 _2 E$ c3 _4 t+ R
- ((TYPE) == RTC_OutputType_PushPull))% A4 g4 z9 W# z# `0 D! F
1 V0 E2 q0 ^+ T- /**
! x* @) F) S% g" y* p3 L - * @}
* S; Y0 P8 Y% t; A/ H! X7 P - */ ( W. i8 {& |! M( M
- : x5 ?* ~' c4 d
- /** @defgroup RTC_Add_1_Second_Parameter_Definitions
% R0 N& G' e L, b K! U - * @{! E" Q( j% }4 V. X1 X; e
- */ ) U( h h x" `; _$ l
- #define RTC_ShiftAdd1S_Reset ((uint32_t)0x00000000)* v% T* q! e7 t( A6 k) P7 P
- #define RTC_ShiftAdd1S_Set ((uint32_t)0x80000000)7 X4 s# q/ \5 V' r
- #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_ShiftAdd1S_Reset) || \+ e' o: C/ r8 |+ W* A
- ((SEL) == RTC_ShiftAdd1S_Set))
A X/ m; v0 B- j; k- Q - /**9 P0 ^1 r. J7 K W+ r! ~' E
- * @}
/ x: f# ]) k* E1 j3 U2 W6 d - */ ! d! T- C8 v& x. T% I( N t" t
7 ^" _( D2 h9 Q- }- /** @defgroup RTC_Substract_Fraction_Of_Second_Value. W8 N/ E; Q. \8 ^# O- s
- * @{' L2 l3 K1 T2 G1 N6 I# |
- */ % k4 J: G Z. X
- #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
3 _9 x7 @+ b6 ]
" h: W+ U& _( G! h; N& g' F* x- /**
2 V* X( z( ?/ ]4 D# B0 w9 H9 b- b - * @}
" p! @, s4 i5 e( H, e/ h - */9 r N+ @) Z6 A* p4 D
- # I" b+ C, Z% Z5 ?0 W0 q* k
- /** @defgroup RTC_Backup_Registers_Definitions
; j) f; q1 Y" e8 W% f, N - * @{9 k3 X1 J4 Y* k" T" H% S, y6 F/ d
- */
) F; w1 D) K# k. B7 }$ q$ \
- F$ Z3 I% J# O+ r" Z- #define RTC_BKP_DR0 ((uint32_t)0x00000000)
5 c* }9 W) M1 Z W( q9 U - #define RTC_BKP_DR1 ((uint32_t)0x00000001)" ^# `- {% D5 @6 G) a7 R
- #define RTC_BKP_DR2 ((uint32_t)0x00000002)1 s# i) _ y9 \2 S
- #define RTC_BKP_DR3 ((uint32_t)0x00000003)
* u/ p7 m0 q7 s0 |- k - #define RTC_BKP_DR4 ((uint32_t)0x00000004)
, t! R9 Q- O) ^' t1 N" G+ P - #define RTC_BKP_DR5 ((uint32_t)0x00000005), Q. h0 L& R( M2 s0 a' Y3 X
- #define RTC_BKP_DR6 ((uint32_t)0x00000006)5 R; n% o0 {5 ?* Y2 F
- #define RTC_BKP_DR7 ((uint32_t)0x00000007)
' W* C. B' H6 |' s# @) S' A - #define RTC_BKP_DR8 ((uint32_t)0x00000008)) W) s/ i- c" M" l
- #define RTC_BKP_DR9 ((uint32_t)0x00000009)5 k6 E- K" h( ]' b9 j* D
- #define RTC_BKP_DR10 ((uint32_t)0x0000000A)1 u% z/ z& e" e$ C4 {
- #define RTC_BKP_DR11 ((uint32_t)0x0000000B)% U0 k, L' }2 N( H' m
- #define RTC_BKP_DR12 ((uint32_t)0x0000000C)0 J) a' C- s+ W+ U
- #define RTC_BKP_DR13 ((uint32_t)0x0000000D)
8 P. Q' Z3 h& C5 |' T$ l. y) g - #define RTC_BKP_DR14 ((uint32_t)0x0000000E)
5 F" t1 U3 y' Y1 h* H - #define RTC_BKP_DR15 ((uint32_t)0x0000000F)
) c, U0 r4 m$ |) w5 d - #define RTC_BKP_DR16 ((uint32_t)0x00000010)
3 d3 Q7 K( y) t" `" |' x - #define RTC_BKP_DR17 ((uint32_t)0x00000011)& s& o3 Z. z; c# S* W2 q
- #define RTC_BKP_DR18 ((uint32_t)0x00000012)
. n3 r. _# l& w2 R, n - #define RTC_BKP_DR19 ((uint32_t)0x00000013)0 o, K- b* [- w( n0 d7 Y9 ?8 s( c
- #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
8 e, K& y1 @5 p( l8 [ - ((BKP) == RTC_BKP_DR1) || \
' `4 i+ E$ }8 @, S \ - ((BKP) == RTC_BKP_DR2) || \
% y- r4 z5 ~$ _6 C! \3 w; O' u - ((BKP) == RTC_BKP_DR3) || \
7 c6 W9 r- \. y* ? - ((BKP) == RTC_BKP_DR4) || \$ M% {$ a9 r2 P
- ((BKP) == RTC_BKP_DR5) || \( J/ y! P' g1 W
- ((BKP) == RTC_BKP_DR6) || \
J% h4 v" T3 u% ~5 x% r - ((BKP) == RTC_BKP_DR7) || \
5 v4 m" c x- y; ?4 z5 d# b! `9 ^* n. A - ((BKP) == RTC_BKP_DR8) || \, ~( H, f5 _8 K7 R$ `
- ((BKP) == RTC_BKP_DR9) || \; [" A8 k& R; {' M, q
- ((BKP) == RTC_BKP_DR10) || \7 N' s4 W6 P3 M4 B/ h
- ((BKP) == RTC_BKP_DR11) || \
$ r; I& e7 b0 H2 f - ((BKP) == RTC_BKP_DR12) || \
/ I* S6 d( k+ P2 Q - ((BKP) == RTC_BKP_DR13) || \
/ }- E3 n3 ]/ m3 u - ((BKP) == RTC_BKP_DR14) || \
2 W9 V& X0 f& a4 K$ V' N3 M4 G - ((BKP) == RTC_BKP_DR15) || \
% u8 Q# h4 A/ `! R1 A" Q - ((BKP) == RTC_BKP_DR16) || \. E: e, E5 m; y6 `1 R z' @
- ((BKP) == RTC_BKP_DR17) || \1 @# |5 {5 U+ L, `4 |( {
- ((BKP) == RTC_BKP_DR18) || \- ~" {3 Y5 ~) `* n# H; \6 n" L
- ((BKP) == RTC_BKP_DR19))2 H/ |0 O8 Y0 M
- /**
+ U; o. A; {* j& v - * @}2 G2 F9 E% a* q0 P( X( l
- */
) p3 r* F: _; G+ T% N - . n `8 D) _7 f- u& s4 A4 _
- /** @defgroup RTC_Input_parameter_format_definitions ) ?$ J4 y ~& {" @; c: v
- * @{( o1 i4 e, ?6 P6 x/ e2 J0 _
- */
, B9 S5 f. K( | e; p - #define RTC_Format_BIN ((uint32_t)0x000000000)
( S: ^! l5 `4 v/ {; q. S$ { - #define RTC_Format_BCD ((uint32_t)0x000000001)
& C" m5 J- O# ]$ _" q$ B9 Y8 B& L - #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_Format_BIN) || ((FORMAT) == RTC_Format_BCD))
7 V j5 ?, k) L% W# E3 [& r
% H& z9 T4 g" u: b' @5 f- /**3 q2 n2 E# o6 ~" C1 D- r
- * @}0 {1 ?; D- V% V8 |% x; n( U5 H
- */
3 x( J* }) v4 t1 D& | P - * R. o5 o8 R- h; c) `( e
- /** @defgroup RTC_Flags_Definitions # w4 E. f& u P) q* v; w
- * @{
3 _) e6 I4 e: {' i( q' S - */
- H+ @! |# `, {3 y - #define RTC_FLAG_RECALPF ((uint32_t)0x00010000)! h+ ~$ v+ z( ~3 e% m
- #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000) L9 @. I6 R# O `- k
- #define RTC_FLAG_TSOVF ((uint32_t)0x00001000)" A6 o9 ?) m+ \* [( J7 Q- ^
- #define RTC_FLAG_TSF ((uint32_t)0x00000800) C( S5 E4 Q! H4 l2 S
- #define RTC_FLAG_WUTF ((uint32_t)0x00000400)$ ]; O8 U( c5 y0 b0 x
- #define RTC_FLAG_ALRBF ((uint32_t)0x00000200)- ?6 p1 @1 y. Y+ E
- #define RTC_FLAG_ALRAF ((uint32_t)0x00000100)
& F) z% t L. {2 t: r; \) s - #define RTC_FLAG_INITF ((uint32_t)0x00000040)
1 q/ O3 Q) t, K# N% N% B. v - #define RTC_FLAG_RSF ((uint32_t)0x00000020)( D" c- l. n2 J5 d7 Q: F
- #define RTC_FLAG_INITS ((uint32_t)0x00000010)
4 y7 D0 s y; P \' J8 \% r, } - #define RTC_FLAG_SHPF ((uint32_t)0x00000008)$ J4 k/ g; }: u6 f
- #define RTC_FLAG_WUTWF ((uint32_t)0x00000004)5 W1 T" V, E% a7 i
- #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002)0 I& a4 K( _/ N; U) R; n, U" q% [
- #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001)
0 N& j# P5 \# W" \' p - #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_TSOVF) || ((FLAG) == RTC_FLAG_TSF) || \
3 n8 a. X/ n* v+ L, j7 G" q3 v J8 { - ((FLAG) == RTC_FLAG_WUTF) || ((FLAG) == RTC_FLAG_ALRBF) || \
2 i) ?8 U1 B* Z) S9 |: h! { - ((FLAG) == RTC_FLAG_ALRAF) || ((FLAG) == RTC_FLAG_INITF) || \
% D& v4 Y% i( i6 |& f/ s - ((FLAG) == RTC_FLAG_RSF) || ((FLAG) == RTC_FLAG_WUTWF) || \" G8 w4 S0 l9 E2 S8 Z$ d9 D
- ((FLAG) == RTC_FLAG_ALRBWF) || ((FLAG) == RTC_FLAG_ALRAWF) || \! a# ~* Q4 K; Z
- ((FLAG) == RTC_FLAG_TAMP1F) || ((FLAG) == RTC_FLAG_RECALPF) || \4 R2 |, S9 \" S) v& s
- ((FLAG) == RTC_FLAG_SHPF))
4 e1 |* X- o' R7 G, l6 u9 q4 { - #define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG) != (uint32_t)RESET) && (((FLAG) & 0xFFFF00DF) == (uint32_t)RESET))3 Y% F0 Y1 R+ i) `
- /**
7 w& q9 n2 u5 K, |- P, N - * @}
# T3 d2 N5 H; m$ x, a5 f- W8 z - */
2 S& W( Y' _8 r! W" |' @ - . T+ b0 |# x# H) H
- /** @defgroup RTC_Interrupts_Definitions
; D- U+ [+ X& ?8 X$ Q - * @{; B6 Z+ d+ v2 n) k0 a
- */ $ K- F) j S5 _; ]: S
- #define RTC_IT_TS ((uint32_t)0x00008000)% I; U, p% P2 R
- #define RTC_IT_WUT ((uint32_t)0x00004000)
) L( [/ E+ \( S" [8 m - #define RTC_IT_ALRB ((uint32_t)0x00002000)
+ M8 U) @5 J" C0 i0 { s5 L - #define RTC_IT_ALRA ((uint32_t)0x00001000)2 c0 ?" |0 N) f; ~* n- ?8 v; a# _
- #define RTC_IT_TAMP ((uint32_t)0x00000004) /* Used only to Enable the Tamper Interrupt *// Y4 _- R2 z* m7 t7 j7 m
- #define RTC_IT_TAMP1 ((uint32_t)0x00020000)9 A: J( W- X8 t/ e: f ?' Y
5 ^$ A7 F7 k' }' o, r) l3 x- #define IS_RTC_CONFIG_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFF0FFB) == (uint32_t)RESET)). X2 f/ r5 v% H8 [- l. b
- #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_TS) || ((IT) == RTC_IT_WUT) || \* N! ], t) }9 U, }9 p" V: L$ s5 L
- ((IT) == RTC_IT_ALRB) || ((IT) == RTC_IT_ALRA) || \ T0 ~6 G% I r# E# ^6 }% [
- ((IT) == RTC_IT_TAMP1))8 ]( |" v: J2 q6 g X
- #define IS_RTC_CLEAR_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFD0FFF) == (uint32_t)RESET))( e8 {# B; s7 Y) i
3 r [" b" N H: N6 c- /**$ M6 q, x0 s6 V( z6 L
- * @}% }1 N2 |) p1 a) M6 v! ^! i
- */ ; z; b4 g; d7 Z! v" Z4 ]
7 b) K+ L' d# _6 P$ X% Z q- /** @defgroup RTC_Legacy
/ B" e) e+ u+ x# @3 A5 @. \5 m3 B - * @{
, Z5 C! u6 @- @6 f$ y( y- r- @ - */
+ g/ n* K% V O' W/ }" R - #define RTC_DigitalCalibConfig RTC_CoarseCalibConfig
5 z2 T! A1 n- H - #define RTC_DigitalCalibCmd RTC_CoarseCalibCmd
复制代码
! K9 |0 k. M4 n03. 相关函数
" \$ r* V8 w; M/ [) Z- /* Function used to set the RTC configuration to the default reset state *****/
8 O# V7 L6 [& S# z; c8 u2 ] - ErrorStatus RTC_DeInit(void);, r) [/ H' ?* _" n
- " X a- p/ ^8 B" y1 m" G
- /* Initialization and Configuration functions *********************************/
0 }. `2 `3 A w- O0 `7 n6 d - ErrorStatus RTC_Init(RTC_InitTypeDef* RTC_InitStruct);" @7 V: [8 @" F) h/ q
- void RTC_StructInit(RTC_InitTypeDef* RTC_InitStruct);
' {+ t4 e% R$ K - void RTC_WriteProtectionCmd(FunctionalState NewState);, K1 G% O! O. b; i5 m
- ErrorStatus RTC_EnterInitMode(void);
# [& i% g b; ]7 Z7 [2 `2 f: ^ - void RTC_ExitInitMode(void);
8 |5 L/ Z n4 O - ErrorStatus RTC_WaitForSynchro(void);% }$ F. |3 v" J2 h9 _9 e
- ErrorStatus RTC_RefClockCmd(FunctionalState NewState);# l9 v& _& A) Z% g7 \5 t
- void RTC_BypassShadowCmd(FunctionalState NewState);: B# z2 Z9 c# D* ^ \
/ R9 L% h. N6 l+ w+ [ c/ N- /* Time and Date configuration functions **************************************/
7 a8 r* R6 ?# ` - ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);" x/ a) C% B' e
- void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct);
, P) c* |: k# T3 V) m - void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);, l4 `& s8 J# G; E1 f0 o: s
- uint32_t RTC_GetSubSecond(void);6 Y; p) o7 f& y9 W% ]! A
- ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);; M$ E0 c8 D. L: D
- void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct);8 [9 a" T z, c( B, S
- void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct); k# m G8 B/ T4 l; f
. _% ]# e# I8 B: I0 Y4 b; r- /* Alarms (Alarm A and Alarm B) configuration functions **********************/
1 ~% ?9 q- Z+ z; j v9 ^' Y - void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
( V( i f% ?& F - void RTC_AlarmStructInit(RTC_AlarmTypeDef* RTC_AlarmStruct);
* ~ m( N; V- _) F - void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);1 ?0 {& u& O( H3 A4 I0 ] Y
- ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState);
# Z% m7 e- }1 i! t$ e# T - void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask);3 F) t5 z1 y1 }* X8 l
- uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm);. _: t0 _* Y( O) M2 C
, e: P* s& }. {# A- {$ d- /* WakeUp Timer configuration functions ***************************************/
t# E) A4 V# z6 U% x - void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock);- F8 {7 w5 [: O' ^
- void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter);
# L* y: N3 x# G4 e# z. o; |0 ?& \9 D - uint32_t RTC_GetWakeUpCounter(void);
, k+ z% C+ S) `# x- n - ErrorStatus RTC_WakeUpCmd(FunctionalState NewState);
3 E$ o+ n: D. x* g5 ?. g
% w3 F. c8 ?+ f4 d+ ?/ R* |/ A- /* Daylight Saving configuration functions ************************************/. r& ], `6 U2 J1 T: N4 C0 R6 j; ]
- void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation);
. @7 [8 T5 B T: Y; m/ b - uint32_t RTC_GetStoreOperation(void);' D7 {* v' ~0 D% U
- & u% B4 m* T6 G6 O3 s C
- /* Output pin Configuration function ******************************************/
4 ]6 N& q$ F1 B, W5 }) }) S* _, Q) ^ - void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity);! p4 A$ ]" [: Q2 c) _
5 c9 J0 ^3 h- z4 |6 E2 v4 M- /* Digital Calibration configuration functions *********************************/
' e2 c2 @7 p, h- \! t8 H( C3 o$ a - ErrorStatus RTC_CoarseCalibConfig(uint32_t RTC_CalibSign, uint32_t Value);6 a8 w+ j. G2 y& D1 A6 ?/ f
- ErrorStatus RTC_CoarseCalibCmd(FunctionalState NewState);
, _0 H# q4 p7 r/ S! F3 c V - void RTC_CalibOutputCmd(FunctionalState NewState);
0 c. }5 W* C- `+ [3 d - void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput);
" [$ m% Q0 B9 ]2 ?$ f - ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod, " T0 h9 F+ K" m# z5 d5 h" M
- uint32_t RTC_SmoothCalibPlusPulses,
. L1 Q" I& d( ` - uint32_t RTC_SmouthCalibMinusPulsesValue);' T1 \. q4 B$ H1 W* L# C
- 1 t" c# C% c% | R% T
- /* TimeStamp configuration functions ******************************************/
, [4 V R; s8 t. o4 D& h1 | - void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState);; f! I5 z0 R3 ~* E; z) J( G% m
- void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_StampTimeStruct,6 a/ h2 N$ \* Y/ Z$ ^: [
- RTC_DateTypeDef* RTC_StampDateStruct);6 x* K6 [; t3 N+ a: d" Q
- uint32_t RTC_GetTimeStampSubSecond(void);
# Z1 W/ h! _5 e, O9 F( {6 w/ I
; b4 Z1 h8 X# _0 d- /* Tampers configuration functions ********************************************/
9 g3 S" y" {! I: {' n - void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger);
* i- o- t$ L- A3 L) N8 ? - void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState);" P8 ^2 z" y5 a( S
- void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter);% J9 F/ y+ u7 \: _
- void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq);# [) K+ A8 }3 R! V
- void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration);9 { t7 u! d8 l/ A
- void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState);& L) a" T1 ~/ p$ O2 p0 C3 `
- void RTC_TamperPullUpCmd(FunctionalState NewState);8 F. O/ B! [( K5 Y0 \) i0 X
- ! u+ q! e+ H- w7 x
- /* Backup Data Registers configuration functions ******************************// T/ @: h. G$ g" ?: X# v- _: l
- void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);2 f6 B: y5 m) o0 {- d i
- uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
( O# U# z1 c0 U- z" `2 R - 9 j1 `! r0 J; p/ h8 I) U
- /* RTC Tamper and TimeStamp Pins Selection and Output Type Config configuration' t. s) }5 P# G
- functions ******************************************************************/0 R6 e' `% `; k' R
- void RTC_TamperPinSelection(uint32_t RTC_TamperPin);
& D* y$ S, S& S( y; p2 w - void RTC_TimeStampPinSelection(uint32_t RTC_TimeStampPin);* W2 n6 I9 m1 [5 N) Q* B( H0 F* N1 N
- void RTC_OutputTypeConfig(uint32_t RTC_OutputType);* x2 b. ?# W2 ?, S
4 h6 A' V& x! @& w4 i- /* RTC_Shift_control_synchonisation_functions *********************************/
3 H- b5 M% g. Q+ p( w - ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS);
( _7 j! o5 ~, D* t" z3 n - / j- B( I. Q% }. a6 s5 Z7 f
- /* Interrupts and flags management functions **********************************/+ A' Z8 w. }% D: g. h9 ~
- void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState);
_5 Y% O4 C( \7 d2 V2 F3 j - FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG);: u/ l; N0 Q/ }0 |6 D( h4 P
- void RTC_ClearFlag(uint32_t RTC_FLAG);: N7 _4 S D# \7 T$ @
- ITStatus RTC_GetITStatus(uint32_t RTC_IT);& v7 a+ ?- w) h4 k' J
- void RTC_ClearITPendingBit(uint32_t RTC_IT);
复制代码 4 M6 E8 v6 a; A! b9 \0 s! e% [. s
04. 结构体封装
: \. O- B* \3 B9 K- /**
2 u4 |' b, [" y4 x - * @brief Real-Time Clock
3 k% m8 J: c3 Z - */7 U1 M2 n; r% f- N2 h7 _
$ F; I& x5 J( v' O- typedef struct7 a* N) u6 y5 f
- {) N z4 F# c7 n
- __IO uint32_t TR; /*!< RTC time register, Address offset: 0x00 */
+ g0 m' b1 X3 b8 k7 M# f- c/ P - __IO uint32_t DR; /*!< RTC date register, Address offset: 0x04 */7 W: @( }- G* ~4 j8 D+ M
- __IO uint32_t CR; /*!< RTC control register, Address offset: 0x08 */+ Y: S0 c0 o/ F/ ~) n2 [
- __IO uint32_t ISR; /*!< RTC initialization and status register, Address offset: 0x0C */
: E9 ?; J# n( ^9 g+ e6 v! @% E5 T& [4 G - __IO uint32_t PRER; /*!< RTC prescaler register, Address offset: 0x10 */
|! u) r% [5 j! \/ U$ z - __IO uint32_t WUTR; /*!< RTC wakeup timer register, Address offset: 0x14 */9 ^) j% x$ [7 }
- __IO uint32_t CALIBR; /*!< RTC calibration register, Address offset: 0x18 */
. i. j' {3 U) |# w4 m. z& ~! E - __IO uint32_t ALRMAR; /*!< RTC alarm A register, Address offset: 0x1C */
! ?3 d2 w! Z* N, q+ o, r1 M; G - __IO uint32_t ALRMBR; /*!< RTC alarm B register, Address offset: 0x20 */, y' \! E* ?3 n h1 l9 \
- __IO uint32_t WPR; /*!< RTC write protection register, Address offset: 0x24 */
+ ?# y$ R( A+ r. a6 @ - __IO uint32_t SSR; /*!< RTC sub second register, Address offset: 0x28 */
1 q/ d. g- S' v. ]' n - __IO uint32_t SHIFTR; /*!< RTC shift control register, Address offset: 0x2C */
, \9 }% `0 M: L' G$ X! e( _8 J - __IO uint32_t TSTR; /*!< RTC time stamp time register, Address offset: 0x30 */; f( q7 d' [/ [8 q# M8 ^' X2 z6 t! ^
- __IO uint32_t TSDR; /*!< RTC time stamp date register, Address offset: 0x34 */7 X4 i9 A: n9 R- w
- __IO uint32_t TSSSR; /*!< RTC time-stamp sub second register, Address offset: 0x38 */- E4 m) b# P# }+ m/ E+ u
- __IO uint32_t CALR; /*!< RTC calibration register, Address offset: 0x3C */ J3 v+ ~" R1 z2 h, @- N# s2 L
- __IO uint32_t TAFCR; /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */
* S$ z' H7 G3 w - __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register, Address offset: 0x44 */* B: K) Z) ]5 V: E4 r
- __IO uint32_t ALRMBSSR;/*!< RTC alarm B sub second register, Address offset: 0x48 */
" v1 B" t# D( s9 s9 X: T - uint32_t RESERVED7; /*!< Reserved, 0x4C */
6 O4 H; N8 e6 o. G# |: I# J1 @ - __IO uint32_t BKP0R; /*!< RTC backup register 1, Address offset: 0x50 */) k: I. F( M. R/ h, w- ~) g: O b/ H
- __IO uint32_t BKP1R; /*!< RTC backup register 1, Address offset: 0x54 *// V- L8 Z; H; S2 u; O7 `- X
- __IO uint32_t BKP2R; /*!< RTC backup register 2, Address offset: 0x58 */
7 ?5 ^7 ~5 m5 D$ [ - __IO uint32_t BKP3R; /*!< RTC backup register 3, Address offset: 0x5C */
/ u: Q: M* q/ w" n1 y B7 q3 v - __IO uint32_t BKP4R; /*!< RTC backup register 4, Address offset: 0x60 */
( n; h2 _# c/ U4 e - __IO uint32_t BKP5R; /*!< RTC backup register 5, Address offset: 0x64 */) ?8 k& H7 k* l o5 U4 H
- __IO uint32_t BKP6R; /*!< RTC backup register 6, Address offset: 0x68 */8 v6 z% Z- G7 B ?, L
- __IO uint32_t BKP7R; /*!< RTC backup register 7, Address offset: 0x6C */4 \. e7 J2 Z0 m& o ~
- __IO uint32_t BKP8R; /*!< RTC backup register 8, Address offset: 0x70 */- J. O3 b3 E- p7 i0 G) C2 W
- __IO uint32_t BKP9R; /*!< RTC backup register 9, Address offset: 0x74 */
9 Z" U# I7 {# i; r - __IO uint32_t BKP10R; /*!< RTC backup register 10, Address offset: 0x78 */
; p& l3 c8 y" g- r! ^; N4 Y6 I: ] - __IO uint32_t BKP11R; /*!< RTC backup register 11, Address offset: 0x7C */2 a/ S# e, R$ U% _9 W8 e _
- __IO uint32_t BKP12R; /*!< RTC backup register 12, Address offset: 0x80 */
& s# u( r+ z8 X* ? J) g/ M - __IO uint32_t BKP13R; /*!< RTC backup register 13, Address offset: 0x84 */, R% w. D E* `1 ?, j5 d$ t% u7 _
- __IO uint32_t BKP14R; /*!< RTC backup register 14, Address offset: 0x88 */
1 C: B \. F/ ?1 A/ d% l; M2 u+ {0 ^ - __IO uint32_t BKP15R; /*!< RTC backup register 15, Address offset: 0x8C */1 Q R k9 s# F r( Y8 l
- __IO uint32_t BKP16R; /*!< RTC backup register 16, Address offset: 0x90 */
2 D0 n3 C+ L7 b [9 e& v: b - __IO uint32_t BKP17R; /*!< RTC backup register 17, Address offset: 0x94 */9 a3 d8 @2 C/ L0 u/ l
- __IO uint32_t BKP18R; /*!< RTC backup register 18, Address offset: 0x98 */
( L6 \, j1 K/ S2 L* n9 w - __IO uint32_t BKP19R; /*!< RTC backup register 19, Address offset: 0x9C */) g+ V3 }# X8 p: w- W
- } RTC_TypeDef;
/ A5 G# ~1 ]$ w' \0 a* A6 X
复制代码
5 W$ G7 t; s* b a* H
% I8 C2 i3 ^" a5 c5 e7 J* E' _8 J |