mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
110:165afa46840b
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
bogdanm 89:552587b429a1 1 /**
bogdanm 89:552587b429a1 2 ******************************************************************************
bogdanm 89:552587b429a1 3 * @file stm32f4xx_hal_wwdg.h
bogdanm 89:552587b429a1 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.5.0
Kojto 122:f9eeca106725 6 * @date 06-May-2016
bogdanm 89:552587b429a1 7 * @brief Header file of WWDG HAL module.
bogdanm 89:552587b429a1 8 ******************************************************************************
bogdanm 89:552587b429a1 9 * @attention
bogdanm 89:552587b429a1 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
bogdanm 89:552587b429a1 12 *
bogdanm 89:552587b429a1 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 89:552587b429a1 14 * are permitted provided that the following conditions are met:
bogdanm 89:552587b429a1 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 89:552587b429a1 16 * this list of conditions and the following disclaimer.
bogdanm 89:552587b429a1 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 89:552587b429a1 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 89:552587b429a1 19 * and/or other materials provided with the distribution.
bogdanm 89:552587b429a1 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 89:552587b429a1 21 * may be used to endorse or promote products derived from this software
bogdanm 89:552587b429a1 22 * without specific prior written permission.
bogdanm 89:552587b429a1 23 *
bogdanm 89:552587b429a1 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 89:552587b429a1 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 89:552587b429a1 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 89:552587b429a1 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 89:552587b429a1 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 89:552587b429a1 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 89:552587b429a1 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 89:552587b429a1 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 89:552587b429a1 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 89:552587b429a1 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 89:552587b429a1 34 *
bogdanm 89:552587b429a1 35 ******************************************************************************
bogdanm 89:552587b429a1 36 */
bogdanm 89:552587b429a1 37
bogdanm 89:552587b429a1 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 89:552587b429a1 39 #ifndef __STM32F4xx_HAL_WWDG_H
bogdanm 89:552587b429a1 40 #define __STM32F4xx_HAL_WWDG_H
bogdanm 89:552587b429a1 41
bogdanm 89:552587b429a1 42 #ifdef __cplusplus
bogdanm 89:552587b429a1 43 extern "C" {
bogdanm 89:552587b429a1 44 #endif
bogdanm 89:552587b429a1 45
bogdanm 89:552587b429a1 46 /* Includes ------------------------------------------------------------------*/
bogdanm 89:552587b429a1 47 #include "stm32f4xx_hal_def.h"
bogdanm 89:552587b429a1 48
bogdanm 89:552587b429a1 49 /** @addtogroup STM32F4xx_HAL_Driver
bogdanm 89:552587b429a1 50 * @{
bogdanm 89:552587b429a1 51 */
bogdanm 89:552587b429a1 52
bogdanm 89:552587b429a1 53 /** @addtogroup WWDG
bogdanm 89:552587b429a1 54 * @{
bogdanm 89:552587b429a1 55 */
bogdanm 89:552587b429a1 56
bogdanm 92:4fc01daae5a5 57 /* Exported types ------------------------------------------------------------*/
Kojto 99:dbbf35b96557 58 /** @defgroup WWDG_Exported_Types WWDG Exported Types
Kojto 99:dbbf35b96557 59 * @{
Kojto 99:dbbf35b96557 60 */
bogdanm 89:552587b429a1 61
bogdanm 89:552587b429a1 62 /**
Kojto 122:f9eeca106725 63 * @brief WWDG Init structure definition
Kojto 122:f9eeca106725 64 */
bogdanm 89:552587b429a1 65 typedef struct
bogdanm 89:552587b429a1 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 */
bogdanm 89:552587b429a1 78
bogdanm 89:552587b429a1 79 }WWDG_InitTypeDef;
bogdanm 89:552587b429a1 80
Kojto 122:f9eeca106725 81 /**
Kojto 122:f9eeca106725 82 * @brief WWDG handle Structure definition
Kojto 122:f9eeca106725 83 */
bogdanm 89:552587b429a1 84 typedef struct
bogdanm 89:552587b429a1 85 {
bogdanm 92:4fc01daae5a5 86 WWDG_TypeDef *Instance; /*!< Register base address */
Kojto 122:f9eeca106725 87
bogdanm 89:552587b429a1 88 WWDG_InitTypeDef Init; /*!< WWDG required parameters */
Kojto 122:f9eeca106725 89
bogdanm 89:552587b429a1 90 }WWDG_HandleTypeDef;
Kojto 99:dbbf35b96557 91 /**
Kojto 99:dbbf35b96557 92 * @}
Kojto 122:f9eeca106725 93 */
bogdanm 89:552587b429a1 94
bogdanm 89:552587b429a1 95 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 96
Kojto 99:dbbf35b96557 97 /** @defgroup WWDG_Exported_Constants WWDG Exported Constants
bogdanm 89:552587b429a1 98 * @{
bogdanm 89:552587b429a1 99 */
bogdanm 89:552587b429a1 100
Kojto 99:dbbf35b96557 101 /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition
bogdanm 89:552587b429a1 102 * @{
Kojto 122:f9eeca106725 103 */
Kojto 122:f9eeca106725 104 #define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */
bogdanm 89:552587b429a1 105 /**
bogdanm 89:552587b429a1 106 * @}
bogdanm 89:552587b429a1 107 */
bogdanm 89:552587b429a1 108
Kojto 99:dbbf35b96557 109 /** @defgroup WWDG_Flag_definition WWDG Flag definition
bogdanm 89:552587b429a1 110 * @brief WWDG Flag definition
bogdanm 89:552587b429a1 111 * @{
Kojto 122:f9eeca106725 112 */
Kojto 122:f9eeca106725 113 #define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */
bogdanm 89:552587b429a1 114 /**
bogdanm 89:552587b429a1 115 * @}
bogdanm 89:552587b429a1 116 */
bogdanm 89:552587b429a1 117
Kojto 99:dbbf35b96557 118 /** @defgroup WWDG_Prescaler WWDG Prescaler
bogdanm 89:552587b429a1 119 * @{
bogdanm 89:552587b429a1 120 */
Kojto 122:f9eeca106725 121 #define WWDG_PRESCALER_1 ((uint32_t)0x00000000U) /*!< WWDG counter clock = (PCLK1/4096)/1 */
Kojto 99:dbbf35b96557 122 #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB0 /*!< WWDG counter clock = (PCLK1/4096)/2 */
Kojto 99:dbbf35b96557 123 #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB1 /*!< WWDG counter clock = (PCLK1/4096)/4 */
Kojto 99:dbbf35b96557 124 #define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */
bogdanm 89:552587b429a1 125 /**
bogdanm 89:552587b429a1 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 */
bogdanm 89:552587b429a1 137
bogdanm 89:552587b429a1 138 /**
bogdanm 89:552587b429a1 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))
bogdanm 89:552587b429a1 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 99:dbbf35b96557 165 /** @defgroup WWDG_Exported_Macros WWDG Exported Macros
Kojto 99:dbbf35b96557 166 * @{
Kojto 99:dbbf35b96557 167 */
bogdanm 89:552587b429a1 168
bogdanm 89:552587b429a1 169 /**
bogdanm 89:552587b429a1 170 * @brief Enables the WWDG peripheral.
bogdanm 89:552587b429a1 171 * @param __HANDLE__: WWDG handle
bogdanm 89:552587b429a1 172 * @retval None
bogdanm 89:552587b429a1 173 */
bogdanm 92:4fc01daae5a5 174 #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA)
bogdanm 89:552587b429a1 175
bogdanm 89:552587b429a1 176 /**
Kojto 122:f9eeca106725 177 * @brief Enables the WWDG early wakeup interrupt.
Kojto 99:dbbf35b96557 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 99:dbbf35b96557 183 * @retval None
Kojto 99:dbbf35b96557 184 */
Kojto 122:f9eeca106725 185 #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__))
Kojto 99:dbbf35b96557 186
Kojto 99:dbbf35b96557 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 99:dbbf35b96557 191 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 192 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT
Kojto 99:dbbf35b96557 193 * @retval The new state of WWDG_FLAG (SET or RESET).
Kojto 99:dbbf35b96557 194 */
Kojto 99:dbbf35b96557 195 #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__))
Kojto 99:dbbf35b96557 196
Kojto 99:dbbf35b96557 197 /** @brief Clear the WWDG's interrupt pending bits
Kojto 99:dbbf35b96557 198 * bits to clear the selected interrupt pending bits.
Kojto 99:dbbf35b96557 199 * @param __HANDLE__: WWDG handle
Kojto 99:dbbf35b96557 200 * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
Kojto 99:dbbf35b96557 201 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 202 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
Kojto 99:dbbf35b96557 203 */
Kojto 99:dbbf35b96557 204 #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__))
Kojto 99:dbbf35b96557 205
Kojto 99:dbbf35b96557 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.
bogdanm 89:552587b429a1 210 * This parameter can be one of the following values:
bogdanm 89:552587b429a1 211 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
bogdanm 89:552587b429a1 212 * @retval The new state of WWDG_FLAG (SET or RESET).
bogdanm 89:552587b429a1 213 */
bogdanm 89:552587b429a1 214 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
bogdanm 89:552587b429a1 215
bogdanm 89:552587b429a1 216 /**
bogdanm 89:552587b429a1 217 * @brief Clears the WWDG's pending flags.
bogdanm 89:552587b429a1 218 * @param __HANDLE__: WWDG handle
bogdanm 89:552587b429a1 219 * @param __FLAG__: specifies the flag to clear.
bogdanm 89:552587b429a1 220 * This parameter can be one of the following values:
bogdanm 89:552587b429a1 221 * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
bogdanm 89:552587b429a1 222 * @retval None
bogdanm 89:552587b429a1 223 */
bogdanm 92:4fc01daae5a5 224 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
bogdanm 89:552587b429a1 225
Kojto 99:dbbf35b96557 226 /** @brief Checks if the specified WWDG interrupt source is enabled or disabled.
Kojto 99:dbbf35b96557 227 * @param __HANDLE__: WWDG Handle.
Kojto 99:dbbf35b96557 228 * @param __INTERRUPT__: specifies the WWDG interrupt source to check.
Kojto 99:dbbf35b96557 229 * This parameter can be one of the following values:
Kojto 99:dbbf35b96557 230 * @arg WWDG_IT_EWI: Early Wakeup Interrupt
Kojto 99:dbbf35b96557 231 * @retval state of __INTERRUPT__ (TRUE or FALSE).
bogdanm 89:552587b429a1 232 */
Kojto 99:dbbf35b96557 233 #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__))
bogdanm 89:552587b429a1 234
Kojto 99:dbbf35b96557 235 /**
Kojto 99:dbbf35b96557 236 * @}
bogdanm 92:4fc01daae5a5 237 */
Kojto 99:dbbf35b96557 238
bogdanm 89:552587b429a1 239 /* Exported functions --------------------------------------------------------*/
Kojto 99:dbbf35b96557 240 /** @addtogroup WWDG_Exported_Functions
Kojto 99:dbbf35b96557 241 * @{
Kojto 99:dbbf35b96557 242 */
bogdanm 89:552587b429a1 243
Kojto 99:dbbf35b96557 244 /** @addtogroup WWDG_Exported_Functions_Group1
Kojto 99:dbbf35b96557 245 * @{
Kojto 99:dbbf35b96557 246 */
bogdanm 89:552587b429a1 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 99:dbbf35b96557 250 /**
Kojto 99:dbbf35b96557 251 * @}
Kojto 99:dbbf35b96557 252 */
bogdanm 89:552587b429a1 253
Kojto 99:dbbf35b96557 254 /** @addtogroup WWDG_Exported_Functions_Group2
Kojto 99:dbbf35b96557 255 * @{
Kojto 99:dbbf35b96557 256 */
bogdanm 89:552587b429a1 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 99:dbbf35b96557 261 /**
Kojto 99:dbbf35b96557 262 * @}
Kojto 99:dbbf35b96557 263 */
bogdanm 89:552587b429a1 264
Kojto 99:dbbf35b96557 265 /**
Kojto 99:dbbf35b96557 266 * @}
Kojto 99:dbbf35b96557 267 */
Kojto 99:dbbf35b96557 268
Kojto 99:dbbf35b96557 269 /**
Kojto 99:dbbf35b96557 270 * @}
Kojto 99:dbbf35b96557 271 */
Kojto 99:dbbf35b96557 272
Kojto 99:dbbf35b96557 273 /**
Kojto 99:dbbf35b96557 274 * @}
Kojto 99:dbbf35b96557 275 */
Kojto 99:dbbf35b96557 276
bogdanm 89:552587b429a1 277 #ifdef __cplusplus
bogdanm 89:552587b429a1 278 }
bogdanm 89:552587b429a1 279 #endif
bogdanm 89:552587b429a1 280
bogdanm 89:552587b429a1 281 #endif /* __STM32F4xx_HAL_WWDG_H */
bogdanm 89:552587b429a1 282
bogdanm 89:552587b429a1 283 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/