Hal Drivers for L4
Dependents: BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo
Fork of STM32L4xx_HAL_Driver by
Inc/stm32l4xx_ll_iwdg.h@2:7aef7655b0a8, 2015-11-25 (annotated)
- Committer:
- EricLew
- Date:
- Wed Nov 25 17:30:43 2015 +0000
- Revision:
- 2:7aef7655b0a8
- Parent:
- 0:80ee8f3b695e
commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:80ee8f3b695e | 1 | /** |
EricLew | 0:80ee8f3b695e | 2 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 3 | * @file stm32l4xx_ll_iwdg.h |
EricLew | 0:80ee8f3b695e | 4 | * @author MCD Application Team |
EricLew | 0:80ee8f3b695e | 5 | * @version V1.1.0 |
EricLew | 0:80ee8f3b695e | 6 | * @date 16-September-2015 |
EricLew | 0:80ee8f3b695e | 7 | * @brief Header file of IWDG LL module. |
EricLew | 0:80ee8f3b695e | 8 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 9 | * @attention |
EricLew | 0:80ee8f3b695e | 10 | * |
EricLew | 0:80ee8f3b695e | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:80ee8f3b695e | 12 | * |
EricLew | 0:80ee8f3b695e | 13 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:80ee8f3b695e | 14 | * are permitted provided that the following conditions are met: |
EricLew | 0:80ee8f3b695e | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:80ee8f3b695e | 16 | * this list of conditions and the following disclaimer. |
EricLew | 0:80ee8f3b695e | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:80ee8f3b695e | 18 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:80ee8f3b695e | 19 | * and/or other materials provided with the distribution. |
EricLew | 0:80ee8f3b695e | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:80ee8f3b695e | 21 | * may be used to endorse or promote products derived from this software |
EricLew | 0:80ee8f3b695e | 22 | * without specific prior written permission. |
EricLew | 0:80ee8f3b695e | 23 | * |
EricLew | 0:80ee8f3b695e | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:80ee8f3b695e | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:80ee8f3b695e | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:80ee8f3b695e | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:80ee8f3b695e | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:80ee8f3b695e | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:80ee8f3b695e | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:80ee8f3b695e | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:80ee8f3b695e | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:80ee8f3b695e | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:80ee8f3b695e | 34 | * |
EricLew | 0:80ee8f3b695e | 35 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 36 | */ |
EricLew | 0:80ee8f3b695e | 37 | |
EricLew | 0:80ee8f3b695e | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 39 | #ifndef __STM32L4xx_LL_IWDG_H |
EricLew | 0:80ee8f3b695e | 40 | #define __STM32L4xx_LL_IWDG_H |
EricLew | 0:80ee8f3b695e | 41 | |
EricLew | 0:80ee8f3b695e | 42 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 43 | extern "C" { |
EricLew | 0:80ee8f3b695e | 44 | #endif |
EricLew | 0:80ee8f3b695e | 45 | |
EricLew | 0:80ee8f3b695e | 46 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 47 | #include "stm32l4xx.h" |
EricLew | 0:80ee8f3b695e | 48 | |
EricLew | 0:80ee8f3b695e | 49 | /** @addtogroup STM32L4xx_LL_Driver |
EricLew | 0:80ee8f3b695e | 50 | * @{ |
EricLew | 0:80ee8f3b695e | 51 | */ |
EricLew | 0:80ee8f3b695e | 52 | |
EricLew | 0:80ee8f3b695e | 53 | #if defined(IWDG) |
EricLew | 0:80ee8f3b695e | 54 | |
EricLew | 0:80ee8f3b695e | 55 | /** @defgroup IWDG_LL IWDG |
EricLew | 0:80ee8f3b695e | 56 | * @{ |
EricLew | 0:80ee8f3b695e | 57 | */ |
EricLew | 0:80ee8f3b695e | 58 | |
EricLew | 0:80ee8f3b695e | 59 | /* Private types -------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 60 | /* Private variables ---------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 61 | |
EricLew | 0:80ee8f3b695e | 62 | /* Private constants ---------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 63 | /** @defgroup IWDG_LL_Private_Constants IWDG Private Constants |
EricLew | 0:80ee8f3b695e | 64 | * @{ |
EricLew | 0:80ee8f3b695e | 65 | */ |
EricLew | 0:80ee8f3b695e | 66 | |
EricLew | 0:80ee8f3b695e | 67 | #define LL_IWDG_KEY_RELOAD ((uint32_t)0x0000AAAA) /*!< IWDG Reload Counter Enable */ |
EricLew | 0:80ee8f3b695e | 68 | #define LL_IWDG_KEY_ENABLE ((uint32_t)0x0000CCCC) /*!< IWDG Peripheral Enable */ |
EricLew | 0:80ee8f3b695e | 69 | #define LL_IWDG_KEY_WR_ACCESS_ENABLE ((uint32_t)0x00005555) /*!< IWDG KR Write Access Enable */ |
EricLew | 0:80ee8f3b695e | 70 | #define LL_IWDG_KEY_WR_ACCESS_DISABLE ((uint32_t)0x00000000) /*!< IWDG KR Write Access Disable */ |
EricLew | 0:80ee8f3b695e | 71 | |
EricLew | 0:80ee8f3b695e | 72 | /** |
EricLew | 0:80ee8f3b695e | 73 | * @} |
EricLew | 0:80ee8f3b695e | 74 | */ |
EricLew | 0:80ee8f3b695e | 75 | |
EricLew | 0:80ee8f3b695e | 76 | /* Private macros ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 77 | |
EricLew | 0:80ee8f3b695e | 78 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 79 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 80 | /** @defgroup IWDG_LL_Exported_Constants IWDG Exported Constants |
EricLew | 0:80ee8f3b695e | 81 | * @{ |
EricLew | 0:80ee8f3b695e | 82 | */ |
EricLew | 0:80ee8f3b695e | 83 | |
EricLew | 0:80ee8f3b695e | 84 | /** @defgroup IWDG_LL_EC_GET_FLAG Get Flags Defines |
EricLew | 0:80ee8f3b695e | 85 | * @brief Flags defines which can be used with LL_IWDG_ReadReg function |
EricLew | 0:80ee8f3b695e | 86 | * @{ |
EricLew | 0:80ee8f3b695e | 87 | */ |
EricLew | 0:80ee8f3b695e | 88 | #define LL_IWDG_SR_PVU IWDG_SR_PVU |
EricLew | 0:80ee8f3b695e | 89 | #define LL_IWDG_SR_RVU IWDG_SR_RVU |
EricLew | 0:80ee8f3b695e | 90 | #define LL_IWDG_SR_WVU IWDG_SR_WVU |
EricLew | 0:80ee8f3b695e | 91 | |
EricLew | 0:80ee8f3b695e | 92 | /** |
EricLew | 0:80ee8f3b695e | 93 | * @} |
EricLew | 0:80ee8f3b695e | 94 | */ |
EricLew | 0:80ee8f3b695e | 95 | |
EricLew | 0:80ee8f3b695e | 96 | /** @defgroup IWDG_LL_EC_PRESCALER PRESCALER |
EricLew | 0:80ee8f3b695e | 97 | * @{ |
EricLew | 0:80ee8f3b695e | 98 | */ |
EricLew | 0:80ee8f3b695e | 99 | #define LL_IWDG_PRESCALER_4 ((uint32_t)0x00000000) /*!< Divider by 4 */ |
EricLew | 0:80ee8f3b695e | 100 | #define LL_IWDG_PRESCALER_8 (IWDG_PR_PR_0) /*!< Divider by 8 */ |
EricLew | 0:80ee8f3b695e | 101 | #define LL_IWDG_PRESCALER_16 (IWDG_PR_PR_1) /*!< Divider by 16 */ |
EricLew | 0:80ee8f3b695e | 102 | #define LL_IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< Divider by 32 */ |
EricLew | 0:80ee8f3b695e | 103 | #define LL_IWDG_PRESCALER_64 (IWDG_PR_PR_2) /*!< Divider by 64 */ |
EricLew | 0:80ee8f3b695e | 104 | #define LL_IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< Divider by 128 */ |
EricLew | 0:80ee8f3b695e | 105 | #define LL_IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< Divider by 256 */ |
EricLew | 0:80ee8f3b695e | 106 | /** |
EricLew | 0:80ee8f3b695e | 107 | * @} |
EricLew | 0:80ee8f3b695e | 108 | */ |
EricLew | 0:80ee8f3b695e | 109 | |
EricLew | 0:80ee8f3b695e | 110 | /** |
EricLew | 0:80ee8f3b695e | 111 | * @} |
EricLew | 0:80ee8f3b695e | 112 | */ |
EricLew | 0:80ee8f3b695e | 113 | |
EricLew | 0:80ee8f3b695e | 114 | /* Exported macro ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 115 | /** @defgroup IWDG_LL_Exported_Macros IWDG Exported Macros |
EricLew | 0:80ee8f3b695e | 116 | * @{ |
EricLew | 0:80ee8f3b695e | 117 | */ |
EricLew | 0:80ee8f3b695e | 118 | |
EricLew | 0:80ee8f3b695e | 119 | /** @defgroup IWDG_LL_EM_WRITE_READ Common Write and read registers Macros |
EricLew | 0:80ee8f3b695e | 120 | * @{ |
EricLew | 0:80ee8f3b695e | 121 | */ |
EricLew | 0:80ee8f3b695e | 122 | |
EricLew | 0:80ee8f3b695e | 123 | /** |
EricLew | 0:80ee8f3b695e | 124 | * @brief Write a value in IWDG register |
EricLew | 0:80ee8f3b695e | 125 | * @param __INSTANCE__ IWDG Instance |
EricLew | 0:80ee8f3b695e | 126 | * @param __REG__ Register to be written |
EricLew | 0:80ee8f3b695e | 127 | * @param __VALUE__ Value to be written in the register |
EricLew | 0:80ee8f3b695e | 128 | * @retval None |
EricLew | 0:80ee8f3b695e | 129 | */ |
EricLew | 0:80ee8f3b695e | 130 | #define LL_IWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
EricLew | 0:80ee8f3b695e | 131 | |
EricLew | 0:80ee8f3b695e | 132 | /** |
EricLew | 0:80ee8f3b695e | 133 | * @brief Read a value in IWDG register |
EricLew | 0:80ee8f3b695e | 134 | * @param __INSTANCE__ IWDG Instance |
EricLew | 0:80ee8f3b695e | 135 | * @param __REG__ Register to be read |
EricLew | 0:80ee8f3b695e | 136 | * @retval Register value |
EricLew | 0:80ee8f3b695e | 137 | */ |
EricLew | 0:80ee8f3b695e | 138 | #define LL_IWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
EricLew | 0:80ee8f3b695e | 139 | /** |
EricLew | 0:80ee8f3b695e | 140 | * @} |
EricLew | 0:80ee8f3b695e | 141 | */ |
EricLew | 0:80ee8f3b695e | 142 | |
EricLew | 0:80ee8f3b695e | 143 | /** |
EricLew | 0:80ee8f3b695e | 144 | * @} |
EricLew | 0:80ee8f3b695e | 145 | */ |
EricLew | 0:80ee8f3b695e | 146 | |
EricLew | 0:80ee8f3b695e | 147 | |
EricLew | 0:80ee8f3b695e | 148 | /* Exported functions --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 149 | /** @defgroup IWDG_LL_Exported_Functions IWDG Exported Functions |
EricLew | 0:80ee8f3b695e | 150 | * @{ |
EricLew | 0:80ee8f3b695e | 151 | */ |
EricLew | 0:80ee8f3b695e | 152 | /** @defgroup IWDG_LL_EF_Configuration Configuration |
EricLew | 0:80ee8f3b695e | 153 | * @{ |
EricLew | 0:80ee8f3b695e | 154 | */ |
EricLew | 0:80ee8f3b695e | 155 | |
EricLew | 0:80ee8f3b695e | 156 | /** |
EricLew | 0:80ee8f3b695e | 157 | * @brief Start the Independent Watchdog |
EricLew | 0:80ee8f3b695e | 158 | * @note Except if the hardware watchdog option is selected |
EricLew | 0:80ee8f3b695e | 159 | * @rmtoll KR KEY LL_IWDG_Enable |
EricLew | 0:80ee8f3b695e | 160 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 161 | * @retval None |
EricLew | 0:80ee8f3b695e | 162 | */ |
EricLew | 0:80ee8f3b695e | 163 | __STATIC_INLINE void LL_IWDG_Enable(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 164 | { |
EricLew | 0:80ee8f3b695e | 165 | WRITE_REG(IWDG->KR, LL_IWDG_KEY_ENABLE); |
EricLew | 0:80ee8f3b695e | 166 | } |
EricLew | 0:80ee8f3b695e | 167 | |
EricLew | 0:80ee8f3b695e | 168 | /** |
EricLew | 0:80ee8f3b695e | 169 | * @brief Reloads IWDG counter with value defined in the reload register |
EricLew | 0:80ee8f3b695e | 170 | * @rmtoll KR KEY LL_IWDG_ReloadCounter |
EricLew | 0:80ee8f3b695e | 171 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 172 | * @retval None |
EricLew | 0:80ee8f3b695e | 173 | */ |
EricLew | 0:80ee8f3b695e | 174 | __STATIC_INLINE void LL_IWDG_ReloadCounter(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 175 | { |
EricLew | 0:80ee8f3b695e | 176 | WRITE_REG(IWDG->KR, LL_IWDG_KEY_RELOAD); |
EricLew | 0:80ee8f3b695e | 177 | } |
EricLew | 0:80ee8f3b695e | 178 | |
EricLew | 0:80ee8f3b695e | 179 | /** |
EricLew | 0:80ee8f3b695e | 180 | * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers |
EricLew | 0:80ee8f3b695e | 181 | * @rmtoll KR KEY LL_IWDG_EnableWriteAccess |
EricLew | 0:80ee8f3b695e | 182 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 183 | * @retval None |
EricLew | 0:80ee8f3b695e | 184 | */ |
EricLew | 0:80ee8f3b695e | 185 | __STATIC_INLINE void LL_IWDG_EnableWriteAccess(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 186 | { |
EricLew | 0:80ee8f3b695e | 187 | WRITE_REG(IWDG->KR, LL_IWDG_KEY_WR_ACCESS_ENABLE); |
EricLew | 0:80ee8f3b695e | 188 | } |
EricLew | 0:80ee8f3b695e | 189 | |
EricLew | 0:80ee8f3b695e | 190 | /** |
EricLew | 0:80ee8f3b695e | 191 | * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers |
EricLew | 0:80ee8f3b695e | 192 | * @rmtoll KR KEY LL_IWDG_DisableWriteAccess |
EricLew | 0:80ee8f3b695e | 193 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 194 | * @retval None |
EricLew | 0:80ee8f3b695e | 195 | */ |
EricLew | 0:80ee8f3b695e | 196 | __STATIC_INLINE void LL_IWDG_DisableWriteAccess(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 197 | { |
EricLew | 0:80ee8f3b695e | 198 | WRITE_REG(IWDG->KR, LL_IWDG_KEY_WR_ACCESS_DISABLE); |
EricLew | 0:80ee8f3b695e | 199 | } |
EricLew | 0:80ee8f3b695e | 200 | |
EricLew | 0:80ee8f3b695e | 201 | /** |
EricLew | 0:80ee8f3b695e | 202 | * @brief Select the prescaler of the IWDG |
EricLew | 0:80ee8f3b695e | 203 | * @rmtoll PR PR LL_IWDG_SetPrescaler |
EricLew | 0:80ee8f3b695e | 204 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 205 | * @param Prescaler This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 206 | * @arg @ref LL_IWDG_PRESCALER_4 |
EricLew | 0:80ee8f3b695e | 207 | * @arg @ref LL_IWDG_PRESCALER_8 |
EricLew | 0:80ee8f3b695e | 208 | * @arg @ref LL_IWDG_PRESCALER_16 |
EricLew | 0:80ee8f3b695e | 209 | * @arg @ref LL_IWDG_PRESCALER_32 |
EricLew | 0:80ee8f3b695e | 210 | * @arg @ref LL_IWDG_PRESCALER_64 |
EricLew | 0:80ee8f3b695e | 211 | * @arg @ref LL_IWDG_PRESCALER_128 |
EricLew | 0:80ee8f3b695e | 212 | * @arg @ref LL_IWDG_PRESCALER_256 |
EricLew | 0:80ee8f3b695e | 213 | * @retval None |
EricLew | 0:80ee8f3b695e | 214 | */ |
EricLew | 0:80ee8f3b695e | 215 | __STATIC_INLINE void LL_IWDG_SetPrescaler(IWDG_TypeDef *IWDGx, uint32_t Prescaler) |
EricLew | 0:80ee8f3b695e | 216 | { |
EricLew | 0:80ee8f3b695e | 217 | WRITE_REG(IWDGx->PR, IWDG_PR_PR & Prescaler); |
EricLew | 0:80ee8f3b695e | 218 | } |
EricLew | 0:80ee8f3b695e | 219 | |
EricLew | 0:80ee8f3b695e | 220 | /** |
EricLew | 0:80ee8f3b695e | 221 | * @brief Get the selected prescaler of the IWDG |
EricLew | 0:80ee8f3b695e | 222 | * @rmtoll PR PR LL_IWDG_GetPrescaler |
EricLew | 0:80ee8f3b695e | 223 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 224 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 225 | * @arg @ref LL_IWDG_PRESCALER_4 |
EricLew | 0:80ee8f3b695e | 226 | * @arg @ref LL_IWDG_PRESCALER_8 |
EricLew | 0:80ee8f3b695e | 227 | * @arg @ref LL_IWDG_PRESCALER_16 |
EricLew | 0:80ee8f3b695e | 228 | * @arg @ref LL_IWDG_PRESCALER_32 |
EricLew | 0:80ee8f3b695e | 229 | * @arg @ref LL_IWDG_PRESCALER_64 |
EricLew | 0:80ee8f3b695e | 230 | * @arg @ref LL_IWDG_PRESCALER_128 |
EricLew | 0:80ee8f3b695e | 231 | * @arg @ref LL_IWDG_PRESCALER_256 |
EricLew | 0:80ee8f3b695e | 232 | */ |
EricLew | 0:80ee8f3b695e | 233 | __STATIC_INLINE uint32_t LL_IWDG_GetPrescaler(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 234 | { |
EricLew | 0:80ee8f3b695e | 235 | return (uint32_t)(READ_REG(IWDGx->PR)); |
EricLew | 0:80ee8f3b695e | 236 | } |
EricLew | 0:80ee8f3b695e | 237 | |
EricLew | 0:80ee8f3b695e | 238 | /** |
EricLew | 0:80ee8f3b695e | 239 | * @brief Specifies the IWDG down-counter reload value |
EricLew | 0:80ee8f3b695e | 240 | * @rmtoll RLR RL LL_IWDG_SetReloadCounter |
EricLew | 0:80ee8f3b695e | 241 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 242 | * @param Counter 0..0x0FFF |
EricLew | 0:80ee8f3b695e | 243 | * @retval None |
EricLew | 0:80ee8f3b695e | 244 | */ |
EricLew | 0:80ee8f3b695e | 245 | __STATIC_INLINE void LL_IWDG_SetReloadCounter(IWDG_TypeDef *IWDGx, uint32_t Counter) |
EricLew | 0:80ee8f3b695e | 246 | { |
EricLew | 0:80ee8f3b695e | 247 | WRITE_REG(IWDGx->RLR, IWDG_RLR_RL & Counter); |
EricLew | 0:80ee8f3b695e | 248 | } |
EricLew | 0:80ee8f3b695e | 249 | |
EricLew | 0:80ee8f3b695e | 250 | /** |
EricLew | 0:80ee8f3b695e | 251 | * @brief Get the specified IWDG down-counter reload value |
EricLew | 0:80ee8f3b695e | 252 | * @rmtoll RLR RL LL_IWDG_GetReloadCounter |
EricLew | 0:80ee8f3b695e | 253 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 254 | * @retval 0..0x0FFF |
EricLew | 0:80ee8f3b695e | 255 | */ |
EricLew | 0:80ee8f3b695e | 256 | __STATIC_INLINE uint32_t LL_IWDG_GetReloadCounter(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 257 | { |
EricLew | 0:80ee8f3b695e | 258 | return (uint32_t)(READ_REG(IWDGx->RLR)); |
EricLew | 0:80ee8f3b695e | 259 | } |
EricLew | 0:80ee8f3b695e | 260 | |
EricLew | 0:80ee8f3b695e | 261 | /** |
EricLew | 0:80ee8f3b695e | 262 | * @brief Specifies high limit of the window value to be compared to the down-counter. |
EricLew | 0:80ee8f3b695e | 263 | * @rmtoll WINR WIN LL_IWDG_SetWindow |
EricLew | 0:80ee8f3b695e | 264 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 265 | * @param Window 0..0x0FFF |
EricLew | 0:80ee8f3b695e | 266 | * @retval None |
EricLew | 0:80ee8f3b695e | 267 | */ |
EricLew | 0:80ee8f3b695e | 268 | __STATIC_INLINE void LL_IWDG_SetWindow(IWDG_TypeDef *IWDGx, uint32_t Window) |
EricLew | 0:80ee8f3b695e | 269 | { |
EricLew | 0:80ee8f3b695e | 270 | WRITE_REG(IWDGx->WINR, IWDG_WINR_WIN & Window); |
EricLew | 0:80ee8f3b695e | 271 | } |
EricLew | 0:80ee8f3b695e | 272 | |
EricLew | 0:80ee8f3b695e | 273 | /** |
EricLew | 0:80ee8f3b695e | 274 | * @brief Get the high limit of the window value specified. |
EricLew | 0:80ee8f3b695e | 275 | * @rmtoll WINR WIN LL_IWDG_GetWindow |
EricLew | 0:80ee8f3b695e | 276 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 277 | * @retval 0..0x0FFF |
EricLew | 0:80ee8f3b695e | 278 | */ |
EricLew | 0:80ee8f3b695e | 279 | __STATIC_INLINE uint32_t LL_IWDG_GetWindow(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 280 | { |
EricLew | 0:80ee8f3b695e | 281 | return (uint32_t)(READ_REG(IWDGx->WINR)); |
EricLew | 0:80ee8f3b695e | 282 | } |
EricLew | 0:80ee8f3b695e | 283 | |
EricLew | 0:80ee8f3b695e | 284 | /** |
EricLew | 0:80ee8f3b695e | 285 | * @} |
EricLew | 0:80ee8f3b695e | 286 | */ |
EricLew | 0:80ee8f3b695e | 287 | |
EricLew | 0:80ee8f3b695e | 288 | /** @defgroup IWDG_LL_EF_FLAG_Management FLAG_Management |
EricLew | 0:80ee8f3b695e | 289 | * @{ |
EricLew | 0:80ee8f3b695e | 290 | */ |
EricLew | 0:80ee8f3b695e | 291 | |
EricLew | 0:80ee8f3b695e | 292 | /** |
EricLew | 0:80ee8f3b695e | 293 | * @brief Check if flag Prescaler Value Update is set or not |
EricLew | 0:80ee8f3b695e | 294 | * @rmtoll SR PVU LL_IWDG_IsActiveFlag_PVU |
EricLew | 0:80ee8f3b695e | 295 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 296 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 297 | */ |
EricLew | 0:80ee8f3b695e | 298 | __STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_PVU(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 299 | { |
EricLew | 0:80ee8f3b695e | 300 | return (READ_BIT(IWDGx->SR, IWDG_SR_PVU) == (IWDG_SR_PVU)); |
EricLew | 0:80ee8f3b695e | 301 | } |
EricLew | 0:80ee8f3b695e | 302 | |
EricLew | 0:80ee8f3b695e | 303 | /** |
EricLew | 0:80ee8f3b695e | 304 | * @brief Check if flag Reload Value Update is set or not |
EricLew | 0:80ee8f3b695e | 305 | * @rmtoll SR RVU LL_IWDG_IsActiveFlag_RVU |
EricLew | 0:80ee8f3b695e | 306 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 307 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 308 | */ |
EricLew | 0:80ee8f3b695e | 309 | __STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_RVU(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 310 | { |
EricLew | 0:80ee8f3b695e | 311 | return (READ_BIT(IWDGx->SR, IWDG_SR_RVU) == (IWDG_SR_RVU)); |
EricLew | 0:80ee8f3b695e | 312 | } |
EricLew | 0:80ee8f3b695e | 313 | |
EricLew | 0:80ee8f3b695e | 314 | /** |
EricLew | 0:80ee8f3b695e | 315 | * @brief Check if flag Window Value Update is set or not |
EricLew | 0:80ee8f3b695e | 316 | * @rmtoll SR WVU LL_IWDG_IsActiveFlag_WVU |
EricLew | 0:80ee8f3b695e | 317 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 318 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 319 | */ |
EricLew | 0:80ee8f3b695e | 320 | __STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_WVU(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 321 | { |
EricLew | 0:80ee8f3b695e | 322 | return (READ_BIT(IWDGx->SR, IWDG_SR_WVU) == (IWDG_SR_WVU)); |
EricLew | 0:80ee8f3b695e | 323 | } |
EricLew | 0:80ee8f3b695e | 324 | |
EricLew | 0:80ee8f3b695e | 325 | /** |
EricLew | 0:80ee8f3b695e | 326 | * @brief Check if all flags Prescaler, Reload & Window Value Update are reset or not |
EricLew | 0:80ee8f3b695e | 327 | * @rmtoll SR PVU LL_IWDG_IsReady\n |
EricLew | 0:80ee8f3b695e | 328 | * SR WVU LL_IWDG_IsReady\n |
EricLew | 0:80ee8f3b695e | 329 | * SR RVU LL_IWDG_IsReady |
EricLew | 0:80ee8f3b695e | 330 | * @param IWDGx IWDG Instance |
EricLew | 0:80ee8f3b695e | 331 | * @retval State of bits (1 or 0). |
EricLew | 0:80ee8f3b695e | 332 | */ |
EricLew | 0:80ee8f3b695e | 333 | __STATIC_INLINE uint32_t LL_IWDG_IsReady(IWDG_TypeDef *IWDGx) |
EricLew | 0:80ee8f3b695e | 334 | { |
EricLew | 0:80ee8f3b695e | 335 | return (READ_BIT(IWDGx->SR, IWDG_SR_PVU | IWDG_SR_RVU | IWDG_SR_WVU) == 0); |
EricLew | 0:80ee8f3b695e | 336 | } |
EricLew | 0:80ee8f3b695e | 337 | |
EricLew | 0:80ee8f3b695e | 338 | /** |
EricLew | 0:80ee8f3b695e | 339 | * @} |
EricLew | 0:80ee8f3b695e | 340 | */ |
EricLew | 0:80ee8f3b695e | 341 | |
EricLew | 0:80ee8f3b695e | 342 | |
EricLew | 0:80ee8f3b695e | 343 | /** |
EricLew | 0:80ee8f3b695e | 344 | * @} |
EricLew | 0:80ee8f3b695e | 345 | */ |
EricLew | 0:80ee8f3b695e | 346 | |
EricLew | 0:80ee8f3b695e | 347 | /** |
EricLew | 0:80ee8f3b695e | 348 | * @} |
EricLew | 0:80ee8f3b695e | 349 | */ |
EricLew | 0:80ee8f3b695e | 350 | |
EricLew | 0:80ee8f3b695e | 351 | #endif /* IWDG) */ |
EricLew | 0:80ee8f3b695e | 352 | |
EricLew | 0:80ee8f3b695e | 353 | /** |
EricLew | 0:80ee8f3b695e | 354 | * @} |
EricLew | 0:80ee8f3b695e | 355 | */ |
EricLew | 0:80ee8f3b695e | 356 | |
EricLew | 0:80ee8f3b695e | 357 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 358 | } |
EricLew | 0:80ee8f3b695e | 359 | #endif |
EricLew | 0:80ee8f3b695e | 360 | |
EricLew | 0:80ee8f3b695e | 361 | #endif /* __STM32L4xx_LL_IWDG_H */ |
EricLew | 0:80ee8f3b695e | 362 | |
EricLew | 0:80ee8f3b695e | 363 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:80ee8f3b695e | 364 |