01. WWDG概述
8 @) S: K; P( {! ostm32f4xx_wwdg.h和 stm32f4xx_wwdg.c文件中。' k% L: T, z; x8 {2 _
& U2 T1 d: g, A4 s+ H; C! `02. 相关类型 Z1 B# w/ K, b6 F# K
WWDG_Prescaler7 ?' [2 \ U7 e; d! [
- H( |5 p3 s0 u# r, g0 z- /** @defgroup WWDG_Prescaler 9 p" |% u3 _ s9 E5 I% Q6 g
- * @{( T6 q( d9 s/ X
- */
* t6 K3 R7 B# R- m$ x- c - 1 E+ H: K7 d( t
- #define WWDG_Prescaler_1 ((uint32_t)0x00000000)
! b$ P0 M. Y; e' d2 k2 q - #define WWDG_Prescaler_2 ((uint32_t)0x00000080)9 r" w5 V4 c; P# z# U
- #define WWDG_Prescaler_4 ((uint32_t)0x00000100)4 ~- N; j! P& M9 T3 S+ T; W
- #define WWDG_Prescaler_8 ((uint32_t)0x00000180)
8 f/ I0 i$ b8 u" U/ R1 O+ G5 X, N/ p - #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \
+ y( [) K2 l/ b( i* W& _) Y0 [: { - ((PRESCALER) == WWDG_Prescaler_2) || \
3 U/ W' K6 k% W, D$ d8 i - ((PRESCALER) == WWDG_Prescaler_4) || \
) H; I9 J& v0 k9 M4 N - ((PRESCALER) == WWDG_Prescaler_8))! M) U. D7 |; @4 H
- #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)9 H. s, }4 s; l& D3 P+ j
- #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
复制代码 9 ?1 a9 E1 }3 x& ^( U$ v
中断处理函数
! u4 N% i M6 H+ V- I3 P
" l L6 m5 p S- e4 y% k! f, r- WWDG_IRQn = 0, /*!< Window WatchDog Interrupt*/
复制代码
0 @2 z! q9 e4 }- ^' M# q; c5 T7 K; B03. 相关函数
3 V5 v+ T. Z. n/ U+ U* w, M* }- /* Function used to set the WWDG configuration to the default reset state ****/
* L/ H3 [# s# K+ k, d( C& f) H% r - void WWDG_DeInit(void);5 o! w% R8 s$ v3 Y) p5 j
6 `9 D0 s3 X [3 w1 Z# T- /* Prescaler, Refresh window and Counter configuration functions **************/
2 ^5 v" I+ r" Y/ [ - void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
/ F" p9 ]2 T8 j+ @$ {# R% |) I - void WWDG_SetWindowValue(uint8_t WindowValue);
! _8 R. q0 C& _, w - void WWDG_EnableIT(void);; \* J6 [4 C; j
- void WWDG_SetCounter(uint8_t Counter);
7 A$ H' O! O, Q! U
( T9 p8 O( \5 n0 Q* ]/ G- /* WWDG activation function ***************************************************/3 y6 o3 i. U' A' ^6 S3 v e7 y
- void WWDG_Enable(uint8_t Counter);
* ^/ Z6 j* T. O3 }3 k2 G
% i; `- i2 O9 d5 K1 O2 |# b$ Z- /* Interrupts and flags management functions **********************************/& e5 w4 d& ?3 y5 v+ t, d
- FlagStatus WWDG_GetFlagStatus(void);: T- Y" t8 ~+ f9 H
- void WWDG_ClearFlag(void);
复制代码
7 A; y& D7 {) c& A) T6 P04. 结构体封装) p3 P# m8 H# a9 u4 @8 F! T/ K4 S
- /**
2 o" v! t- p8 v5 p) L, {/ b. e - * @brief Window WATCHDOG& x5 R& \3 H: P2 Q0 w @5 f
- */
3 M$ G3 _9 o* a$ [
n& U0 {8 F/ {. h: @- @' {- typedef struct
1 Y, ~* }7 a" e" ^/ Y2 J - {
3 K3 M: a$ ]. ?* c$ U: L - __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
! \2 i8 J2 S+ p- g3 q& P, p - __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */# r3 U+ _! o7 W/ M, ^
- __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */0 _) M. N( | k6 D3 b+ X) j/ A
- } WWDG_TypeDef;
复制代码 \, R+ G( \+ |3 n6 P, j- {6 Y
/ C, R# Q; `4 K5 u9 F8 T. p, a
|