TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

Fork of TUKS-COURSE-TIMER by TUKS MCU Introductory course

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l4xx_hal_wwdg.h Source File

stm32l4xx_hal_wwdg.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_wwdg.h
00004   * @author  MCD Application Team
00005   * @version V1.5.1
00006   * @date    31-May-2016
00007   * @brief   Header file of WWDG HAL module.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00012   *
00013   * Redistribution and use in source and binary forms, with or without modification,
00014   * are permitted provided that the following conditions are met:
00015   *   1. Redistributions of source code must retain the above copyright notice,
00016   *      this list of conditions and the following disclaimer.
00017   *   2. Redistributions in binary form must reproduce the above copyright notice,
00018   *      this list of conditions and the following disclaimer in the documentation
00019   *      and/or other materials provided with the distribution.
00020   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00021   *      may be used to endorse or promote products derived from this software
00022   *      without specific prior written permission.
00023   *
00024   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00025   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00028   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00030   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00032   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034   *
00035   ******************************************************************************
00036   */
00037 
00038 /* Define to prevent recursive inclusion -------------------------------------*/
00039 #ifndef __STM32L4xx_HAL_WWDG_H
00040 #define __STM32L4xx_HAL_WWDG_H
00041 
00042 #ifdef __cplusplus
00043  extern "C" {
00044 #endif
00045 
00046 /* Includes ------------------------------------------------------------------*/
00047 #include "stm32l4xx_hal_def.h"
00048 
00049 /** @addtogroup STM32L4xx_HAL_Driver
00050   * @{
00051   */
00052 
00053 /** @addtogroup WWDG
00054   * @{
00055   */
00056 
00057 /* Exported types ------------------------------------------------------------*/
00058 
00059 /** @defgroup WWDG_Exported_Types WWDG Exported Types
00060   * @{
00061   */
00062 
00063 /** 
00064   * @brief  WWDG Init structure definition
00065   */
00066 typedef struct
00067 {
00068   uint32_t Prescaler;     /*!< Specifies the prescaler value of the WWDG.
00069                                This parameter can be a value of @ref WWDG_Prescaler */
00070 
00071   uint32_t Window;        /*!< Specifies the WWDG window value to be compared to the downcounter.
00072                                This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */
00073 
00074   uint32_t Counter;       /*!< Specifies the WWDG free-running downcounter  value.
00075                                This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */
00076 
00077   uint32_t EWIMode ;      /*!< Specifies if WWDG Early Wakeup Interupt is enable or not.
00078                                This parameter can be a value of @ref WWDG_EWI_Mode */
00079 
00080 }WWDG_InitTypeDef;
00081 
00082 /**
00083   * @brief  WWDG handle Structure definition
00084   */
00085 typedef struct
00086 {
00087   WWDG_TypeDef                 *Instance;  /*!< Register base address    */
00088 
00089   WWDG_InitTypeDef             Init;       /*!< WWDG required parameters */
00090 
00091 }WWDG_HandleTypeDef;
00092 /**
00093   * @}
00094   */
00095 
00096 /* Exported constants --------------------------------------------------------*/
00097 
00098 /** @defgroup WWDG_Exported_Constants WWDG Exported Constants
00099   * @{
00100   */
00101 
00102 /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition
00103   * @{
00104   */
00105 #define WWDG_IT_EWI                         WWDG_CFR_EWI  /*!< Early wakeup interrupt */
00106 /**
00107   * @}
00108   */
00109 
00110 /** @defgroup WWDG_Flag_definition WWDG Flag definition
00111   * @brief WWDG Flag definition
00112   * @{
00113   */
00114 #define WWDG_FLAG_EWIF                      WWDG_SR_EWIF  /*!< Early wakeup interrupt flag */
00115 /**
00116   * @}
00117   */
00118 
00119 /** @defgroup WWDG_Prescaler WWDG Prescaler
00120   * @{
00121   */
00122 #define WWDG_PRESCALER_1                    0x00000000u       /*!< WWDG counter clock = (PCLK1/4096)/1 */
00123 #define WWDG_PRESCALER_2                    WWDG_CFR_WDGTB_0  /*!< WWDG counter clock = (PCLK1/4096)/2 */
00124 #define WWDG_PRESCALER_4                    WWDG_CFR_WDGTB_1  /*!< WWDG counter clock = (PCLK1/4096)/4 */
00125 #define WWDG_PRESCALER_8                    WWDG_CFR_WDGTB    /*!< WWDG counter clock = (PCLK1/4096)/8 */
00126 /**
00127   * @}
00128   */
00129 
00130 /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode
00131   * @{
00132   */
00133 #define WWDG_EWI_DISABLE                    0x00000000u       /*!< EWI Disable */
00134 #define WWDG_EWI_ENABLE                     WWDG_CFR_EWI      /*!< EWI Enable */
00135 /**
00136   * @}
00137   */
00138 
00139 /**
00140   * @}
00141   */
00142 
00143 /* Private macros ------------------------------------------------------------*/
00144 
00145 /** @defgroup WWDG_Private_Macros WWDG Private Macros
00146   * @{
00147   */
00148 #define IS_WWDG_PRESCALER(__PRESCALER__)    (((__PRESCALER__) == WWDG_PRESCALER_1) || \
00149                                              ((__PRESCALER__) == WWDG_PRESCALER_2) || \
00150                                              ((__PRESCALER__) == WWDG_PRESCALER_4) || \
00151                                              ((__PRESCALER__) == WWDG_PRESCALER_8))
00152 
00153 #define IS_WWDG_WINDOW(__WINDOW__)          (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W))
00154 
00155 #define IS_WWDG_COUNTER(__COUNTER__)        (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T))
00156 
00157 #define IS_WWDG_EWI_MODE(__MODE__)          (((__MODE__) == WWDG_EWI_ENABLE) || \
00158                                              ((__MODE__) == WWDG_EWI_DISABLE))
00159 /**
00160   * @}
00161   */
00162 
00163 
00164 /* Exported macros ------------------------------------------------------------*/
00165 
00166 /** @defgroup WWDG_Exported_Macros WWDG Exported Macros
00167   * @{
00168   */
00169 
00170 /**
00171   * @brief  Enable the WWDG peripheral.
00172   * @param  __HANDLE__  WWDG handle
00173   * @retval None
00174   */
00175 #define __HAL_WWDG_ENABLE(__HANDLE__)                         SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA)
00176 
00177 /**
00178   * @brief  Enable the WWDG early wakeup interrupt.
00179   * @param  __HANDLE__: WWDG handle
00180   * @param  __INTERRUPT__  specifies the interrupt to enable.
00181   *         This parameter can be one of the following values:
00182   *            @arg WWDG_IT_EWI: Early wakeup interrupt
00183   * @note   Once enabled this interrupt cannot be disabled except by a system reset.
00184   * @retval None
00185   */
00186 #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__)       SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__))
00187 
00188 /**
00189   * @brief  Check whether the selected WWDG interrupt has occurred or not.
00190   * @param  __HANDLE__  WWDG handle
00191   * @param  __INTERRUPT__  specifies the it to check.
00192   *        This parameter can be one of the following values:
00193   *            @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT
00194   * @retval The new state of WWDG_FLAG (SET or RESET).
00195   */
00196 #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__)        __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__))
00197 
00198 /** @brief  Clear the WWDG interrupt pending bits.
00199   *         bits to clear the selected interrupt pending bits.
00200   * @param  __HANDLE__  WWDG handle
00201   * @param  __INTERRUPT__  specifies the interrupt pending bit to clear.
00202   *         This parameter can be one of the following values:
00203   *            @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
00204   */
00205 #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__)      __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__))
00206 
00207 /**
00208   * @brief  Check whether the specified WWDG flag is set or not.
00209   * @param  __HANDLE__  WWDG handle
00210   * @param  __FLAG__  specifies the flag to check.
00211   *         This parameter can be one of the following values:
00212   *            @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
00213   * @retval The new state of WWDG_FLAG (SET or RESET).
00214   */
00215 #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__)           (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
00216 
00217 /**
00218   * @brief  Clear the WWDG's pending flags.
00219   * @param  __HANDLE__  WWDG handle
00220   * @param  __FLAG__  specifies the flag to clear.
00221   *         This parameter can be one of the following values:
00222   *            @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag
00223   * @retval None
00224   */
00225 #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__)         ((__HANDLE__)->Instance->SR = ~(__FLAG__))
00226 
00227 /** @brief  Check whether the specified WWDG interrupt source is enabled or not.
00228   * @param  __HANDLE__  WWDG Handle.
00229   * @param  __INTERRUPT__  specifies the WWDG interrupt source to check.
00230   *         This parameter can be one of the following values:
00231   *            @arg WWDG_IT_EWI: Early Wakeup Interrupt
00232   * @retval state of __INTERRUPT__ (TRUE or FALSE).
00233   */
00234 #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__))
00235 
00236 /**
00237   * @}
00238   */
00239 
00240 /* Exported functions --------------------------------------------------------*/
00241 
00242 /** @addtogroup WWDG_Exported_Functions
00243   * @{
00244   */
00245 
00246 /** @addtogroup WWDG_Exported_Functions_Group1
00247   * @{
00248   */
00249 /* Initialization/de-initialization functions  **********************************/
00250 HAL_StatusTypeDef     HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg);
00251 void                  HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg);
00252 /**
00253   * @}
00254   */
00255 
00256 /** @addtogroup WWDG_Exported_Functions_Group2
00257   * @{
00258   */
00259 /* I/O operation functions ******************************************************/
00260 HAL_StatusTypeDef     HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg);
00261 void                  HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg);
00262 void                  HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg);
00263 /**
00264   * @}
00265   */
00266 
00267 /**
00268   * @}
00269   */
00270 
00271 /**
00272   * @}
00273   */
00274 
00275 /**
00276   * @}
00277   */
00278 
00279 #ifdef __cplusplus
00280 }
00281 #endif
00282 
00283 #endif /* __STM32L4xx_HAL_WWDG_H */
00284 
00285 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/