mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
184:08ed48f1de7f
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file stm32l1xx_ll_wwdg.h
<> 149:156823d33999 4 * @author MCD Application Team
<> 149:156823d33999 5 * @version V1.2.0
<> 149:156823d33999 6 * @date 01-July-2016
<> 149:156823d33999 7 * @brief Header file of WWDG LL module.
<> 149:156823d33999 8 ******************************************************************************
<> 149:156823d33999 9 * @attention
<> 149:156823d33999 10 *
<> 149:156823d33999 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 149:156823d33999 12 *
<> 149:156823d33999 13 * Redistribution and use in source and binary forms, with or without modification,
<> 149:156823d33999 14 * are permitted provided that the following conditions are met:
<> 149:156823d33999 15 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 16 * this list of conditions and the following disclaimer.
<> 149:156823d33999 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 18 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 19 * and/or other materials provided with the distribution.
<> 149:156823d33999 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 21 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 22 * without specific prior written permission.
<> 149:156823d33999 23 *
<> 149:156823d33999 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 34 *
<> 149:156823d33999 35 ******************************************************************************
<> 149:156823d33999 36 */
<> 149:156823d33999 37
<> 149:156823d33999 38 /* Define to prevent recursive inclusion -------------------------------------*/
<> 149:156823d33999 39 #ifndef __STM32L1xx_LL_WWDG_H
<> 149:156823d33999 40 #define __STM32L1xx_LL_WWDG_H
<> 149:156823d33999 41
<> 149:156823d33999 42 #ifdef __cplusplus
<> 149:156823d33999 43 extern "C" {
<> 149:156823d33999 44 #endif
<> 149:156823d33999 45
<> 149:156823d33999 46 /* Includes ------------------------------------------------------------------*/
<> 149:156823d33999 47 #include "stm32l1xx.h"
<> 149:156823d33999 48
<> 149:156823d33999 49 /** @addtogroup STM32L1xx_LL_Driver
<> 149:156823d33999 50 * @{
<> 149:156823d33999 51 */
<> 149:156823d33999 52
<> 149:156823d33999 53 #if defined (WWDG)
<> 149:156823d33999 54
<> 149:156823d33999 55 /** @defgroup WWDG_LL WWDG
<> 149:156823d33999 56 * @{
<> 149:156823d33999 57 */
<> 149:156823d33999 58
<> 149:156823d33999 59 /* Private types -------------------------------------------------------------*/
<> 149:156823d33999 60 /* Private variables ---------------------------------------------------------*/
<> 149:156823d33999 61
<> 149:156823d33999 62 /* Private constants ---------------------------------------------------------*/
<> 149:156823d33999 63
<> 149:156823d33999 64 /* Private macros ------------------------------------------------------------*/
<> 149:156823d33999 65
<> 149:156823d33999 66 /* Exported types ------------------------------------------------------------*/
<> 149:156823d33999 67 /* Exported constants --------------------------------------------------------*/
<> 149:156823d33999 68 /** @defgroup WWDG_LL_Exported_Constants WWDG Exported Constants
<> 149:156823d33999 69 * @{
<> 149:156823d33999 70 */
<> 149:156823d33999 71
<> 149:156823d33999 72
<> 149:156823d33999 73 /** @defgroup WWDG_LL_EC_IT IT Defines
<> 149:156823d33999 74 * @brief IT defines which can be used with LL_WWDG_ReadReg and LL_WWDG_WriteReg functions
<> 149:156823d33999 75 * @{
<> 149:156823d33999 76 */
<> 149:156823d33999 77 #define LL_WWDG_CFR_EWI WWDG_CFR_EWI
<> 149:156823d33999 78 /**
<> 149:156823d33999 79 * @}
<> 149:156823d33999 80 */
<> 149:156823d33999 81
<> 149:156823d33999 82 /** @defgroup WWDG_LL_EC_PRESCALER PRESCALER
<> 149:156823d33999 83 * @{
<> 149:156823d33999 84 */
<> 149:156823d33999 85 #define LL_WWDG_PRESCALER_1 (uint32_t)0x00000000U /*!< WWDG counter clock = (PCLK1/4096)/1 */
<> 149:156823d33999 86 #define LL_WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */
<> 149:156823d33999 87 #define LL_WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */
<> 149:156823d33999 88 #define LL_WWDG_PRESCALER_8 (WWDG_CFR_WDGTB_0 | WWDG_CFR_WDGTB_1) /*!< WWDG counter clock = (PCLK1/4096)/8 */
<> 149:156823d33999 89 /**
<> 149:156823d33999 90 * @}
<> 149:156823d33999 91 */
<> 149:156823d33999 92
<> 149:156823d33999 93 /**
<> 149:156823d33999 94 * @}
<> 149:156823d33999 95 */
<> 149:156823d33999 96
<> 149:156823d33999 97 /* Exported macro ------------------------------------------------------------*/
<> 149:156823d33999 98 /** @defgroup WWDG_LL_Exported_Macros WWDG Exported Macros
<> 149:156823d33999 99 * @{
<> 149:156823d33999 100 */
<> 149:156823d33999 101 /** @defgroup WWDG_LL_EM_WRITE_READ Common Write and read registers macros
<> 149:156823d33999 102 * @{
<> 149:156823d33999 103 */
<> 149:156823d33999 104 /**
<> 149:156823d33999 105 * @brief Write a value in WWDG register
<> 149:156823d33999 106 * @param __INSTANCE__ WWDG Instance
<> 149:156823d33999 107 * @param __REG__ Register to be written
<> 149:156823d33999 108 * @param __VALUE__ Value to be written in the register
<> 149:156823d33999 109 * @retval None
<> 149:156823d33999 110 */
<> 149:156823d33999 111 #define LL_WWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
<> 149:156823d33999 112
<> 149:156823d33999 113 /**
<> 149:156823d33999 114 * @brief Read a value in WWDG register
<> 149:156823d33999 115 * @param __INSTANCE__ WWDG Instance
<> 149:156823d33999 116 * @param __REG__ Register to be read
<> 149:156823d33999 117 * @retval Register value
<> 149:156823d33999 118 */
<> 149:156823d33999 119 #define LL_WWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
<> 149:156823d33999 120 /**
<> 149:156823d33999 121 * @}
<> 149:156823d33999 122 */
<> 149:156823d33999 123
<> 149:156823d33999 124
<> 149:156823d33999 125 /**
<> 149:156823d33999 126 * @}
<> 149:156823d33999 127 */
<> 149:156823d33999 128
<> 149:156823d33999 129 /* Exported functions --------------------------------------------------------*/
<> 149:156823d33999 130 /** @defgroup WWDG_LL_Exported_Functions WWDG Exported Functions
<> 149:156823d33999 131 * @{
<> 149:156823d33999 132 */
<> 149:156823d33999 133
<> 149:156823d33999 134 /** @defgroup WWDG_LL_EF_Configuration Configuration
<> 149:156823d33999 135 * @{
<> 149:156823d33999 136 */
<> 149:156823d33999 137 /**
<> 149:156823d33999 138 * @brief Enable Window Watchdog. The watchdog is always disabled after a reset.
<> 149:156823d33999 139 * @note It is enabled by setting the WDGA bit in the WWDG_CR register,
<> 149:156823d33999 140 * then it cannot be disabled again except by a reset.
<> 149:156823d33999 141 * This bit is set by software and only cleared by hardware after a reset.
<> 149:156823d33999 142 * When WDGA = 1, the watchdog can generate a reset.
<> 149:156823d33999 143 * @rmtoll CR WDGA LL_WWDG_Enable
<> 149:156823d33999 144 * @param WWDGx WWDG Instance
<> 149:156823d33999 145 * @retval None
<> 149:156823d33999 146 */
<> 149:156823d33999 147 __STATIC_INLINE void LL_WWDG_Enable(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 148 {
<> 149:156823d33999 149 SET_BIT(WWDGx->CR, WWDG_CR_WDGA);
<> 149:156823d33999 150 }
<> 149:156823d33999 151
<> 149:156823d33999 152 /**
<> 149:156823d33999 153 * @brief Checks if Window Watchdog is enabled
<> 149:156823d33999 154 * @rmtoll CR WDGA LL_WWDG_IsEnabled
<> 149:156823d33999 155 * @param WWDGx WWDG Instance
<> 149:156823d33999 156 * @retval State of bit (1 or 0).
<> 149:156823d33999 157 */
<> 149:156823d33999 158 __STATIC_INLINE uint32_t LL_WWDG_IsEnabled(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 159 {
<> 149:156823d33999 160 return (READ_BIT(WWDGx->CR, WWDG_CR_WDGA) == (WWDG_CR_WDGA));
<> 149:156823d33999 161 }
<> 149:156823d33999 162
<> 149:156823d33999 163 /**
<> 149:156823d33999 164 * @brief Set the Watchdog counter value to provided value (7-bits T[6:0])
<> 149:156823d33999 165 * @note When writing to the WWDG_CR register, always write 1 in the MSB b6 to avoid generating an immediate reset
<> 149:156823d33999 166 * This counter is decremented every (4096 x 2expWDGTB) PCLK cycles
<> 149:156823d33999 167 * A reset is produced when it rolls over from 0x40 to 0x3F (bit T6 becomes cleared)
<> 149:156823d33999 168 * Setting the counter lower then 0x40 causes an immediate reset (if WWDG enabled)
<> 149:156823d33999 169 * @rmtoll CR T LL_WWDG_SetCounter
<> 149:156823d33999 170 * @param WWDGx WWDG Instance
<> 149:156823d33999 171 * @param Counter 0..0x7F (7 bit counter value)
<> 149:156823d33999 172 * @retval None
<> 149:156823d33999 173 */
<> 149:156823d33999 174 __STATIC_INLINE void LL_WWDG_SetCounter(WWDG_TypeDef *WWDGx, uint32_t Counter)
<> 149:156823d33999 175 {
<> 149:156823d33999 176 MODIFY_REG(WWDGx->CR, WWDG_CR_T, Counter);
<> 149:156823d33999 177 }
<> 149:156823d33999 178
<> 149:156823d33999 179 /**
<> 149:156823d33999 180 * @brief Return current Watchdog Counter Value (7 bits counter value)
<> 149:156823d33999 181 * @rmtoll CR T LL_WWDG_GetCounter
<> 149:156823d33999 182 * @param WWDGx WWDG Instance
<> 149:156823d33999 183 * @retval 7 bit Watchdog Counter value
<> 149:156823d33999 184 */
<> 149:156823d33999 185 __STATIC_INLINE uint32_t LL_WWDG_GetCounter(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 186 {
<> 149:156823d33999 187 return (uint32_t)(READ_BIT(WWDGx->CR, WWDG_CR_T));
<> 149:156823d33999 188 }
<> 149:156823d33999 189
<> 149:156823d33999 190 /**
<> 149:156823d33999 191 * @brief Set the time base of the prescaler (WDGTB).
<> 149:156823d33999 192 * @note Prescaler is used to apply ratio on PCLK clock, so that Watchdog counter
<> 149:156823d33999 193 * is decremented every (4096 x 2expWDGTB) PCLK cycles
<> 149:156823d33999 194 * @rmtoll CFR WDGTB LL_WWDG_SetPrescaler
<> 149:156823d33999 195 * @param WWDGx WWDG Instance
<> 149:156823d33999 196 * @param Prescaler This parameter can be one of the following values:
<> 149:156823d33999 197 * @arg @ref LL_WWDG_PRESCALER_1
<> 149:156823d33999 198 * @arg @ref LL_WWDG_PRESCALER_2
<> 149:156823d33999 199 * @arg @ref LL_WWDG_PRESCALER_4
<> 149:156823d33999 200 * @arg @ref LL_WWDG_PRESCALER_8
<> 149:156823d33999 201 * @retval None
<> 149:156823d33999 202 */
<> 149:156823d33999 203 __STATIC_INLINE void LL_WWDG_SetPrescaler(WWDG_TypeDef *WWDGx, uint32_t Prescaler)
<> 149:156823d33999 204 {
<> 149:156823d33999 205 MODIFY_REG(WWDGx->CFR, WWDG_CFR_WDGTB, Prescaler);
<> 149:156823d33999 206 }
<> 149:156823d33999 207
<> 149:156823d33999 208 /**
<> 149:156823d33999 209 * @brief Return current Watchdog Prescaler Value
<> 149:156823d33999 210 * @rmtoll CFR WDGTB LL_WWDG_GetPrescaler
<> 149:156823d33999 211 * @param WWDGx WWDG Instance
<> 149:156823d33999 212 * @retval Returned value can be one of the following values:
<> 149:156823d33999 213 * @arg @ref LL_WWDG_PRESCALER_1
<> 149:156823d33999 214 * @arg @ref LL_WWDG_PRESCALER_2
<> 149:156823d33999 215 * @arg @ref LL_WWDG_PRESCALER_4
<> 149:156823d33999 216 * @arg @ref LL_WWDG_PRESCALER_8
<> 149:156823d33999 217 */
<> 149:156823d33999 218 __STATIC_INLINE uint32_t LL_WWDG_GetPrescaler(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 219 {
<> 149:156823d33999 220 return (uint32_t)(READ_BIT(WWDGx->CFR, WWDG_CFR_WDGTB));
<> 149:156823d33999 221 }
<> 149:156823d33999 222
<> 149:156823d33999 223 /**
<> 149:156823d33999 224 * @brief Set the Watchdog Window value to be compared to the downcounter (7-bits W[6:0]).
<> 149:156823d33999 225 * @note This window value defines when write in the WWDG_CR register
<> 149:156823d33999 226 * to program Watchdog counter is allowed.
<> 149:156823d33999 227 * Watchdog counter value update must occur only when the counter value
<> 149:156823d33999 228 * is lower than the Watchdog window register value.
<> 149:156823d33999 229 * Otherwise, a MCU reset is generated if the 7-bit Watchdog counter value
<> 149:156823d33999 230 * (in the control register) is refreshed before the downcounter has reached
<> 149:156823d33999 231 * the watchdog window register value.
<> 149:156823d33999 232 * Physically is possible to set the Window lower then 0x40 but it is not recommended.
<> 149:156823d33999 233 * To generate an immediate reset, it is possible to set the Counter lower than 0x40.
<> 149:156823d33999 234 * @rmtoll CFR W LL_WWDG_SetWindow
<> 149:156823d33999 235 * @param WWDGx WWDG Instance
<> 149:156823d33999 236 * @param Window 0x00..0x7F (7 bit Window value)
<> 149:156823d33999 237 * @retval None
<> 149:156823d33999 238 */
<> 149:156823d33999 239 __STATIC_INLINE void LL_WWDG_SetWindow(WWDG_TypeDef *WWDGx, uint32_t Window)
<> 149:156823d33999 240 {
<> 149:156823d33999 241 MODIFY_REG(WWDGx->CFR, WWDG_CFR_W, Window);
<> 149:156823d33999 242 }
<> 149:156823d33999 243
<> 149:156823d33999 244 /**
<> 149:156823d33999 245 * @brief Return current Watchdog Window Value (7 bits value)
<> 149:156823d33999 246 * @rmtoll CFR W LL_WWDG_GetWindow
<> 149:156823d33999 247 * @param WWDGx WWDG Instance
<> 149:156823d33999 248 * @retval 7 bit Watchdog Window value
<> 149:156823d33999 249 */
<> 149:156823d33999 250 __STATIC_INLINE uint32_t LL_WWDG_GetWindow(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 251 {
<> 149:156823d33999 252 return (uint32_t)(READ_BIT(WWDGx->CFR, WWDG_CFR_W));
<> 149:156823d33999 253 }
<> 149:156823d33999 254
<> 149:156823d33999 255 /**
<> 149:156823d33999 256 * @}
<> 149:156823d33999 257 */
<> 149:156823d33999 258
<> 149:156823d33999 259 /** @defgroup WWDG_LL_EF_FLAG_Management FLAG_Management
<> 149:156823d33999 260 * @{
<> 149:156823d33999 261 */
<> 149:156823d33999 262 /**
<> 149:156823d33999 263 * @brief Indicates if the WWDG Early Wakeup Interrupt Flag is set or not.
<> 149:156823d33999 264 * @note This bit is set by hardware when the counter has reached the value 0x40.
<> 149:156823d33999 265 * It must be cleared by software by writing 0.
<> 149:156823d33999 266 * A write of 1 has no effect. This bit is also set if the interrupt is not enabled.
<> 149:156823d33999 267 * @rmtoll SR EWIF LL_WWDG_IsActiveFlag_EWKUP
<> 149:156823d33999 268 * @param WWDGx WWDG Instance
<> 149:156823d33999 269 * @retval State of bit (1 or 0).
<> 149:156823d33999 270 */
<> 149:156823d33999 271 __STATIC_INLINE uint32_t LL_WWDG_IsActiveFlag_EWKUP(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 272 {
<> 149:156823d33999 273 return (READ_BIT(WWDGx->SR, WWDG_SR_EWIF) == (WWDG_SR_EWIF));
<> 149:156823d33999 274 }
<> 149:156823d33999 275
<> 149:156823d33999 276 /**
<> 149:156823d33999 277 * @brief Clear WWDG Early Wakeup Interrupt Flag (EWIF)
<> 149:156823d33999 278 * @rmtoll SR EWIF LL_WWDG_ClearFlag_EWKUP
<> 149:156823d33999 279 * @param WWDGx WWDG Instance
<> 149:156823d33999 280 * @retval None
<> 149:156823d33999 281 */
<> 149:156823d33999 282 __STATIC_INLINE void LL_WWDG_ClearFlag_EWKUP(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 283 {
<> 149:156823d33999 284 WRITE_REG(WWDGx->SR, ~WWDG_SR_EWIF);
<> 149:156823d33999 285 }
<> 149:156823d33999 286
<> 149:156823d33999 287 /**
<> 149:156823d33999 288 * @}
<> 149:156823d33999 289 */
<> 149:156823d33999 290
<> 149:156823d33999 291 /** @defgroup WWDG_LL_EF_IT_Management IT_Management
<> 149:156823d33999 292 * @{
<> 149:156823d33999 293 */
<> 149:156823d33999 294 /**
<> 149:156823d33999 295 * @brief Enable the Early Wakeup Interrupt.
<> 149:156823d33999 296 * @note When set, an interrupt occurs whenever the counter reaches value 0x40.
<> 149:156823d33999 297 * This interrupt is only cleared by hardware after a reset
<> 149:156823d33999 298 * @rmtoll CFR EWI LL_WWDG_EnableIT_EWKUP
<> 149:156823d33999 299 * @param WWDGx WWDG Instance
<> 149:156823d33999 300 * @retval None
<> 149:156823d33999 301 */
<> 149:156823d33999 302 __STATIC_INLINE void LL_WWDG_EnableIT_EWKUP(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 303 {
<> 149:156823d33999 304 SET_BIT(WWDGx->CFR, WWDG_CFR_EWI);
<> 149:156823d33999 305 }
<> 149:156823d33999 306
<> 149:156823d33999 307 /**
<> 149:156823d33999 308 * @brief Check if Early Wakeup Interrupt is enabled
<> 149:156823d33999 309 * @rmtoll CFR EWI LL_WWDG_IsEnabledIT_EWKUP
<> 149:156823d33999 310 * @param WWDGx WWDG Instance
<> 149:156823d33999 311 * @retval State of bit (1 or 0).
<> 149:156823d33999 312 */
<> 149:156823d33999 313 __STATIC_INLINE uint32_t LL_WWDG_IsEnabledIT_EWKUP(WWDG_TypeDef *WWDGx)
<> 149:156823d33999 314 {
<> 149:156823d33999 315 return (READ_BIT(WWDGx->CFR, WWDG_CFR_EWI) == (WWDG_CFR_EWI));
<> 149:156823d33999 316 }
<> 149:156823d33999 317
<> 149:156823d33999 318 /**
<> 149:156823d33999 319 * @}
<> 149:156823d33999 320 */
<> 149:156823d33999 321
<> 149:156823d33999 322 /**
<> 149:156823d33999 323 * @}
<> 149:156823d33999 324 */
<> 149:156823d33999 325
<> 149:156823d33999 326 /**
<> 149:156823d33999 327 * @}
<> 149:156823d33999 328 */
<> 149:156823d33999 329
<> 149:156823d33999 330 #endif /* WWDG */
<> 149:156823d33999 331
<> 149:156823d33999 332 /**
<> 149:156823d33999 333 * @}
<> 149:156823d33999 334 */
<> 149:156823d33999 335
<> 149:156823d33999 336 #ifdef __cplusplus
<> 149:156823d33999 337 }
<> 149:156823d33999 338 #endif
<> 149:156823d33999 339
<> 149:156823d33999 340 #endif /* __STM32L1xx_LL_WWDG_H */
<> 149:156823d33999 341
<> 149:156823d33999 342 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/