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