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