Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
stm32l4xx_hal_iwdg.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_iwdg.h 00004 * @author MCD Application Team 00005 * @version V1.5.1 00006 * @date 31-May-2016 00007 * @brief Header file of IWDG HAL module. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© 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_IWDG_H 00040 #define __STM32L4xx_HAL_IWDG_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 /** @defgroup IWDG IWDG 00054 * @{ 00055 */ 00056 00057 /* Exported types ------------------------------------------------------------*/ 00058 /** @defgroup IWDG_Exported_Types IWDG Exported Types 00059 * @{ 00060 */ 00061 00062 /** 00063 * @brief IWDG Init structure definition 00064 */ 00065 typedef struct 00066 { 00067 uint32_t Prescaler; /*!< Select the prescaler of the IWDG. 00068 This parameter can be a value of @ref IWDG_Prescaler */ 00069 00070 uint32_t Reload; /*!< Specifies the IWDG down-counter reload value. 00071 This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ 00072 00073 uint32_t Window; /*!< Specifies the window value to be compared to the down-counter. 00074 This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ 00075 00076 } IWDG_InitTypeDef; 00077 00078 /** 00079 * @brief IWDG Handle Structure definition 00080 */ 00081 typedef struct 00082 { 00083 IWDG_TypeDef *Instance; /*!< Register base address */ 00084 00085 IWDG_InitTypeDef Init; /*!< IWDG required parameters */ 00086 00087 }IWDG_HandleTypeDef; 00088 00089 /** 00090 * @} 00091 */ 00092 00093 /* Exported constants --------------------------------------------------------*/ 00094 /** @defgroup IWDG_Exported_Constants IWDG Exported Constants 00095 * @{ 00096 */ 00097 00098 /** @defgroup IWDG_Prescaler IWDG Prescaler 00099 * @{ 00100 */ 00101 #define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */ 00102 #define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */ 00103 #define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */ 00104 #define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */ 00105 #define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */ 00106 #define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */ 00107 #define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */ 00108 /** 00109 * @} 00110 */ 00111 00112 /** @defgroup IWDG_Window_option IWDG Window option 00113 * @{ 00114 */ 00115 #define IWDG_WINDOW_DISABLE IWDG_WINR_WIN 00116 /** 00117 * @} 00118 */ 00119 00120 /** 00121 * @} 00122 */ 00123 00124 /* Exported macros -----------------------------------------------------------*/ 00125 /** @defgroup IWDG_Exported_Macros IWDG Exported Macros 00126 * @{ 00127 */ 00128 00129 /** 00130 * @brief Enable the IWDG peripheral. 00131 * @param __HANDLE__ IWDG handle 00132 * @retval None 00133 */ 00134 #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE) 00135 00136 /** 00137 * @brief Reload IWDG counter with value defined in the reload register 00138 * (write access to IWDG_PR, IWDG_RLR & IWDG_WINR registers disabled). 00139 * @param __HANDLE__ IWDG handle 00140 * @retval None 00141 */ 00142 #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) 00143 00144 /** 00145 * @} 00146 */ 00147 00148 /* Exported functions --------------------------------------------------------*/ 00149 /** @defgroup IWDG_Exported_Functions IWDG Exported Functions 00150 * @{ 00151 */ 00152 00153 /** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions 00154 * @{ 00155 */ 00156 /* Initialization/Start functions ********************************************/ 00157 HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); 00158 /** 00159 * @} 00160 */ 00161 00162 /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions 00163 * @{ 00164 */ 00165 /* I/O operation functions ****************************************************/ 00166 HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); 00167 /** 00168 * @} 00169 */ 00170 00171 /** 00172 * @} 00173 */ 00174 00175 /* Private constants ---------------------------------------------------------*/ 00176 /** @defgroup IWDG_Private_Constants IWDG Private Constants 00177 * @{ 00178 */ 00179 00180 /** 00181 * @brief IWDG Key Register BitMask 00182 */ 00183 #define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */ 00184 #define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */ 00185 #define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */ 00186 #define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */ 00187 00188 /** 00189 * @} 00190 */ 00191 00192 /* Private macros ------------------------------------------------------------*/ 00193 /** @defgroup IWDG_Private_Macros IWDG Private Macros 00194 * @{ 00195 */ 00196 00197 /** 00198 * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. 00199 * @param __HANDLE__ IWDG handle 00200 * @retval None 00201 */ 00202 #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE) 00203 00204 /** 00205 * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. 00206 * @param __HANDLE__ IWDG handle 00207 * @retval None 00208 */ 00209 #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE) 00210 00211 /** 00212 * @brief Check IWDG prescaler value. 00213 * @param __PRESCALER__ IWDG prescaler value 00214 * @retval None 00215 */ 00216 #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ 00217 ((__PRESCALER__) == IWDG_PRESCALER_8) || \ 00218 ((__PRESCALER__) == IWDG_PRESCALER_16) || \ 00219 ((__PRESCALER__) == IWDG_PRESCALER_32) || \ 00220 ((__PRESCALER__) == IWDG_PRESCALER_64) || \ 00221 ((__PRESCALER__) == IWDG_PRESCALER_128)|| \ 00222 ((__PRESCALER__) == IWDG_PRESCALER_256)) 00223 00224 /** 00225 * @brief Check IWDG reload value. 00226 * @param __RELOAD__ IWDG reload value 00227 * @retval None 00228 */ 00229 #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) 00230 00231 /** 00232 * @brief Check IWDG window value. 00233 * @param __WINDOW__ IWDG window value 00234 * @retval None 00235 */ 00236 #define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN) 00237 00238 /** 00239 * @} 00240 */ 00241 00242 /** 00243 * @} 00244 */ 00245 00246 /** 00247 * @} 00248 */ 00249 00250 00251 #ifdef __cplusplus 00252 } 00253 #endif 00254 00255 #endif /* __STM32L4xx_HAL_IWDG_H */ 00256 00257 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 10:59:58 by
