01. WWDG概述
7 i; b# P+ N2 @8 O; ~4 Qstm32f4xx_wwdg.h和 stm32f4xx_wwdg.c文件中。6 Z9 r' g. Y& T1 ]' p
! u$ p' O( B9 a- P) r4 b3 `: E$ b3 Y02. 相关类型9 l1 J" h( J2 Q5 ^7 M" J! l2 `
WWDG_Prescaler3 l& i) x d8 }# f' g5 ]6 x
. Q( j5 V2 b& D/ v# ^8 [- /** @defgroup WWDG_Prescaler 6 {- `1 Z2 R: O8 e J1 I
- * @{' y2 I0 A+ q( F1 Q0 v% I7 x# I
- */7 w# r: ^! k \5 A ?& r0 L3 h
- , D& g- x+ ^, o6 P
- #define WWDG_Prescaler_1 ((uint32_t)0x00000000)
& U% W* c3 n+ b8 `1 ^ - #define WWDG_Prescaler_2 ((uint32_t)0x00000080)) H( h, I3 S3 h
- #define WWDG_Prescaler_4 ((uint32_t)0x00000100)/ O. X" E" [/ r S
- #define WWDG_Prescaler_8 ((uint32_t)0x00000180); ?! J* i( k: ~
- #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \1 l8 V& c p) B: A9 `/ y
- ((PRESCALER) == WWDG_Prescaler_2) || \
- a2 Y0 t; v& g4 G" ^% f1 _ - ((PRESCALER) == WWDG_Prescaler_4) || \2 g' b$ {( v( v) F+ r) F! [
- ((PRESCALER) == WWDG_Prescaler_8))9 B+ J9 q" X# v' f2 p
- #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)7 { V- b3 b# l: W8 ^ R5 z
- #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
复制代码
( Y' k% \- O( @$ e0 D2 d/ p5 a; d中断处理函数0 K+ d% O( Q, \0 f( V( n, J
! h& N9 d( c9 c$ w7 ^' I9 y
- WWDG_IRQn = 0, /*!< Window WatchDog Interrupt*/
复制代码 + ^, a& b& k+ s. h
03. 相关函数% @2 p/ o8 ]9 R& K0 N5 O/ e
- /* Function used to set the WWDG configuration to the default reset state ****/
6 d3 E/ s: `1 G' u$ @# [' a - void WWDG_DeInit(void); E! B2 ?( p% g1 x
k5 w5 E0 K# ?! R- {- /* Prescaler, Refresh window and Counter configuration functions **************/
9 c* y: x9 l" ]/ M4 M - void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
% P' z& i; m3 _& q - void WWDG_SetWindowValue(uint8_t WindowValue); k, q+ b" f4 j- e
- void WWDG_EnableIT(void);
" w+ A4 B4 N" s4 `4 R- z/ V - void WWDG_SetCounter(uint8_t Counter);
, d h/ D. G+ x% V1 g! [
* V+ @) F$ g Y I# n% S- /* WWDG activation function ***************************************************/3 r8 i, k9 `' T& v1 B- y
- void WWDG_Enable(uint8_t Counter);% }6 i8 ]- E [) D; \* _6 X
- 4 d% z" u: z, p1 ~) s! t
- /* Interrupts and flags management functions **********************************/
$ L; B+ j* H% j$ M - FlagStatus WWDG_GetFlagStatus(void);9 O/ w7 U4 {* _( R- p1 B
- void WWDG_ClearFlag(void);
复制代码 " W. T3 U s1 s. u% [) ?1 E
04. 结构体封装
; J C& C8 D" i7 [; ?) _1 g! l) D- /**
9 f2 z) r9 L z$ t! @7 l7 p: y" ~ - * @brief Window WATCHDOG x; |# D% ^4 t& \& O
- */+ x! i5 W: \8 K# C6 u& r( G6 y
( j. {) ^: }) ]* h2 u" s4 Z, k- typedef struct" p4 L2 |: A3 O @! [
- {
! D& H4 i% m1 k - __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
0 I; y% x0 d) o - __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */
* ]( A( M3 G2 V' o. [% _ - __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
0 ]# J/ a& P( z) ? - } WWDG_TypeDef;
复制代码
! e$ T8 l2 k# s+ s0 e. U4 { [* u" D2 w9 }* A0 O3 `
|