MG32F10x Standard Peripherals Firmware Library

mg32f10x_iwdg.h
浏览该文件的文档.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32F10x_IWDG_H
12 #define __MG32F10x_IWDG_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f10x.h"
20
29 /* Exported types ------------------------------------------------------------*/
30 /* Exported constants --------------------------------------------------------*/
31
40 #define IWDG_WriteAccess_Enable ((uint16_t)0x5555)
41 #define IWDG_WriteAccess_Disable ((uint16_t)0x0000)
42 #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
43 ((ACCESS) == IWDG_WriteAccess_Disable))
44
52 #define IWDG_Prescaler_4 ((uint8_t)0x00)
53 #define IWDG_Prescaler_8 ((uint8_t)0x01)
54 #define IWDG_Prescaler_16 ((uint8_t)0x02)
55 #define IWDG_Prescaler_32 ((uint8_t)0x03)
56 #define IWDG_Prescaler_64 ((uint8_t)0x04)
57 #define IWDG_Prescaler_128 ((uint8_t)0x05)
58 #define IWDG_Prescaler_256 ((uint8_t)0x06)
59 #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \
60 ((PRESCALER) == IWDG_Prescaler_8) || \
61 ((PRESCALER) == IWDG_Prescaler_16) || \
62 ((PRESCALER) == IWDG_Prescaler_32) || \
63 ((PRESCALER) == IWDG_Prescaler_64) || \
64 ((PRESCALER) == IWDG_Prescaler_128)|| \
65 ((PRESCALER) == IWDG_Prescaler_256))
66
74 #define IWDG_FLAG_PVU ((uint16_t)0x0001)
75 #define IWDG_FLAG_RVU ((uint16_t)0x0002)
76 #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU))
77 #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
78
86 /* Exported macro ------------------------------------------------------------*/
87 /* Exported functions --------------------------------------------------------*/
88
89 void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
90 void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
91 void IWDG_SetReload(uint16_t Reload);
92 void IWDG_ReloadCounter(void);
93 void IWDG_Enable(void);
94 FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
95
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif /* __MG32F10x_IWDG_H */
IWDG_SetPrescaler
void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
Sets IWDG Prescaler value.
Definition: mg32f10x_iwdg.c:75
IWDG_Enable
void IWDG_Enable(void)
Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled).
Definition: mg32f10x_iwdg.c:111
IWDG_SetReload
void IWDG_SetReload(uint16_t Reload)
Sets IWDG Reload value.
Definition: mg32f10x_iwdg.c:88
IWDG_WriteAccessCmd
void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess)
Enables or disables write access to IWDG_PR and IWDG_RLR registers.
Definition: mg32f10x_iwdg.c:55
IWDG_ReloadCounter
void IWDG_ReloadCounter(void)
Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR ...
Definition: mg32f10x_iwdg.c:101
IWDG_GetFlagStatus
FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG)
Checks whether the specified IWDG flag is set or not.
Definition: mg32f10x_iwdg.c:124