1 /* Define to prevent recursive inclusion -------------------------------------*/ 2 #ifndef __AIR32F10x_IWDG_H 3 #define __AIR32F10x_IWDG_H 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 /* Includes ------------------------------------------------------------------*/ 10 #include "air32f10x.h" 11 12 /** @addtogroup air32f10x_StdPeriph_Driver 13 * @{ 14 */ 15 16 /** @addtogroup IWDG 17 * @{ 18 */ 19 20 /** @defgroup IWDG_Exported_Types 21 * @{ 22 */ 23 24 /** 25 * @} 26 */ 27 28 /** @defgroup IWDG_Exported_Constants 29 * @{ 30 */ 31 32 /** @defgroup IWDG_WriteAccess 33 * @{ 34 */ 35 36 #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 37 #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 38 #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 39 ((ACCESS) == IWDG_WriteAccess_Disable)) 40 /** 41 * @} 42 */ 43 44 /** @defgroup IWDG_prescaler 45 * @{ 46 */ 47 48 #define IWDG_Prescaler_4 ((uint8_t)0x00) 49 #define IWDG_Prescaler_8 ((uint8_t)0x01) 50 #define IWDG_Prescaler_16 ((uint8_t)0x02) 51 #define IWDG_Prescaler_32 ((uint8_t)0x03) 52 #define IWDG_Prescaler_64 ((uint8_t)0x04) 53 #define IWDG_Prescaler_128 ((uint8_t)0x05) 54 #define IWDG_Prescaler_256 ((uint8_t)0x06) 55 #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 56 ((PRESCALER) == IWDG_Prescaler_8) || \ 57 ((PRESCALER) == IWDG_Prescaler_16) || \ 58 ((PRESCALER) == IWDG_Prescaler_32) || \ 59 ((PRESCALER) == IWDG_Prescaler_64) || \ 60 ((PRESCALER) == IWDG_Prescaler_128)|| \ 61 ((PRESCALER) == IWDG_Prescaler_256)) 62 /** 63 * @} 64 */ 65 66 /** @defgroup IWDG_Flag 67 * @{ 68 */ 69 70 #define IWDG_FLAG_PVU ((uint16_t)0x0001) 71 #define IWDG_FLAG_RVU ((uint16_t)0x0002) 72 #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 73 #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 74 /** 75 * @} 76 */ 77 78 /** 79 * @} 80 */ 81 82 /** @defgroup IWDG_Exported_Macros 83 * @{ 84 */ 85 86 /** 87 * @} 88 */ 89 90 /** @defgroup IWDG_Exported_Functions 91 * @{ 92 */ 93 94 void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 95 void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 96 void IWDG_SetReload(uint16_t Reload); 97 void IWDG_ReloadCounter(void); 98 void IWDG_Enable(void); 99 FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 100 101 #ifdef __cplusplus 102 } 103 #endif 104 105 #endif /* __AIR32F10x_IWDG_H */ 106 /** 107 * @} 108 */ 109 110 /** 111 * @} 112 */ 113 114 /** 115 * @} 116 */ 117 118