01. WWDG概述
4 l! M6 I. L3 \1 D+ j/ L" z' jstm32f4xx_wwdg.h和 stm32f4xx_wwdg.c文件中。4 w( p2 H4 G) g% ^; G5 _
4 K/ P& E2 b: V/ ^% h( g! p/ |/ K
02. 相关类型& _! b9 ^( ]0 v
WWDG_Prescaler2 P# I* c* d# K$ I& h2 o% q+ t, [) ~
; [' V$ q$ L2 t; q- H" j: F! B- /** @defgroup WWDG_Prescaler
7 @) G% J1 t2 f# i6 h, Z - * @{& v9 a; B9 x) ~: ^8 |. ^
- */
7 m2 v b: A! e6 {) X/ I# X - " Z4 n) d8 o: D& I) c
- #define WWDG_Prescaler_1 ((uint32_t)0x00000000). @$ r4 c: @% x: T' n3 e
- #define WWDG_Prescaler_2 ((uint32_t)0x00000080)
0 z6 G1 i8 G$ Y - #define WWDG_Prescaler_4 ((uint32_t)0x00000100)1 u- y' S7 ?4 p% j u: R6 s
- #define WWDG_Prescaler_8 ((uint32_t)0x00000180)+ w2 t; A6 E. K
- #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \
" l# c3 S6 T' G T2 Q - ((PRESCALER) == WWDG_Prescaler_2) || \
- N9 Q- ?1 u" |4 c- H* b( n - ((PRESCALER) == WWDG_Prescaler_4) || \
: p& `! i! t1 u8 t3 W, K - ((PRESCALER) == WWDG_Prescaler_8))( l% b/ X m$ V6 c
- #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)* L J2 a; |; q) G" @/ N7 P
- #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
复制代码 2 N, ]9 j* l7 e
中断处理函数- WWDG_IRQn = 0, /*!< Window WatchDog Interrupt*/
复制代码
7 J9 S9 G6 d0 q1 |& x2 E$ G03. 相关函数# s/ u( W S, t T' }4 w
- /* Function used to set the WWDG configuration to the default reset state ****/ 5 ~1 Y7 \4 ?: u0 |4 H: r
- void WWDG_DeInit(void);! N* E5 {- J: L! `- v3 U
- . d7 A; @. _1 k0 l
- /* Prescaler, Refresh window and Counter configuration functions **************/
1 @) l. v% a Q7 F8 c) p$ T6 N- b8 \ - void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);' x# n% b5 f {+ Q8 W
- void WWDG_SetWindowValue(uint8_t WindowValue);
. U9 w/ f1 b, Y1 C$ M$ y; n$ X - void WWDG_EnableIT(void);1 D$ Z! X; Z j& H; O
- void WWDG_SetCounter(uint8_t Counter);
! s3 _% D' w1 O& O6 {3 y5 J, w: b4 j
9 v! X. H2 ~# ~2 R0 {4 N& d/ f- /* WWDG activation function ***************************************************/7 ^4 g' K+ M6 r# B- L: U: r
- void WWDG_Enable(uint8_t Counter);
8 m+ c) \+ ]4 P/ D5 d( o1 }, Q% S
3 h; V6 r$ P0 w$ w; ~2 ^6 P! l3 r- /* Interrupts and flags management functions **********************************/
2 U2 `8 U% c; B( C2 y! f& D - FlagStatus WWDG_GetFlagStatus(void);7 ?5 c$ f/ O5 F# D
- void WWDG_ClearFlag(void);
复制代码
. }3 D) R9 c6 y0 U+ g2 y04. 结构体封装
: r9 Z$ x* D. m; N" H- /** 4 a7 H7 e }" z1 o- T5 T; W% o$ M, Q
- * @brief Window WATCHDOG
8 Y) P; N% B5 Q k( S5 t - */
. }( J3 X3 p+ N+ i! E# S: x
( _* ^1 c5 g9 t6 G7 v- typedef struct
q' _8 f/ X$ I6 Q! Q - {. F; K" b& q. r3 `$ L' z& B) x
- __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
: @. t& b$ g! J0 D - __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */6 U* U; Z: S% U7 ^4 k$ t
- __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
$ c% I& X c. _- G5 t- ? - } WWDG_TypeDef;
复制代码 4 G9 p+ o5 Y, c! i4 a
/ V, \* T3 O: W# @( u8 T9 l' A
7 ~3 G, i& U1 R* O; |8 ~6 \# f
|