1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_iwdg.h
4   * @author  MCD Application Team
5   * @version V1.5.1
6   * @date    22-May-2015
7   * @brief   This file contains all the functions prototypes for the IWDG
8   *          firmware library.
9   ******************************************************************************
10   * @attention
11   *
12   * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
13   *
14   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15   * You may not use this file except in compliance with the License.
16   * You may obtain a copy of the License at:
17   *
18   *        http://www.st.com/software_license_agreement_liberty_v2
19   *
20   * Unless required by applicable law or agreed to in writing, software
21   * distributed under the License is distributed on an "AS IS" BASIS,
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23   * See the License for the specific language governing permissions and
24   * limitations under the License.
25   *
26   ******************************************************************************
27   */
28 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4xx_IWDG_H
31 #define __STM32F4xx_IWDG_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
39 
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41   * @{
42   */
43 
44 /** @addtogroup IWDG
45   * @{
46   */
47 
48 /* Exported types ------------------------------------------------------------*/
49 /* Exported constants --------------------------------------------------------*/
50 
51 /** @defgroup IWDG_Exported_Constants
52   * @{
53   */
54 
55 /** @defgroup IWDG_WriteAccess
56   * @{
57   */
58 #define IWDG_WriteAccess_Enable     ((uint16_t)0x5555)
59 #define IWDG_WriteAccess_Disable    ((uint16_t)0x0000)
60 #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
61                                       ((ACCESS) == IWDG_WriteAccess_Disable))
62 /**
63   * @}
64   */
65 
66 /** @defgroup IWDG_prescaler
67   * @{
68   */
69 #define IWDG_Prescaler_4            ((uint8_t)0x00)
70 #define IWDG_Prescaler_8            ((uint8_t)0x01)
71 #define IWDG_Prescaler_16           ((uint8_t)0x02)
72 #define IWDG_Prescaler_32           ((uint8_t)0x03)
73 #define IWDG_Prescaler_64           ((uint8_t)0x04)
74 #define IWDG_Prescaler_128          ((uint8_t)0x05)
75 #define IWDG_Prescaler_256          ((uint8_t)0x06)
76 #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4)  || \
77                                       ((PRESCALER) == IWDG_Prescaler_8)  || \
78                                       ((PRESCALER) == IWDG_Prescaler_16) || \
79                                       ((PRESCALER) == IWDG_Prescaler_32) || \
80                                       ((PRESCALER) == IWDG_Prescaler_64) || \
81                                       ((PRESCALER) == IWDG_Prescaler_128)|| \
82                                       ((PRESCALER) == IWDG_Prescaler_256))
83 /**
84   * @}
85   */
86 
87 /** @defgroup IWDG_Flag
88   * @{
89   */
90 #define IWDG_FLAG_PVU               ((uint16_t)0x0001)
91 #define IWDG_FLAG_RVU               ((uint16_t)0x0002)
92 #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU))
93 #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
94 /**
95   * @}
96   */
97 
98 /**
99   * @}
100   */
101 
102 /* Exported macro ------------------------------------------------------------*/
103 /* Exported functions --------------------------------------------------------*/
104 
105 /* Prescaler and Counter configuration functions ******************************/
106 void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
107 void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
108 void IWDG_SetReload(uint16_t Reload);
109 void IWDG_ReloadCounter(void);
110 
111 /* IWDG activation function ***************************************************/
112 void IWDG_Enable(void);
113 
114 /* Flag management function ***************************************************/
115 FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* __STM32F4xx_IWDG_H */
122 
123 /**
124   * @}
125   */
126 
127 /**
128   * @}
129   */
130 
131 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
132