The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
emilmont
Date:
Fri Feb 14 14:36:43 2014 +0000
Revision:
77:869cf507173a
Child:
81:7d30d6019079
Release 77 of the mbed library

Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32f4xx_hal_wwdg.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
emilmont 77:869cf507173a 5 * @version V1.0.0RC2
emilmont 77:869cf507173a 6 * @date 04-February-2014
emilmont 77:869cf507173a 7 * @brief Header file of WWDG HAL module.
emilmont 77:869cf507173a 8 ******************************************************************************
emilmont 77:869cf507173a 9 * @attention
emilmont 77:869cf507173a 10 *
emilmont 77:869cf507173a 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 12 *
emilmont 77:869cf507173a 13 * Redistribution and use in source and binary forms, with or without modification,
emilmont 77:869cf507173a 14 * are permitted provided that the following conditions are met:
emilmont 77:869cf507173a 15 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 77:869cf507173a 16 * this list of conditions and the following disclaimer.
emilmont 77:869cf507173a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 77:869cf507173a 18 * this list of conditions and the following disclaimer in the documentation
emilmont 77:869cf507173a 19 * and/or other materials provided with the distribution.
emilmont 77:869cf507173a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
emilmont 77:869cf507173a 21 * may be used to endorse or promote products derived from this software
emilmont 77:869cf507173a 22 * without specific prior written permission.
emilmont 77:869cf507173a 23 *
emilmont 77:869cf507173a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
emilmont 77:869cf507173a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 77:869cf507173a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
emilmont 77:869cf507173a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
emilmont 77:869cf507173a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
emilmont 77:869cf507173a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
emilmont 77:869cf507173a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emilmont 77:869cf507173a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
emilmont 77:869cf507173a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
emilmont 77:869cf507173a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 34 *
emilmont 77:869cf507173a 35 ******************************************************************************
emilmont 77:869cf507173a 36 */
emilmont 77:869cf507173a 37
emilmont 77:869cf507173a 38 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 39 #ifndef __STM32F4xx_HAL_WWDG_H
emilmont 77:869cf507173a 40 #define __STM32F4xx_HAL_WWDG_H
emilmont 77:869cf507173a 41
emilmont 77:869cf507173a 42 #ifdef __cplusplus
emilmont 77:869cf507173a 43 extern "C" {
emilmont 77:869cf507173a 44 #endif
emilmont 77:869cf507173a 45
emilmont 77:869cf507173a 46 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 47 #include "stm32f4xx_hal_def.h"
emilmont 77:869cf507173a 48
emilmont 77:869cf507173a 49 /** @addtogroup STM32F4xx_HAL_Driver
emilmont 77:869cf507173a 50 * @{
emilmont 77:869cf507173a 51 */
emilmont 77:869cf507173a 52
emilmont 77:869cf507173a 53 /** @addtogroup WWDG
emilmont 77:869cf507173a 54 * @{
emilmont 77:869cf507173a 55 */
emilmont 77:869cf507173a 56
emilmont 77:869cf507173a 57 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 58
emilmont 77:869cf507173a 59 /**
emilmont 77:869cf507173a 60 * @brief WWDG HAL State Structure definition
emilmont 77:869cf507173a 61 */
emilmont 77:869cf507173a 62 typedef enum
emilmont 77:869cf507173a 63 {
emilmont 77:869cf507173a 64 HAL_WWDG_STATE_RESET = 0x00, /*!< WWDG not yet initialized or disabled */
emilmont 77:869cf507173a 65 HAL_WWDG_STATE_READY = 0x01, /*!< WWDG initialized and ready for use */
emilmont 77:869cf507173a 66 HAL_WWDG_STATE_BUSY = 0x02, /*!< WWDG internal process is ongoing */
emilmont 77:869cf507173a 67 HAL_WWDG_STATE_TIMEOUT = 0x03, /*!< WWDG timeout state */
emilmont 77:869cf507173a 68 HAL_WWDG_STATE_ERROR = 0x04 /*!< WWDG error state */
emilmont 77:869cf507173a 69
emilmont 77:869cf507173a 70 }HAL_WWDG_StateTypeDef;
emilmont 77:869cf507173a 71
emilmont 77:869cf507173a 72 /**
emilmont 77:869cf507173a 73 * @brief WWDG Init structure definition
emilmont 77:869cf507173a 74 */
emilmont 77:869cf507173a 75 typedef struct
emilmont 77:869cf507173a 76 {
emilmont 77:869cf507173a 77 uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG.
emilmont 77:869cf507173a 78 This parameter can be a value of @ref WWDG_Prescaler */
emilmont 77:869cf507173a 79
emilmont 77:869cf507173a 80 uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter.
emilmont 77:869cf507173a 81 This parameter must be a number lower than Max_Data = 0x80 */
emilmont 77:869cf507173a 82
emilmont 77:869cf507173a 83 uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value.
emilmont 77:869cf507173a 84 This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */
emilmont 77:869cf507173a 85
emilmont 77:869cf507173a 86 }WWDG_InitTypeDef;
emilmont 77:869cf507173a 87
emilmont 77:869cf507173a 88 /**
emilmont 77:869cf507173a 89 * @brief WWDG handle Structure definition
emilmont 77:869cf507173a 90 */
emilmont 77:869cf507173a 91 typedef struct
emilmont 77:869cf507173a 92 {
emilmont 77:869cf507173a 93 WWDG_TypeDef *Instance; /*!< Register base address */
emilmont 77:869cf507173a 94
emilmont 77:869cf507173a 95 WWDG_InitTypeDef Init; /*!< WWDG required parameters */
emilmont 77:869cf507173a 96
emilmont 77:869cf507173a 97 HAL_LockTypeDef Lock; /*!< WWDG locking object */
emilmont 77:869cf507173a 98
emilmont 77:869cf507173a 99 __IO HAL_WWDG_StateTypeDef State; /*!< WWDG communication state */
emilmont 77:869cf507173a 100
emilmont 77:869cf507173a 101 }WWDG_HandleTypeDef;
emilmont 77:869cf507173a 102
emilmont 77:869cf507173a 103 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 104
emilmont 77:869cf507173a 105 /** @defgroup WWDG_Exported_Constants
emilmont 77:869cf507173a 106 * @{
emilmont 77:869cf507173a 107 */
emilmont 77:869cf507173a 108
emilmont 77:869cf507173a 109 /** @defgroup WWDG_BitAddress_AliasRegion
emilmont 77:869cf507173a 110 * @{
emilmont 77:869cf507173a 111 */
emilmont 77:869cf507173a 112
emilmont 77:869cf507173a 113 /* --- CFR Register ---*/
emilmont 77:869cf507173a 114 /* Alias word address of EWI bit */
emilmont 77:869cf507173a 115 #define CFR_BASE (uint32_t)(WWDG_BASE + 0x04)
emilmont 77:869cf507173a 116
emilmont 77:869cf507173a 117 /**
emilmont 77:869cf507173a 118 * @}
emilmont 77:869cf507173a 119 */
emilmont 77:869cf507173a 120
emilmont 77:869cf507173a 121 /** @defgroup WWDG_Interrupt_definition
emilmont 77:869cf507173a 122 * @{
emilmont 77:869cf507173a 123 */
emilmont 77:869cf507173a 124 #define WWDG_IT_EWI ((uint32_t)WWDG_CFR_EWI)
emilmont 77:869cf507173a 125
emilmont 77:869cf507173a 126 #define IS_WWDG_IT(IT) ((IT) == WWDG_IT_EWI)
emilmont 77:869cf507173a 127
emilmont 77:869cf507173a 128 /**
emilmont 77:869cf507173a 129 * @}
emilmont 77:869cf507173a 130 */
emilmont 77:869cf507173a 131
emilmont 77:869cf507173a 132 /** @defgroup WWDG_Flag_definition
emilmont 77:869cf507173a 133 * @brief WWDG Flag definition
emilmont 77:869cf507173a 134 * @{
emilmont 77:869cf507173a 135 */
emilmont 77:869cf507173a 136 #define WWDG_FLAG_EWIF ((uint32_t)0x0001) /*!< Early wakeup interrupt flag */
emilmont 77:869cf507173a 137
emilmont 77:869cf507173a 138 #define IS_WWDG_FLAG(FLAG) ((FLAG) == WWDG_FLAG_EWIF))
emilmont 77:869cf507173a 139
emilmont 77:869cf507173a 140 /**
emilmont 77:869cf507173a 141 * @}
emilmont 77:869cf507173a 142 */
emilmont 77:869cf507173a 143
emilmont 77:869cf507173a 144 /** @defgroup WWDG_Prescaler
emilmont 77:869cf507173a 145 * @{
emilmont 77:869cf507173a 146 */
emilmont 77:869cf507173a 147 #define WWDG_PRESCALER_1 ((uint32_t)0x00000000) /*!< WWDG counter clock = (PCLK1/4096)/1 */
emilmont 77:869cf507173a 148 #define WWDG_PRESCALER_2 ((uint32_t)0x00000080) /*!< WWDG counter clock = (PCLK1/4096)/2 */
emilmont 77:869cf507173a 149 #define WWDG_PRESCALER_4 ((uint32_t)0x00000100) /*!< WWDG counter clock = (PCLK1/4096)/4 */
emilmont 77:869cf507173a 150 #define WWDG_PRESCALER_8 ((uint32_t)0x00000180) /*!< WWDG counter clock = (PCLK1/4096)/8 */
emilmont 77:869cf507173a 151
emilmont 77:869cf507173a 152 #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_PRESCALER_1) || \
emilmont 77:869cf507173a 153 ((PRESCALER) == WWDG_PRESCALER_2) || \
emilmont 77:869cf507173a 154 ((PRESCALER) == WWDG_PRESCALER_4) || \
emilmont 77:869cf507173a 155 ((PRESCALER) == WWDG_PRESCALER_8))
emilmont 77:869cf507173a 156
emilmont 77:869cf507173a 157 /**
emilmont 77:869cf507173a 158 * @}
emilmont 77:869cf507173a 159 */
emilmont 77:869cf507173a 160
emilmont 77:869cf507173a 161 /** @defgroup WWDG_Window
emilmont 77:869cf507173a 162 * @{
emilmont 77:869cf507173a 163 */
emilmont 77:869cf507173a 164 #define IS_WWDG_WINDOW(WINDOW) ((WINDOW) <= 0x7F)
emilmont 77:869cf507173a 165
emilmont 77:869cf507173a 166 /**
emilmont 77:869cf507173a 167 * @}
emilmont 77:869cf507173a 168 */
emilmont 77:869cf507173a 169
emilmont 77:869cf507173a 170 /** @defgroup WWDG_Counter
emilmont 77:869cf507173a 171 * @{
emilmont 77:869cf507173a 172 */
emilmont 77:869cf507173a 173 #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
emilmont 77:869cf507173a 174
emilmont 77:869cf507173a 175 /**
emilmont 77:869cf507173a 176 * @}
emilmont 77:869cf507173a 177 */
emilmont 77:869cf507173a 178
emilmont 77:869cf507173a 179 /**
emilmont 77:869cf507173a 180 * @}
emilmont 77:869cf507173a 181 */
emilmont 77:869cf507173a 182
emilmont 77:869cf507173a 183 /* Exported macro ------------------------------------------------------------*/
emilmont 77:869cf507173a 184
emilmont 77:869cf507173a 185 /**
emilmont 77:869cf507173a 186 * @brief Enables the WWDG peripheral.
emilmont 77:869cf507173a 187 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 188 * @retval None
emilmont 77:869cf507173a 189 */
emilmont 77:869cf507173a 190 #define __HAL_WWDG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= WWDG_CR_WDGA)
emilmont 77:869cf507173a 191
emilmont 77:869cf507173a 192 /**
emilmont 77:869cf507173a 193 * @brief Gets the selected WWDG's flag status.
emilmont 77:869cf507173a 194 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 195 * @param __FLAG__: specifies the flag to check.
emilmont 77:869cf507173a 196 * This parameter can be one of the following values:
emilmont 77:869cf507173a 197 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
emilmont 77:869cf507173a 198 * @retval The new state of WWDG_FLAG (SET or RESET).
emilmont 77:869cf507173a 199 */
emilmont 77:869cf507173a 200 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
emilmont 77:869cf507173a 201
emilmont 77:869cf507173a 202 /**
emilmont 77:869cf507173a 203 * @brief Clears the WWDG's pending flags.
emilmont 77:869cf507173a 204 * @param __HANDLE__: WWDG handle
emilmont 77:869cf507173a 205 * @param __FLAG__: specifies the flag to clear.
emilmont 77:869cf507173a 206 * This parameter can be one of the following values:
emilmont 77:869cf507173a 207 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
emilmont 77:869cf507173a 208 * @retval None
emilmont 77:869cf507173a 209 */
emilmont 77:869cf507173a 210 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) &= ~(__FLAG__))
emilmont 77:869cf507173a 211
emilmont 77:869cf507173a 212 /**
emilmont 77:869cf507173a 213 * @brief Enables the WWDG early wakeup interrupt.
emilmont 77:869cf507173a 214 * @note Once enabled this interrupt cannot be disabled except by a system reset.
emilmont 77:869cf507173a 215 * @retval None
emilmont 77:869cf507173a 216 */
emilmont 77:869cf507173a 217 #define __HAL_WWDG_ENABLE_IT(__INTERRUPT__) (*(__IO uint32_t *) CFR_BASE |= (__INTERRUPT__))
emilmont 77:869cf507173a 218
emilmont 77:869cf507173a 219
emilmont 77:869cf507173a 220 /* Exported functions --------------------------------------------------------*/
emilmont 77:869cf507173a 221
emilmont 77:869cf507173a 222 /* Initialization/de-initialization functions **********************************/
emilmont 77:869cf507173a 223 HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 224 HAL_StatusTypeDef HAL_WWDG_DeInit(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 225 __weak void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 226 __weak void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 227 __weak void HAL_WWDG_WakeupCallback(WWDG_HandleTypeDef* hwwdg);
emilmont 77:869cf507173a 228
emilmont 77:869cf507173a 229 /* I/O operation functions ******************************************************/
emilmont 77:869cf507173a 230 HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 231 HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 232 HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter);
emilmont 77:869cf507173a 233 void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 234
emilmont 77:869cf507173a 235 /* Peripheral State functions **************************************************/
emilmont 77:869cf507173a 236 HAL_WWDG_StateTypeDef HAL_WWDG_GetState(WWDG_HandleTypeDef *hwwdg);
emilmont 77:869cf507173a 237
emilmont 77:869cf507173a 238 /**
emilmont 77:869cf507173a 239 * @}
emilmont 77:869cf507173a 240 */
emilmont 77:869cf507173a 241
emilmont 77:869cf507173a 242 /**
emilmont 77:869cf507173a 243 * @}
emilmont 77:869cf507173a 244 */
emilmont 77:869cf507173a 245
emilmont 77:869cf507173a 246 #ifdef __cplusplus
emilmont 77:869cf507173a 247 }
emilmont 77:869cf507173a 248 #endif
emilmont 77:869cf507173a 249
emilmont 77:869cf507173a 250 #endif /* __STM32F4xx_HAL_WWDG_H */
emilmont 77:869cf507173a 251
emilmont 77:869cf507173a 252 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/