Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 110:165afa46840b 1 /**
Kojto 110:165afa46840b 2 ******************************************************************************
Kojto 110:165afa46840b 3 * @file stm32f4xx_hal_iwdg.h
Kojto 110:165afa46840b 4 * @author MCD Application Team
Kojto 110:165afa46840b 5 * @version V1.4.1
Kojto 110:165afa46840b 6 * @date 09-October-2015
Kojto 110:165afa46840b 7 * @brief Header file of IWDG HAL module.
Kojto 110:165afa46840b 8 ******************************************************************************
Kojto 110:165afa46840b 9 * @attention
Kojto 110:165afa46840b 10 *
Kojto 110:165afa46840b 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 110:165afa46840b 12 *
Kojto 110:165afa46840b 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 110:165afa46840b 14 * are permitted provided that the following conditions are met:
Kojto 110:165afa46840b 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 110:165afa46840b 16 * this list of conditions and the following disclaimer.
Kojto 110:165afa46840b 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 110:165afa46840b 18 * this list of conditions and the following disclaimer in the documentation
Kojto 110:165afa46840b 19 * and/or other materials provided with the distribution.
Kojto 110:165afa46840b 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 110:165afa46840b 21 * may be used to endorse or promote products derived from this software
Kojto 110:165afa46840b 22 * without specific prior written permission.
Kojto 110:165afa46840b 23 *
Kojto 110:165afa46840b 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 110:165afa46840b 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 110:165afa46840b 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 110:165afa46840b 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 110:165afa46840b 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 110:165afa46840b 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 110:165afa46840b 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 110:165afa46840b 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 110:165afa46840b 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 110:165afa46840b 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 110:165afa46840b 34 *
Kojto 110:165afa46840b 35 ******************************************************************************
Kojto 110:165afa46840b 36 */
Kojto 110:165afa46840b 37
Kojto 110:165afa46840b 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 110:165afa46840b 39 #ifndef __STM32F4xx_HAL_IWDG_H
Kojto 110:165afa46840b 40 #define __STM32F4xx_HAL_IWDG_H
Kojto 110:165afa46840b 41
Kojto 110:165afa46840b 42 #ifdef __cplusplus
Kojto 110:165afa46840b 43 extern "C" {
Kojto 110:165afa46840b 44 #endif
Kojto 110:165afa46840b 45
Kojto 110:165afa46840b 46 /* Includes ------------------------------------------------------------------*/
Kojto 110:165afa46840b 47 #include "stm32f4xx_hal_def.h"
Kojto 110:165afa46840b 48
Kojto 110:165afa46840b 49 /** @addtogroup STM32F4xx_HAL_Driver
Kojto 110:165afa46840b 50 * @{
Kojto 110:165afa46840b 51 */
Kojto 110:165afa46840b 52
Kojto 110:165afa46840b 53 /** @addtogroup IWDG
Kojto 110:165afa46840b 54 * @{
Kojto 110:165afa46840b 55 */
Kojto 110:165afa46840b 56
Kojto 110:165afa46840b 57 /* Exported types ------------------------------------------------------------*/
Kojto 110:165afa46840b 58 /** @defgroup IWDG_Exported_Types IWDG Exported Types
Kojto 110:165afa46840b 59 * @{
Kojto 110:165afa46840b 60 */
Kojto 110:165afa46840b 61
Kojto 110:165afa46840b 62 /**
Kojto 110:165afa46840b 63 * @brief IWDG HAL State Structure definition
Kojto 110:165afa46840b 64 */
Kojto 110:165afa46840b 65 typedef enum
Kojto 110:165afa46840b 66 {
Kojto 110:165afa46840b 67 HAL_IWDG_STATE_RESET = 0x00, /*!< IWDG not yet initialized or disabled */
Kojto 110:165afa46840b 68 HAL_IWDG_STATE_READY = 0x01, /*!< IWDG initialized and ready for use */
Kojto 110:165afa46840b 69 HAL_IWDG_STATE_BUSY = 0x02, /*!< IWDG internal process is ongoing */
Kojto 110:165afa46840b 70 HAL_IWDG_STATE_TIMEOUT = 0x03, /*!< IWDG timeout state */
Kojto 110:165afa46840b 71 HAL_IWDG_STATE_ERROR = 0x04 /*!< IWDG error state */
Kojto 110:165afa46840b 72 }HAL_IWDG_StateTypeDef;
Kojto 110:165afa46840b 73
Kojto 110:165afa46840b 74 /**
Kojto 110:165afa46840b 75 * @brief IWDG Init structure definition
Kojto 110:165afa46840b 76 */
Kojto 110:165afa46840b 77 typedef struct
Kojto 110:165afa46840b 78 {
Kojto 110:165afa46840b 79 uint32_t Prescaler; /*!< Select the prescaler of the IWDG.
Kojto 110:165afa46840b 80 This parameter can be a value of @ref IWDG_Prescaler */
Kojto 110:165afa46840b 81
Kojto 110:165afa46840b 82 uint32_t Reload; /*!< Specifies the IWDG down-counter reload value.
Kojto 110:165afa46840b 83 This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */
Kojto 110:165afa46840b 84 }IWDG_InitTypeDef;
Kojto 110:165afa46840b 85
Kojto 110:165afa46840b 86 /**
Kojto 110:165afa46840b 87 * @brief IWDG Handle Structure definition
Kojto 110:165afa46840b 88 */
Kojto 110:165afa46840b 89 typedef struct
Kojto 110:165afa46840b 90 {
Kojto 110:165afa46840b 91 IWDG_TypeDef *Instance; /*!< Register base address */
Kojto 110:165afa46840b 92
Kojto 110:165afa46840b 93 IWDG_InitTypeDef Init; /*!< IWDG required parameters */
Kojto 110:165afa46840b 94
Kojto 110:165afa46840b 95 HAL_LockTypeDef Lock; /*!< IWDG Locking object */
Kojto 110:165afa46840b 96
Kojto 110:165afa46840b 97 __IO HAL_IWDG_StateTypeDef State; /*!< IWDG communication state */
Kojto 110:165afa46840b 98 }IWDG_HandleTypeDef;
Kojto 110:165afa46840b 99
Kojto 110:165afa46840b 100 /**
Kojto 110:165afa46840b 101 * @}
Kojto 110:165afa46840b 102 */
Kojto 110:165afa46840b 103
Kojto 110:165afa46840b 104 /* Exported constants --------------------------------------------------------*/
Kojto 110:165afa46840b 105 /** @defgroup IWDG_Exported_Constants IWDG Exported Constants
Kojto 110:165afa46840b 106 * @{
Kojto 110:165afa46840b 107 */
Kojto 110:165afa46840b 108
Kojto 110:165afa46840b 109 /** @defgroup IWDG_Registers_BitMask IWDG Registers BitMask
Kojto 110:165afa46840b 110 * @brief IWDG registers bit mask
Kojto 110:165afa46840b 111 * @{
Kojto 110:165afa46840b 112 */
Kojto 110:165afa46840b 113 /* --- KR Register ---*/
Kojto 110:165afa46840b 114 /* KR register bit mask */
Kojto 110:165afa46840b 115 #define IWDG_KEY_RELOAD ((uint32_t)0xAAAA) /*!< IWDG Reload Counter Enable */
Kojto 110:165afa46840b 116 #define IWDG_KEY_ENABLE ((uint32_t)0xCCCC) /*!< IWDG Peripheral Enable */
Kojto 110:165afa46840b 117 #define IWDG_KEY_WRITE_ACCESS_ENABLE ((uint32_t)0x5555) /*!< IWDG KR Write Access Enable */
Kojto 110:165afa46840b 118 #define IWDG_KEY_WRITE_ACCESS_DISABLE ((uint32_t)0x0000) /*!< IWDG KR Write Access Disable */
Kojto 110:165afa46840b 119 /**
Kojto 110:165afa46840b 120 * @}
Kojto 110:165afa46840b 121 */
Kojto 110:165afa46840b 122
Kojto 110:165afa46840b 123 /** @defgroup IWDG_Flag_definition IWDG Flag definition
Kojto 110:165afa46840b 124 * @{
Kojto 110:165afa46840b 125 */
Kojto 110:165afa46840b 126 #define IWDG_FLAG_PVU ((uint32_t)IWDG_SR_PVU) /*!< Watchdog counter prescaler value update Flag */
Kojto 110:165afa46840b 127 #define IWDG_FLAG_RVU ((uint32_t)IWDG_SR_RVU) /*!< Watchdog counter reload value update Flag */
Kojto 110:165afa46840b 128 /**
Kojto 110:165afa46840b 129 * @}
Kojto 110:165afa46840b 130 */
Kojto 110:165afa46840b 131
Kojto 110:165afa46840b 132 /** @defgroup IWDG_Prescaler IWDG Prescaler
Kojto 110:165afa46840b 133 * @{
Kojto 110:165afa46840b 134 */
Kojto 110:165afa46840b 135 #define IWDG_PRESCALER_4 ((uint8_t)0x00) /*!< IWDG prescaler set to 4 */
Kojto 110:165afa46840b 136 #define IWDG_PRESCALER_8 ((uint8_t)(IWDG_PR_PR_0)) /*!< IWDG prescaler set to 8 */
Kojto 110:165afa46840b 137 #define IWDG_PRESCALER_16 ((uint8_t)(IWDG_PR_PR_1)) /*!< IWDG prescaler set to 16 */
Kojto 110:165afa46840b 138 #define IWDG_PRESCALER_32 ((uint8_t)(IWDG_PR_PR_1 | IWDG_PR_PR_0)) /*!< IWDG prescaler set to 32 */
Kojto 110:165afa46840b 139 #define IWDG_PRESCALER_64 ((uint8_t)(IWDG_PR_PR_2)) /*!< IWDG prescaler set to 64 */
Kojto 110:165afa46840b 140 #define IWDG_PRESCALER_128 ((uint8_t)(IWDG_PR_PR_2 | IWDG_PR_PR_0)) /*!< IWDG prescaler set to 128 */
Kojto 110:165afa46840b 141 #define IWDG_PRESCALER_256 ((uint8_t)(IWDG_PR_PR_2 | IWDG_PR_PR_1)) /*!< IWDG prescaler set to 256 */
Kojto 110:165afa46840b 142 /**
Kojto 110:165afa46840b 143 * @}
Kojto 110:165afa46840b 144 */
Kojto 110:165afa46840b 145
Kojto 110:165afa46840b 146 /**
Kojto 110:165afa46840b 147 * @}
Kojto 110:165afa46840b 148 */
Kojto 110:165afa46840b 149
Kojto 110:165afa46840b 150 /* Exported macros -----------------------------------------------------------*/
Kojto 110:165afa46840b 151 /** @defgroup IWDG_Exported_Macros IWDG Exported Macros
Kojto 110:165afa46840b 152 * @{
Kojto 110:165afa46840b 153 */
Kojto 110:165afa46840b 154
Kojto 110:165afa46840b 155 /** @brief Reset IWDG handle state
Kojto 110:165afa46840b 156 * @param __HANDLE__: IWDG handle.
Kojto 110:165afa46840b 157 * @retval None
Kojto 110:165afa46840b 158 */
Kojto 110:165afa46840b 159 #define __HAL_IWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_IWDG_STATE_RESET)
Kojto 110:165afa46840b 160
Kojto 110:165afa46840b 161 /**
Kojto 110:165afa46840b 162 * @brief Enables the IWDG peripheral.
Kojto 110:165afa46840b 163 * @param __HANDLE__: IWDG handle
Kojto 110:165afa46840b 164 * @retval None
Kojto 110:165afa46840b 165 */
Kojto 110:165afa46840b 166 #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE)
Kojto 110:165afa46840b 167
Kojto 110:165afa46840b 168 /**
Kojto 110:165afa46840b 169 * @brief Reloads IWDG counter with value defined in the reload register
Kojto 110:165afa46840b 170 * (write access to IWDG_PR and IWDG_RLR registers disabled).
Kojto 110:165afa46840b 171 * @param __HANDLE__: IWDG handle
Kojto 110:165afa46840b 172 * @retval None
Kojto 110:165afa46840b 173 */
Kojto 110:165afa46840b 174 #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD)
Kojto 110:165afa46840b 175
Kojto 110:165afa46840b 176 /**
Kojto 110:165afa46840b 177 * @brief Gets the selected IWDG's flag status.
Kojto 110:165afa46840b 178 * @param __HANDLE__: IWDG handle
Kojto 110:165afa46840b 179 * @param __FLAG__: specifies the flag to check.
Kojto 110:165afa46840b 180 * This parameter can be one of the following values:
Kojto 110:165afa46840b 181 * @arg IWDG_FLAG_PVU: Watchdog counter reload value update flag
Kojto 110:165afa46840b 182 * @arg IWDG_FLAG_RVU: Watchdog counter prescaler value flag
Kojto 110:165afa46840b 183 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 110:165afa46840b 184 */
Kojto 110:165afa46840b 185 #define __HAL_IWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
Kojto 110:165afa46840b 186
Kojto 110:165afa46840b 187 /**
Kojto 110:165afa46840b 188 * @}
Kojto 110:165afa46840b 189 */
Kojto 110:165afa46840b 190
Kojto 110:165afa46840b 191 /* Exported functions --------------------------------------------------------*/
Kojto 110:165afa46840b 192 /** @addtogroup IWDG_Exported_Functions
Kojto 110:165afa46840b 193 * @{
Kojto 110:165afa46840b 194 */
Kojto 110:165afa46840b 195
Kojto 110:165afa46840b 196 /** @addtogroup IWDG_Exported_Functions_Group1
Kojto 110:165afa46840b 197 * @{
Kojto 110:165afa46840b 198 */
Kojto 110:165afa46840b 199 /* Initialization/de-initialization functions ********************************/
Kojto 110:165afa46840b 200 HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg);
Kojto 110:165afa46840b 201 void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg);
Kojto 110:165afa46840b 202 /**
Kojto 110:165afa46840b 203 * @}
Kojto 110:165afa46840b 204 */
Kojto 110:165afa46840b 205
Kojto 110:165afa46840b 206 /** @addtogroup IWDG_Exported_Functions_Group2
Kojto 110:165afa46840b 207 * @{
Kojto 110:165afa46840b 208 */
Kojto 110:165afa46840b 209 /* I/O operation functions ****************************************************/
Kojto 110:165afa46840b 210 HAL_StatusTypeDef HAL_IWDG_Start(IWDG_HandleTypeDef *hiwdg);
Kojto 110:165afa46840b 211 HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg);
Kojto 110:165afa46840b 212 /**
Kojto 110:165afa46840b 213 * @}
Kojto 110:165afa46840b 214 */
Kojto 110:165afa46840b 215
Kojto 110:165afa46840b 216 /** @addtogroup IWDG_Exported_Functions_Group3
Kojto 110:165afa46840b 217 * @{
Kojto 110:165afa46840b 218 */
Kojto 110:165afa46840b 219 /* Peripheral State functions ************************************************/
Kojto 110:165afa46840b 220 HAL_IWDG_StateTypeDef HAL_IWDG_GetState(IWDG_HandleTypeDef *hiwdg);
Kojto 110:165afa46840b 221
Kojto 110:165afa46840b 222 /**
Kojto 110:165afa46840b 223 * @}
Kojto 110:165afa46840b 224 */
Kojto 110:165afa46840b 225
Kojto 110:165afa46840b 226 /**
Kojto 110:165afa46840b 227 * @}
Kojto 110:165afa46840b 228 */
Kojto 110:165afa46840b 229
Kojto 110:165afa46840b 230 /* Private macro -------------------------------------------------------------*/
Kojto 110:165afa46840b 231 /** @defgroup IWDG_Private_Macros IWDG Private Macros
Kojto 110:165afa46840b 232 * @{
Kojto 110:165afa46840b 233 */
Kojto 110:165afa46840b 234
Kojto 110:165afa46840b 235 /**
Kojto 110:165afa46840b 236 * @brief Enables write access to IWDG_PR and IWDG_RLR registers.
Kojto 110:165afa46840b 237 * @param __HANDLE__: IWDG handle
Kojto 110:165afa46840b 238 * @retval None
Kojto 110:165afa46840b 239 */
Kojto 110:165afa46840b 240 #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE)
Kojto 110:165afa46840b 241
Kojto 110:165afa46840b 242 /**
Kojto 110:165afa46840b 243 * @brief Disables write access to IWDG_PR and IWDG_RLR registers.
Kojto 110:165afa46840b 244 * @param __HANDLE__: IWDG handle
Kojto 110:165afa46840b 245 * @retval None
Kojto 110:165afa46840b 246 */
Kojto 110:165afa46840b 247 #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE)
Kojto 110:165afa46840b 248
Kojto 110:165afa46840b 249
Kojto 110:165afa46840b 250 #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \
Kojto 110:165afa46840b 251 ((__PRESCALER__) == IWDG_PRESCALER_8) || \
Kojto 110:165afa46840b 252 ((__PRESCALER__) == IWDG_PRESCALER_16) || \
Kojto 110:165afa46840b 253 ((__PRESCALER__) == IWDG_PRESCALER_32) || \
Kojto 110:165afa46840b 254 ((__PRESCALER__) == IWDG_PRESCALER_64) || \
Kojto 110:165afa46840b 255 ((__PRESCALER__) == IWDG_PRESCALER_128)|| \
Kojto 110:165afa46840b 256 ((__PRESCALER__) == IWDG_PRESCALER_256))
Kojto 110:165afa46840b 257
Kojto 110:165afa46840b 258
Kojto 110:165afa46840b 259 #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= 0xFFF)
Kojto 110:165afa46840b 260
Kojto 110:165afa46840b 261 /**
Kojto 110:165afa46840b 262 * @}
Kojto 110:165afa46840b 263 */
Kojto 110:165afa46840b 264
Kojto 110:165afa46840b 265 /* Private define ------------------------------------------------------------*/
Kojto 110:165afa46840b 266 /** @defgroup IWDG_Private_Constants IWDG Private Constants
Kojto 110:165afa46840b 267 * @{
Kojto 110:165afa46840b 268 */
Kojto 110:165afa46840b 269
Kojto 110:165afa46840b 270 /**
Kojto 110:165afa46840b 271 * @}
Kojto 110:165afa46840b 272 */
Kojto 110:165afa46840b 273
Kojto 110:165afa46840b 274 /**
Kojto 110:165afa46840b 275 * @}
Kojto 110:165afa46840b 276 */
Kojto 110:165afa46840b 277
Kojto 110:165afa46840b 278 /**
Kojto 110:165afa46840b 279 * @}
Kojto 110:165afa46840b 280 */
Kojto 110:165afa46840b 281
Kojto 110:165afa46840b 282 #ifdef __cplusplus
Kojto 110:165afa46840b 283 }
Kojto 110:165afa46840b 284 #endif
Kojto 110:165afa46840b 285
Kojto 110:165afa46840b 286 #endif /* __STM32F4xx_HAL_IWDG_H */
Kojto 110:165afa46840b 287
Kojto 110:165afa46840b 288 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/