STM32G474xx HAL用户手册
stm32g4xx_hal_wwdg.h
转至该文件的文档。
00001 /**
00002   ******************************************************************************
00003   * @file    stm32g4xx_hal_wwdg.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of WWDG HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2019 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32G4xx_HAL_WWDG_H
00021 #define STM32G4xx_HAL_WWDG_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32g4xx_hal_def.h"
00029 
00030 /** @addtogroup STM32G4xx_HAL_Driver
00031   * @{
00032   */
00033 
00034 /** @addtogroup WWDG
00035   * @{
00036   */
00037 
00038 /* Exported types ------------------------------------------------------------*/
00039 
00040 /** @defgroup WWDG_Exported_Types WWDG Exported Types
00041   * @{
00042   */
00043 
00044 /**
00045   * @brief  WWDG Init structure definition
00046   */
00047 typedef struct
00048 {
00049   uint32_t Prescaler;     /*!< Specifies the prescaler value of the WWDG.
00050                                This parameter can be a value of @ref WWDG_Prescaler */
00051 
00052   uint32_t Window;        /*!< Specifies the WWDG window value to be compared to the downcounter.
00053                                This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */
00054 
00055   uint32_t Counter;       /*!< Specifies the WWDG free-running downcounter  value.
00056                                This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */
00057 
00058   uint32_t EWIMode ;      /*!< Specifies if WWDG Early Wakeup Interrupt is enable or not.
00059                                This parameter can be a value of @ref WWDG_EWI_Mode */
00060 
00061 } WWDG_InitTypeDef;
00062 
00063 /**
00064   * @brief  WWDG handle Structure definition
00065   */
00066 #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
00067 typedef struct __WWDG_HandleTypeDef
00068 #else
00069 typedef struct
00070 #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */
00071 {
00072   WWDG_TypeDef      *Instance;  /*!< Register base address */
00073 
00074   WWDG_InitTypeDef  Init;       /*!< WWDG required parameters */
00075 
00076 #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
00077   void (* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg);                  /*!< WWDG Early WakeUp Interrupt callback */
00078 
00079   void (* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg);              /*!< WWDG Msp Init callback */
00080 #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */
00081 } WWDG_HandleTypeDef;
00082 
00083 #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
00084 /**
00085   * @brief  HAL WWDG common Callback ID enumeration definition
00086   */
00087 typedef enum
00088 {
00089   HAL_WWDG_EWI_CB_ID          = 0x00U,    /*!< WWDG EWI callback ID */
00090   HAL_WWDG_MSPINIT_CB_ID      = 0x01U,    /*!< WWDG MspInit callback ID */
00091 } HAL_WWDG_CallbackIDTypeDef;
00092 
00093 /**
00094   * @brief  HAL WWDG Callback pointer definition
00095   */
00096 typedef void (*pWWDG_CallbackTypeDef)(WWDG_HandleTypeDef *hppp);  /*!< pointer to a WWDG common callback functions */
00097 
00098 #endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */
00099 /**
00100   * @}
00101   */
00102 
00103 /* Exported constants --------------------------------------------------------*/
00104 
00105 /** @defgroup WWDG_Exported_Constants WWDG Exported Constants
00106   * @{
00107   */
00108 
00109 /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition
00110   * @{
00111   */
00112 #define WWDG_IT_EWI                         WWDG_CFR_EWI  /*!< Early wakeup interrupt */
00113 /**
00114   * @}
00115   */
00116 
00117 /** @defgroup WWDG_Flag_definition WWDG Flag definition
00118   * @brief WWDG Flag definition
00119   * @{
00120   */
00121 #define WWDG_FLAG_EWIF                      WWDG_SR_EWIF  /*!< Early wakeup interrupt flag */
00122 /**
00123   * @}
00124   */
00125 
00126 /** @defgroup WWDG_Prescaler WWDG Prescaler
00127   * @{
00128   */
00129 #define WWDG_PRESCALER_1                    0x00000000u                              /*!< WWDG counter clock = (PCLK1/4096)/1 */
00130 #define WWDG_PRESCALER_2                    WWDG_CFR_WDGTB_0                         /*!< WWDG counter clock = (PCLK1/4096)/2 */
00131 #define WWDG_PRESCALER_4                    WWDG_CFR_WDGTB_1                         /*!< WWDG counter clock = (PCLK1/4096)/4 */
00132 #define WWDG_PRESCALER_8                    (WWDG_CFR_WDGTB_1 | WWDG_CFR_WDGTB_0)    /*!< WWDG counter clock = (PCLK1/4096)/8 */
00133 #define WWDG_PRESCALER_16                   WWDG_CFR_WDGTB_2                         /*!< WWDG counter clock = (PCLK1/4096)/16 */
00134 #define WWDG_PRESCALER_32                   (WWDG_CFR_WDGTB_2 | WWDG_CFR_WDGTB_0)    /*!< WWDG counter clock = (PCLK1/4096)/32 */
00135 #define WWDG_PRESCALER_64                   (WWDG_CFR_WDGTB_2 | WWDG_CFR_WDGTB_1)    /*!< WWDG counter clock = (PCLK1/4096)/64 */
00136 #define WWDG_PRESCALER_128                  WWDG_CFR_WDGTB                           /*!< WWDG counter clock = (PCLK1/4096)/128 */
00137 /**
00138   * @}
00139   */
00140 
00141 /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode
00142   * @{
00143   */
00144 #define WWDG_EWI_DISABLE                    0x00000000u       /*!< EWI Disable */
00145 #define WWDG_EWI_ENABLE                     WWDG_CFR_EWI      /*!< EWI Enable */
00146 /**
00147   * @}
00148   */
00149 
00150 /**
00151   * @}
00152   */
00153 
00154 /* Private macros ------------------------------------------------------------*/
00155 
00156 /** @defgroup WWDG_Private_Macros WWDG Private Macros
00157   * @{
00158   */
00159 #define IS_WWDG_PRESCALER(__PRESCALER__)    (((__PRESCALER__) == WWDG_PRESCALER_1)  || \
00160                                              ((__PRESCALER__) == WWDG_PRESCALER_2)  || \
00161                                              ((__PRESCALER__) == WWDG_PRESCALER_4)  || \
00162                                              ((__PRESCALER__) == WWDG_PRESCALER_8)  || \
00163                                              ((__PRESCALER__) == WWDG_PRESCALER_16) || \
00164                                              ((__PRESCALER__) == WWDG_PRESCALER_32) || \
00165                                              ((__PRESCALER__) == WWDG_PRESCALER_64) || \
00166                                              ((__PRESCALER__) == WWDG_PRESCALER_128))
00167 
00168 #define IS_WWDG_WINDOW(__WINDOW__)          (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W))
00169 
00170 #define IS_WWDG_COUNTER(__COUNTER__)        (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T))
00171 
00172 #define IS_WWDG_EWI_MODE(__MODE__)          (((__MODE__) == WWDG_EWI_ENABLE) || \
00173                                              ((__MODE__) == WWDG_EWI_DISABLE))
00174 /**
00175   * @}
00176   */
00177 
00178 
00179 /* Exported macros ------------------------------------------------------------*/
00180