Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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