Increment eeprom version
[betaflight.git] / lib / main / STM32F1 / Drivers / STM32F1xx_HAL_Driver / Inc / stm32f1xx_hal_wwdg.h
blob3d28b36d6850e15218200210d2ce94578f3bf393
1 /**
2 ******************************************************************************
3 * @file stm32f1xx_hal_wwdg.h
4 * @author MCD Application Team
5 * @version V1.1.1
6 * @date 12-May-2017
7 * @brief Header file of WWDG HAL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ******************************************************************************
36 */
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F1xx_HAL_WWDG_H
40 #define __STM32F1xx_HAL_WWDG_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f1xx_hal_def.h"
49 /** @addtogroup STM32F1xx_HAL_Driver
50 * @{
53 /** @addtogroup WWDG
54 * @{
55 */
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup WWDG_Exported_Types WWDG Exported Types
59 * @{
62 /**
63 * @brief WWDG Init structure definition
65 typedef struct
67 uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG.
68 This parameter can be a value of @ref WWDG_Prescaler */
70 uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter.
71 This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */
73 uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value.
74 This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */
76 uint32_t EWIMode ; /*!< Specifies if WWDG Early Wakeup Interupt is enable or not.
77 This parameter can be a value of @ref WWDG_EWI_Mode */
79 }WWDG_InitTypeDef;
81 /**
82 * @brief WWDG handle Structure definition
84 typedef struct
86 WWDG_TypeDef *Instance; /*!< Register base address */
88 WWDG_InitTypeDef Init; /*!< WWDG required parameters */
90 }WWDG_HandleTypeDef;
91 /**
92 * @}
95 /* Exported constants --------------------------------------------------------*/
97 /** @defgroup WWDG_Exported_Constants WWDG Exported Constants
98 * @{
101 /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition
102 * @{
104 #define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */
106 * @}
109 /** @defgroup WWDG_Flag_definition WWDG Flag definition
110 * @brief WWDG Flag definition
111 * @{
113 #define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */
115 * @}
118 /** @defgroup WWDG_Prescaler WWDG Prescaler
119 * @{
121 #define WWDG_PRESCALER_1 0x00000000U /*!< WWDG counter clock = (PCLK1/4096)/1 */
122 #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB0 /*!< WWDG counter clock = (PCLK1/4096)/2 */
123 #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB1 /*!< WWDG counter clock = (PCLK1/4096)/4 */
124 #define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */
126 * @}
129 /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode
130 * @{
132 #define WWDG_EWI_DISABLE 0x00000000U /*!< EWI Disable */
133 #define WWDG_EWI_ENABLE WWDG_CFR_EWI /*!< EWI Enable */
135 * @}
139 * @}
142 /* Private macros ------------------------------------------------------------*/
144 /** @defgroup WWDG_Private_Macros WWDG Private Macros
145 * @{
147 #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \
148 ((__PRESCALER__) == WWDG_PRESCALER_2) || \
149 ((__PRESCALER__) == WWDG_PRESCALER_4) || \
150 ((__PRESCALER__) == WWDG_PRESCALER_8))
152 #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W))
154 #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T))
156 #define IS_WWDG_EWI_MODE(__MODE__) (((__MODE__) == WWDG_EWI_ENABLE) || \
157 ((__MODE__) == WWDG_EWI_DISABLE))
159 * @}
163 /* Exported macros ------------------------------------------------------------*/
165 /** @defgroup WWDG_Exported_Macros WWDG Exported Macros
166 * @{
170 * @brief Enables the WWDG peripheral.
171 * @param __HANDLE__: WWDG handle
172 * @retval None
174 #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA)
177 * @brief Enables the WWDG early wakeup interrupt.
178 * @param __HANDLE__: WWDG handle
179 * @param __INTERRUPT__ specifies the interrupt to enable.
180 * This parameter can be one of the following values:
181 * @arg WWDG_IT_EWI: Early wakeup interrupt
182 * @note Once enabled this interrupt cannot be disabled except by a system reset.
183 * @retval None
185 #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__))
188 * @brief Checks whether the selected WWDG interrupt has occurred or not.
189 * @param __HANDLE__ WWDG handle
190 * @param __INTERRUPT__ specifies the it to check.
191 * This parameter can be one of the following values:
192 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT
193 * @retval The new state of WWDG_FLAG (SET or RESET).
195 #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__))
197 /** @brief Clear the WWDG's interrupt pending bits
198 * bits to clear the selected interrupt pending bits.
199 * @param __HANDLE__: WWDG handle
200 * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
201 * This parameter can be one of the following values:
202 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
204 #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__))
207 * @brief Check whether the specified WWDG flag is set or not.
208 * @param __HANDLE__ WWDG handle
209 * @param __FLAG__ specifies the flag to check.
210 * This parameter can be one of the following values:
211 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
212 * @retval The new state of WWDG_FLAG (SET or RESET).
214 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
217 * @brief Clears the WWDG's pending flags.
218 * @param __HANDLE__: WWDG handle
219 * @param __FLAG__: specifies the flag to clear.
220 * This parameter can be one of the following values:
221 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
222 * @retval None
224 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
226 /** @brief Checks if the specified WWDG interrupt source is enabled or disabled.
227 * @param __HANDLE__: WWDG Handle.
228 * @param __INTERRUPT__: specifies the WWDG interrupt source to check.
229 * This parameter can be one of the following values:
230 * @arg WWDG_IT_EWI: Early Wakeup Interrupt
231 * @retval state of __INTERRUPT__ (TRUE or FALSE).
233 #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__))
236 * @}
239 /* Exported functions --------------------------------------------------------*/
240 /** @addtogroup WWDG_Exported_Functions
241 * @{
244 /** @addtogroup WWDG_Exported_Functions_Group1
245 * @{
247 /* Initialization/de-initialization functions **********************************/
248 HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg);
249 void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg);
251 * @}
254 /** @addtogroup WWDG_Exported_Functions_Group2
255 * @{
257 /* I/O operation functions ******************************************************/
258 HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg);
259 void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg);
260 void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg);
262 * @}
266 * @}
270 * @}
274 * @}
277 #ifdef __cplusplus
279 #endif
281 #endif /* __STM32F1xx_HAL_WWDG_H */
283 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/