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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Fri May 26 12:30:20 2017 +0100
Revision:
143:86740a56073b
Parent:
135:176b8275d35d
Release 143 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f3xx_hal_iwdg.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
<> 135:176b8275d35d 5 * @version V1.4.0
<> 135:176b8275d35d 6 * @date 16-December-2016
bogdanm 86:04dd9b1680ae 7 * @brief Header file of IWDG HAL module.
bogdanm 86:04dd9b1680ae 8 ******************************************************************************
bogdanm 86:04dd9b1680ae 9 * @attention
bogdanm 86:04dd9b1680ae 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 12 *
bogdanm 86:04dd9b1680ae 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 14 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 16 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 19 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 21 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 22 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 23 *
bogdanm 86:04dd9b1680ae 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
bogdanm 86:04dd9b1680ae 36 */
bogdanm 86:04dd9b1680ae 37
bogdanm 86:04dd9b1680ae 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 86:04dd9b1680ae 39 #ifndef __STM32F3xx_HAL_IWDG_H
bogdanm 86:04dd9b1680ae 40 #define __STM32F3xx_HAL_IWDG_H
bogdanm 86:04dd9b1680ae 41
bogdanm 86:04dd9b1680ae 42 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 43 extern "C" {
bogdanm 86:04dd9b1680ae 44 #endif
bogdanm 86:04dd9b1680ae 45
bogdanm 86:04dd9b1680ae 46 /* Includes ------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 47 #include "stm32f3xx_hal_def.h"
bogdanm 86:04dd9b1680ae 48
bogdanm 86:04dd9b1680ae 49 /** @addtogroup STM32F3xx_HAL_Driver
bogdanm 86:04dd9b1680ae 50 * @{
bogdanm 86:04dd9b1680ae 51 */
bogdanm 86:04dd9b1680ae 52
Kojto 123:b0220dba8be7 53 /** @defgroup IWDG IWDG
bogdanm 86:04dd9b1680ae 54 * @{
Kojto 122:f9eeca106725 55 */
bogdanm 86:04dd9b1680ae 56
Kojto 122:f9eeca106725 57 /* Exported types ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 58 /** @defgroup IWDG_Exported_Types IWDG Exported Types
bogdanm 92:4fc01daae5a5 59 * @{
bogdanm 92:4fc01daae5a5 60 */
bogdanm 92:4fc01daae5a5 61
bogdanm 86:04dd9b1680ae 62 /**
Kojto 122:f9eeca106725 63 * @brief IWDG Init structure definition
bogdanm 86:04dd9b1680ae 64 */
bogdanm 86:04dd9b1680ae 65 typedef struct
bogdanm 86:04dd9b1680ae 66 {
Kojto 122:f9eeca106725 67 uint32_t Prescaler; /*!< Select the prescaler of the IWDG.
Kojto 122:f9eeca106725 68 This parameter can be a value of @ref IWDG_Prescaler */
Kojto 122:f9eeca106725 69
Kojto 122:f9eeca106725 70 uint32_t Reload; /*!< Specifies the IWDG down-counter reload value.
<> 135:176b8275d35d 71 This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFFU */
Kojto 122:f9eeca106725 72
Kojto 122:f9eeca106725 73 uint32_t Window; /*!< Specifies the window value to be compared to the down-counter.
<> 135:176b8275d35d 74 This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFFU */
bogdanm 86:04dd9b1680ae 75
bogdanm 86:04dd9b1680ae 76 } IWDG_InitTypeDef;
bogdanm 86:04dd9b1680ae 77
bogdanm 86:04dd9b1680ae 78 /**
bogdanm 86:04dd9b1680ae 79 * @brief IWDG Handle Structure definition
Kojto 122:f9eeca106725 80 */
bogdanm 86:04dd9b1680ae 81 typedef struct
bogdanm 86:04dd9b1680ae 82 {
Kojto 122:f9eeca106725 83 IWDG_TypeDef *Instance; /*!< Register base address */
Kojto 122:f9eeca106725 84
Kojto 122:f9eeca106725 85 IWDG_InitTypeDef Init; /*!< IWDG required parameters */
Kojto 122:f9eeca106725 86
bogdanm 86:04dd9b1680ae 87 }IWDG_HandleTypeDef;
bogdanm 86:04dd9b1680ae 88
bogdanm 92:4fc01daae5a5 89 /**
bogdanm 92:4fc01daae5a5 90 * @}
bogdanm 92:4fc01daae5a5 91 */
bogdanm 92:4fc01daae5a5 92
bogdanm 86:04dd9b1680ae 93 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 94 /** @defgroup IWDG_Exported_Constants IWDG Exported Constants
bogdanm 86:04dd9b1680ae 95 * @{
bogdanm 86:04dd9b1680ae 96 */
bogdanm 86:04dd9b1680ae 97
bogdanm 92:4fc01daae5a5 98 /** @defgroup IWDG_Prescaler IWDG Prescaler
bogdanm 86:04dd9b1680ae 99 * @{
Kojto 122:f9eeca106725 100 */
Kojto 123:b0220dba8be7 101 #define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */
Kojto 123:b0220dba8be7 102 #define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */
Kojto 123:b0220dba8be7 103 #define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */
Kojto 123:b0220dba8be7 104 #define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */
Kojto 123:b0220dba8be7 105 #define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */
<> 135:176b8275d35d 106 #define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128U */
<> 135:176b8275d35d 107 #define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256U */
bogdanm 86:04dd9b1680ae 108 /**
bogdanm 86:04dd9b1680ae 109 * @}
bogdanm 86:04dd9b1680ae 110 */
bogdanm 86:04dd9b1680ae 111
Kojto 123:b0220dba8be7 112 /** @defgroup IWDG_Window_option IWDG Window option
bogdanm 86:04dd9b1680ae 113 * @{
Kojto 122:f9eeca106725 114 */
Kojto 123:b0220dba8be7 115 #define IWDG_WINDOW_DISABLE IWDG_WINR_WIN
bogdanm 86:04dd9b1680ae 116 /**
bogdanm 86:04dd9b1680ae 117 * @}
bogdanm 86:04dd9b1680ae 118 */
bogdanm 86:04dd9b1680ae 119
bogdanm 86:04dd9b1680ae 120 /**
bogdanm 86:04dd9b1680ae 121 * @}
bogdanm 86:04dd9b1680ae 122 */
bogdanm 86:04dd9b1680ae 123
bogdanm 86:04dd9b1680ae 124 /* Exported macros -----------------------------------------------------------*/
Kojto 122:f9eeca106725 125 /** @defgroup IWDG_Exported_Macros IWDG Exported Macros
Kojto 122:f9eeca106725 126 * @{
Kojto 122:f9eeca106725 127 */
bogdanm 86:04dd9b1680ae 128
bogdanm 86:04dd9b1680ae 129 /**
Kojto 122:f9eeca106725 130 * @brief Enable the IWDG peripheral.
Kojto 123:b0220dba8be7 131 * @param __HANDLE__ IWDG handle
bogdanm 86:04dd9b1680ae 132 * @retval None
bogdanm 86:04dd9b1680ae 133 */
Kojto 122:f9eeca106725 134 #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE)
bogdanm 86:04dd9b1680ae 135
bogdanm 86:04dd9b1680ae 136 /**
Kojto 123:b0220dba8be7 137 * @brief Reload IWDG counter with value defined in the reload register
Kojto 123:b0220dba8be7 138 * (write access to IWDG_PR, IWDG_RLR & IWDG_WINR registers disabled).
Kojto 123:b0220dba8be7 139 * @param __HANDLE__ IWDG handle
bogdanm 86:04dd9b1680ae 140 * @retval None
bogdanm 86:04dd9b1680ae 141 */
Kojto 122:f9eeca106725 142 #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD)
bogdanm 86:04dd9b1680ae 143
bogdanm 86:04dd9b1680ae 144 /**
bogdanm 86:04dd9b1680ae 145 * @}
bogdanm 86:04dd9b1680ae 146 */
bogdanm 86:04dd9b1680ae 147
bogdanm 86:04dd9b1680ae 148 /* Exported functions --------------------------------------------------------*/
Kojto 123:b0220dba8be7 149 /** @defgroup IWDG_Exported_Functions IWDG Exported Functions
bogdanm 92:4fc01daae5a5 150 * @{
bogdanm 92:4fc01daae5a5 151 */
bogdanm 92:4fc01daae5a5 152
Kojto 123:b0220dba8be7 153 /** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions
bogdanm 92:4fc01daae5a5 154 * @{
bogdanm 92:4fc01daae5a5 155 */
Kojto 123:b0220dba8be7 156 /* Initialization/Start functions ********************************************/
bogdanm 86:04dd9b1680ae 157 HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg);
bogdanm 92:4fc01daae5a5 158 /**
bogdanm 92:4fc01daae5a5 159 * @}
bogdanm 92:4fc01daae5a5 160 */
Kojto 122:f9eeca106725 161
Kojto 123:b0220dba8be7 162 /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions
bogdanm 92:4fc01daae5a5 163 * @{
bogdanm 92:4fc01daae5a5 164 */
bogdanm 86:04dd9b1680ae 165 /* I/O operation functions ****************************************************/
bogdanm 86:04dd9b1680ae 166 HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg);
bogdanm 92:4fc01daae5a5 167 /**
bogdanm 92:4fc01daae5a5 168 * @}
bogdanm 92:4fc01daae5a5 169 */
Kojto 122:f9eeca106725 170
bogdanm 86:04dd9b1680ae 171 /**
bogdanm 86:04dd9b1680ae 172 * @}
Kojto 122:f9eeca106725 173 */
Kojto 122:f9eeca106725 174
Kojto 122:f9eeca106725 175 /* Private constants ---------------------------------------------------------*/
Kojto 123:b0220dba8be7 176 /** @defgroup IWDG_Private_Constants IWDG Private Constants
Kojto 122:f9eeca106725 177 * @{
Kojto 122:f9eeca106725 178 */
Kojto 122:f9eeca106725 179 /**
Kojto 122:f9eeca106725 180 * @brief IWDG Key Register BitMask
Kojto 122:f9eeca106725 181 */
Kojto 123:b0220dba8be7 182 #define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */
Kojto 123:b0220dba8be7 183 #define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */
Kojto 123:b0220dba8be7 184 #define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */
Kojto 123:b0220dba8be7 185 #define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */
bogdanm 86:04dd9b1680ae 186
bogdanm 86:04dd9b1680ae 187 /**
bogdanm 86:04dd9b1680ae 188 * @}
Kojto 122:f9eeca106725 189 */
Kojto 122:f9eeca106725 190
Kojto 122:f9eeca106725 191 /* Private macros ------------------------------------------------------------*/
Kojto 123:b0220dba8be7 192 /** @defgroup IWDG_Private_Macros IWDG Private Macros
Kojto 122:f9eeca106725 193 * @{
Kojto 122:f9eeca106725 194 */
Kojto 122:f9eeca106725 195 /**
Kojto 123:b0220dba8be7 196 * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.
Kojto 123:b0220dba8be7 197 * @param __HANDLE__ IWDG handle
Kojto 122:f9eeca106725 198 * @retval None
Kojto 122:f9eeca106725 199 */
Kojto 122:f9eeca106725 200 #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE)
Kojto 122:f9eeca106725 201
Kojto 122:f9eeca106725 202 /**
Kojto 123:b0220dba8be7 203 * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.
Kojto 123:b0220dba8be7 204 * @param __HANDLE__ IWDG handle
Kojto 122:f9eeca106725 205 * @retval None
Kojto 122:f9eeca106725 206 */
Kojto 122:f9eeca106725 207 #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE)
Kojto 122:f9eeca106725 208
Kojto 122:f9eeca106725 209 /**
Kojto 122:f9eeca106725 210 * @brief Check IWDG prescaler value.
Kojto 123:b0220dba8be7 211 * @param __PRESCALER__ IWDG prescaler value
Kojto 122:f9eeca106725 212 * @retval None
Kojto 122:f9eeca106725 213 */
Kojto 122:f9eeca106725 214 #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \
Kojto 122:f9eeca106725 215 ((__PRESCALER__) == IWDG_PRESCALER_8) || \
Kojto 122:f9eeca106725 216 ((__PRESCALER__) == IWDG_PRESCALER_16) || \
Kojto 122:f9eeca106725 217 ((__PRESCALER__) == IWDG_PRESCALER_32) || \
Kojto 122:f9eeca106725 218 ((__PRESCALER__) == IWDG_PRESCALER_64) || \
Kojto 122:f9eeca106725 219 ((__PRESCALER__) == IWDG_PRESCALER_128)|| \
Kojto 122:f9eeca106725 220 ((__PRESCALER__) == IWDG_PRESCALER_256))
Kojto 122:f9eeca106725 221
Kojto 122:f9eeca106725 222 /**
Kojto 122:f9eeca106725 223 * @brief Check IWDG reload value.
Kojto 123:b0220dba8be7 224 * @param __RELOAD__ IWDG reload value
Kojto 122:f9eeca106725 225 * @retval None
Kojto 122:f9eeca106725 226 */
Kojto 123:b0220dba8be7 227 #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL)
Kojto 122:f9eeca106725 228
Kojto 122:f9eeca106725 229 /**
Kojto 122:f9eeca106725 230 * @brief Check IWDG window value.
Kojto 123:b0220dba8be7 231 * @param __WINDOW__ IWDG window value
Kojto 122:f9eeca106725 232 * @retval None
Kojto 122:f9eeca106725 233 */
Kojto 123:b0220dba8be7 234 #define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN)
bogdanm 86:04dd9b1680ae 235
bogdanm 92:4fc01daae5a5 236 /**
bogdanm 92:4fc01daae5a5 237 * @}
Kojto 122:f9eeca106725 238 */
bogdanm 92:4fc01daae5a5 239
bogdanm 92:4fc01daae5a5 240 /**
bogdanm 92:4fc01daae5a5 241 * @}
Kojto 122:f9eeca106725 242 */
Kojto 122:f9eeca106725 243
Kojto 122:f9eeca106725 244 /**
Kojto 122:f9eeca106725 245 * @}
Kojto 122:f9eeca106725 246 */
Kojto 122:f9eeca106725 247
Kojto 122:f9eeca106725 248
bogdanm 86:04dd9b1680ae 249 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 250 }
bogdanm 86:04dd9b1680ae 251 #endif
bogdanm 86:04dd9b1680ae 252
<> 135:176b8275d35d 253 #endif /* __STM32F3xx_HAL_IWDG_H */
bogdanm 86:04dd9b1680ae 254
bogdanm 86:04dd9b1680ae 255 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/