01. WWDG概述* U" z- W8 s3 _+ X2 @
stm32f4xx_wwdg.h和 stm32f4xx_wwdg.c文件中。
( _! t V! [5 r/ |3 Z: B/ M# W
5 x8 N s$ h4 r. t' m( {02. 相关类型
' H0 R- a; q) m# b5 t4 }WWDG_Prescaler
4 a4 v4 Q; ^ o* L. l+ D3 j
2 w6 ], E: A) P u4 }6 j0 K- /** @defgroup WWDG_Prescaler ; W! l- H$ L0 |& U- s3 ~1 p
- * @{) U+ K" p z! [0 e
- */7 W+ z! K4 W& `( o# U% _2 `
- + f+ w0 o$ V; f2 J/ t, M8 y2 l
- #define WWDG_Prescaler_1 ((uint32_t)0x00000000)% v8 j& A. q: B }. k4 Z
- #define WWDG_Prescaler_2 ((uint32_t)0x00000080)5 g: Y6 W8 d: G5 G5 X) Y
- #define WWDG_Prescaler_4 ((uint32_t)0x00000100)# G4 N) [) q, B) a4 S
- #define WWDG_Prescaler_8 ((uint32_t)0x00000180)8 F, H3 y/ x7 G7 f$ n
- #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \: R7 q1 v2 {, Q5 _( F, v5 Z
- ((PRESCALER) == WWDG_Prescaler_2) || \
* z! d; V B; E& Z- G) X! Y& { - ((PRESCALER) == WWDG_Prescaler_4) || \
* p7 T5 Y) B" } - ((PRESCALER) == WWDG_Prescaler_8))
6 w( ?' L2 G, M2 a) ` - #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)' \( b0 r' n# S- C2 p
- #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
复制代码
: p! }. b+ Y' m6 g7 P9 I中断处理函数1 O R/ M4 k. s% S: ^/ V
: Y' u* b+ d+ I% c0 d' L- WWDG_IRQn = 0, /*!< Window WatchDog Interrupt*/
复制代码 9 {6 l; {6 h' g$ b! E2 F2 }! F! ?
03. 相关函数4 Q; {; j- A* X2 F9 p! a5 F
- /* Function used to set the WWDG configuration to the default reset state ****/
2 W' v# w2 M! Y3 x1 b4 q - void WWDG_DeInit(void);6 n8 y; [$ e/ n% P7 {4 i! F
- , t8 B; x G7 R) d* F
- /* Prescaler, Refresh window and Counter configuration functions **************/
# g3 p; B% G, N) {4 ^8 ]8 X% ? - void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
' h' l a6 k' }$ V - void WWDG_SetWindowValue(uint8_t WindowValue);
1 C; L# C1 W1 M! ~. M. \1 c - void WWDG_EnableIT(void);
- Q1 j9 Q5 |; X - void WWDG_SetCounter(uint8_t Counter);4 [4 ]$ T6 u& B, o4 }; ]$ G
! J9 i# O0 k4 E+ Q/ U, ]# k+ @- /* WWDG activation function ***************************************************/
6 {( S1 X' Y! N4 l; _ - void WWDG_Enable(uint8_t Counter);
1 P; k1 @! D; Z! E' D
2 ~. m: t( i$ W! e6 s- /* Interrupts and flags management functions **********************************/
0 }+ h2 h9 P, C5 ^ - FlagStatus WWDG_GetFlagStatus(void);
; V+ Q4 K, E/ ?* D( B. l$ a% } - void WWDG_ClearFlag(void);
复制代码
% \6 n o: H) X8 M04. 结构体封装5 ? W' j. F( J( Z A" D; D
- /**
( t: y5 q; I3 _2 G: W& h, B - * @brief Window WATCHDOG
$ y$ f& e v7 J0 d - */7 R1 `+ f9 x4 o% Y
- 3 ^$ M" \8 H! I4 [# G# x
- typedef struct
1 B) _' {6 U9 Y( L - {, G0 H. L, u( ^! x) \3 x0 o
- __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */; m/ t4 h7 W; x! r
- __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */1 j) K! O m8 [! m- T: Q
- __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */) l, @" r9 d5 F6 h/ Z* j3 n
- } WWDG_TypeDef;
复制代码
" k* I& o& M3 b- t# n. f/ U( x4 h; A% F
|