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