01. WWDG概述
- f- ?, N* i8 k; e" H7 w' G" O. ^stm32f4xx_wwdg.h和 stm32f4xx_wwdg.c文件中。
1 L3 K3 I% n9 m0 {2 p4 c8 {/ ] y' x' k$ M( U
02. 相关类型
: }0 f( z0 }7 a7 V' F) |WWDG_Prescaler
% p) h! f, z0 z$ ~. c" a2 f! N' ?* L7 ^* b
- /** @defgroup WWDG_Prescaler 6 T& r! y2 Z2 B1 b! _
- * @{ m/ N4 K5 D. O& `
- */
+ w+ \ h% t# q' ^9 `( v1 v - 1 s# N1 P0 _9 W% N+ R
- #define WWDG_Prescaler_1 ((uint32_t)0x00000000)3 p9 m% o# E d& u( y
- #define WWDG_Prescaler_2 ((uint32_t)0x00000080): X0 }8 b L6 t: M$ [# E
- #define WWDG_Prescaler_4 ((uint32_t)0x00000100)
0 t% }' a5 ^# b; J - #define WWDG_Prescaler_8 ((uint32_t)0x00000180)" ^/ a& Z- K9 z/ c g- O
- #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \
1 X+ R& c5 ?. {6 A/ G/ Z1 g8 B - ((PRESCALER) == WWDG_Prescaler_2) || \4 G3 i8 S- C" n. H! T( Z
- ((PRESCALER) == WWDG_Prescaler_4) || \
: P/ t$ U' _0 z$ s8 D" d; c+ M+ o - ((PRESCALER) == WWDG_Prescaler_8))
7 w( a; J( l @, J8 E5 P, x - #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)
F( | J5 M# l) T - #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
复制代码 i8 g; q, F+ F" B. s: j
中断处理函数
/ o- M I: T( Q" X$ d, J1 m& q; f( U7 d" R
- WWDG_IRQn = 0, /*!< Window WatchDog Interrupt*/
复制代码 4 p7 P: w7 o( }. @
03. 相关函数9 P' K/ ?, O7 K# _' m3 O
- /* Function used to set the WWDG configuration to the default reset state ****/ / q, s c. ?0 Q8 i
- void WWDG_DeInit(void);& N; D+ y$ O* u
- $ r& c, X' }7 A! N
- /* Prescaler, Refresh window and Counter configuration functions **************/5 s1 R8 @2 P3 z6 j/ M
- void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
; c1 g, K, }0 n6 T: | - void WWDG_SetWindowValue(uint8_t WindowValue);
6 X+ C! i: o/ ?; W# z6 p - void WWDG_EnableIT(void);
4 [' r" c% }2 N( N6 _ Y/ I' h - void WWDG_SetCounter(uint8_t Counter);: J$ Y, q( f7 D% ~6 E% H/ w: p: B
- 5 A5 b; K' i3 u8 Y ?
- /* WWDG activation function ***************************************************/5 r$ }9 n1 ?( j" Z* l# ]) H
- void WWDG_Enable(uint8_t Counter);
- _/ @. W) F# H. e' a
5 M, T. N* W" |5 j; I o- /* Interrupts and flags management functions **********************************/2 u8 ?$ b# _4 w" m- J5 K
- FlagStatus WWDG_GetFlagStatus(void);# j- D& Y3 F n) L6 }6 Q
- void WWDG_ClearFlag(void);
复制代码 ; z/ T Z7 A% t8 Z* O% x
04. 结构体封装1 d+ a9 F s6 t) w" v5 W9 r. j
- /**
) x# h {& F7 j; B$ e - * @brief Window WATCHDOG
3 H" q# f. Y) D - */
s8 V6 O4 _- l9 k
9 n5 q: z. [' {, s% t4 Q- typedef struct
5 D8 S5 c+ C+ I' ~) ^9 Y - {( Y& o% ]. w1 ~5 G% J8 c6 {
- __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
( J' S) m$ e1 h& d - __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */) }* C4 h5 G6 I. T& e9 k! K- B
- __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
, T% F. x4 }1 I+ E0 T - } WWDG_TypeDef;
复制代码 * Q& j+ H1 K6 x `
" s6 n9 `9 [7 T1 ~' {; c" G5 Z" ]
|