01. WWDG概述
3 ]% k! q6 y N2 W$ e+ |3 [- ^! Astm32f4xx_wwdg.h和 stm32f4xx_wwdg.c文件中。
?* Z* A3 _" d7 }4 I0 K# v! }2 e! }. Z+ E5 a; x; ?
02. 相关类型- u% V; `5 {( r3 `! Q4 J4 r2 B
WWDG_Prescaler( { z* y5 f! g8 U# T
' x) }# S; n. c6 m; k7 Z; f+ n e! D1 t; _- /** @defgroup WWDG_Prescaler
) z( @( z6 p: c- W# p - * @{
! [- }: E2 p2 Z8 { - */3 r% X: B( @; U/ l i- s5 {1 T R
- C) c b8 Q2 |* g4 K& C& V
- #define WWDG_Prescaler_1 ((uint32_t)0x00000000). M- J. l( Q% W: k4 c
- #define WWDG_Prescaler_2 ((uint32_t)0x00000080), V: o$ y. {- g! B
- #define WWDG_Prescaler_4 ((uint32_t)0x00000100)
) l" |( s# T; u5 ^. h - #define WWDG_Prescaler_8 ((uint32_t)0x00000180)
1 R, u. d8 V: R9 P4 Y y0 E - #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \; L% s( W7 ]+ X9 l8 K
- ((PRESCALER) == WWDG_Prescaler_2) || \
- k& ?! K& d) o8 z) ? - ((PRESCALER) == WWDG_Prescaler_4) || \( q- `4 ^ M% P$ p" p' v
- ((PRESCALER) == WWDG_Prescaler_8))
5 o; C' v3 H7 f& v8 T/ f - #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)
4 A$ r/ ]+ h6 e1 i* P4 n - #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
复制代码
3 ~; [% `3 ~. F4 ], e$ u# z* ~8 [中断处理函数7 n v* L8 Q) W K
3 h% p8 E( \, B" G* I) W; @
- WWDG_IRQn = 0, /*!< Window WatchDog Interrupt*/
复制代码 $ q7 _, I3 k c$ q# ^) X& @& K
03. 相关函数
; u, b& y; D& j( j0 s7 O5 J0 k. B- /* Function used to set the WWDG configuration to the default reset state ****/ ( V0 S6 L' v( N) d2 E' g1 e
- void WWDG_DeInit(void);' g" v; c) U- {; n- P% s, w4 A
- & C, u0 p H& {5 T6 Z
- /* Prescaler, Refresh window and Counter configuration functions **************/, m' P9 y: l) I% C% t
- void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
0 O! M) D& x3 S* z- H( i( n: Y - void WWDG_SetWindowValue(uint8_t WindowValue);
+ Q# x. w7 w; D8 n) F! x' z4 s2 Z- ` - void WWDG_EnableIT(void);: f. |1 V6 N: D, C" z
- void WWDG_SetCounter(uint8_t Counter);) u, Y% s7 p( F7 T T6 b
- x8 x% h' D( @- /* WWDG activation function ***************************************************/) h3 g+ N1 O& Z8 Y
- void WWDG_Enable(uint8_t Counter);
4 ~: p/ ]$ u& P% r0 _& ]3 ]- t3 Z - ' o) c8 t1 ?% K1 ^/ h4 M! ^
- /* Interrupts and flags management functions **********************************/
/ q2 u: `/ d1 [! O; y) y - FlagStatus WWDG_GetFlagStatus(void);4 H7 t {/ c: N# n- C' b
- void WWDG_ClearFlag(void);
复制代码
7 C# z- W: t1 I+ o# L9 s- \% S04. 结构体封装* T# V+ @$ p2 w3 x
- /**
* k- o9 O! S, M# n% j - * @brief Window WATCHDOG3 N+ G! M+ K3 m6 Y: `. Z
- */
: |6 U* u! \7 r F& b
7 x: a8 s' W5 Z" Z8 l1 C- typedef struct
+ M$ K( @9 M; b( `$ u# W - {1 Q9 g4 P9 z7 N- N3 y
- __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
) p& l e2 y, x! h# H - __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */# v# C1 B3 ^: A3 k
- __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */( Y" l0 o- S! Y
- } WWDG_TypeDef;
复制代码
3 \% \. u+ Z) u8 M& \% H
2 b5 F+ c7 n7 a2 ^! T0 | z2 N# i3 Y) U }
|