mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
112:6f327212ef96
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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