mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Sep 30 17:00:09 2015 +0100
Revision:
636:a11c0372f0ba
Parent:
490:119543c9f674
Synchronized with git revision d29c98dae61be0946ddf3a3c641c7726056f9452

Full URL: https://github.com/mbedmicro/mbed/commit/d29c98dae61be0946ddf3a3c641c7726056f9452/

Added support for SAMW25

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 376:cb4d9db17537 1 /**
mbed_official 376:cb4d9db17537 2 ******************************************************************************
mbed_official 376:cb4d9db17537 3 * @file stm32l0xx_hal_pwr.h
mbed_official 376:cb4d9db17537 4 * @author MCD Application Team
mbed_official 490:119543c9f674 5 * @version V1.2.0
mbed_official 490:119543c9f674 6 * @date 06-February-2015
mbed_official 376:cb4d9db17537 7 * @brief Header file of PWR HAL module.
mbed_official 376:cb4d9db17537 8 ******************************************************************************
mbed_official 376:cb4d9db17537 9 * @attention
mbed_official 376:cb4d9db17537 10 *
mbed_official 490:119543c9f674 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 376:cb4d9db17537 12 *
mbed_official 376:cb4d9db17537 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 376:cb4d9db17537 14 * are permitted provided that the following conditions are met:
mbed_official 376:cb4d9db17537 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 376:cb4d9db17537 16 * this list of conditions and the following disclaimer.
mbed_official 376:cb4d9db17537 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 376:cb4d9db17537 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 376:cb4d9db17537 19 * and/or other materials provided with the distribution.
mbed_official 376:cb4d9db17537 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 376:cb4d9db17537 21 * may be used to endorse or promote products derived from this software
mbed_official 376:cb4d9db17537 22 * without specific prior written permission.
mbed_official 376:cb4d9db17537 23 *
mbed_official 376:cb4d9db17537 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 376:cb4d9db17537 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 376:cb4d9db17537 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 376:cb4d9db17537 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 376:cb4d9db17537 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 376:cb4d9db17537 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 376:cb4d9db17537 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 376:cb4d9db17537 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 376:cb4d9db17537 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 376:cb4d9db17537 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 376:cb4d9db17537 34 *
mbed_official 376:cb4d9db17537 35 ******************************************************************************
mbed_official 376:cb4d9db17537 36 */
mbed_official 376:cb4d9db17537 37
mbed_official 376:cb4d9db17537 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 376:cb4d9db17537 39 #ifndef __STM32L0xx_HAL_PWR_H
mbed_official 376:cb4d9db17537 40 #define __STM32L0xx_HAL_PWR_H
mbed_official 376:cb4d9db17537 41
mbed_official 376:cb4d9db17537 42 #ifdef __cplusplus
mbed_official 376:cb4d9db17537 43 extern "C" {
mbed_official 376:cb4d9db17537 44 #endif
mbed_official 376:cb4d9db17537 45
mbed_official 376:cb4d9db17537 46 /* Includes ------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 47 #include "stm32l0xx_hal_def.h"
mbed_official 376:cb4d9db17537 48
mbed_official 376:cb4d9db17537 49 /** @addtogroup STM32L0xx_HAL_Driver
mbed_official 376:cb4d9db17537 50 * @{
mbed_official 376:cb4d9db17537 51 */
mbed_official 376:cb4d9db17537 52
mbed_official 490:119543c9f674 53 /** @defgroup PWR
mbed_official 376:cb4d9db17537 54 * @{
mbed_official 376:cb4d9db17537 55 */
mbed_official 376:cb4d9db17537 56
mbed_official 490:119543c9f674 57 /** @defgroup PWR_Exported_Types PWR Exported Types
mbed_official 490:119543c9f674 58 * @{
mbed_official 490:119543c9f674 59 */
mbed_official 490:119543c9f674 60
mbed_official 376:cb4d9db17537 61 /**
mbed_official 376:cb4d9db17537 62 * @brief PWR PVD configuration structure definition
mbed_official 376:cb4d9db17537 63 */
mbed_official 376:cb4d9db17537 64 typedef struct
mbed_official 376:cb4d9db17537 65 {
mbed_official 376:cb4d9db17537 66 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level.
mbed_official 376:cb4d9db17537 67 This parameter can be a value of @ref PWR_PVD_detection_level */
mbed_official 376:cb4d9db17537 68
mbed_official 490:119543c9f674 69 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
mbed_official 490:119543c9f674 70 This parameter can be a value of @ref PWR_PVD_Mode */
mbed_official 376:cb4d9db17537 71 }PWR_PVDTypeDef;
mbed_official 376:cb4d9db17537 72
mbed_official 490:119543c9f674 73 /**
mbed_official 490:119543c9f674 74 * @}
mbed_official 376:cb4d9db17537 75 */
mbed_official 376:cb4d9db17537 76
mbed_official 490:119543c9f674 77 /** @defgroup PWR_Private_Defines PWR Private Defines
mbed_official 376:cb4d9db17537 78 * @{
mbed_official 490:119543c9f674 79 */
mbed_official 376:cb4d9db17537 80
mbed_official 490:119543c9f674 81 #define PWR_EXTI_LINE_PVD EXTI_FTSR_TR16 /*!< External interrupt line 16 Connected to the PVD EXTI Line */
mbed_official 490:119543c9f674 82
mbed_official 376:cb4d9db17537 83 /**
mbed_official 376:cb4d9db17537 84 * @}
mbed_official 376:cb4d9db17537 85 */
mbed_official 376:cb4d9db17537 86
mbed_official 490:119543c9f674 87 /** @defgroup PWR_Exported_Constants PWR Exported Constants
mbed_official 490:119543c9f674 88 * @{
mbed_official 490:119543c9f674 89 */
mbed_official 490:119543c9f674 90
mbed_official 490:119543c9f674 91 /** @defgroup PWR_register_alias_address PWR Register alias address
mbed_official 376:cb4d9db17537 92 * @{
mbed_official 376:cb4d9db17537 93 */
mbed_official 490:119543c9f674 94 #define PWR_WAKEUP_PIN1 PWR_CSR_EWUP1
mbed_official 490:119543c9f674 95 #define PWR_WAKEUP_PIN2 PWR_CSR_EWUP2
mbed_official 490:119543c9f674 96 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
mbed_official 490:119543c9f674 97 #define PWR_WAKEUP_PIN3 PWR_CSR_EWUP3
mbed_official 490:119543c9f674 98 #endif
mbed_official 490:119543c9f674 99 /**
mbed_official 490:119543c9f674 100 * @}
mbed_official 490:119543c9f674 101 */
mbed_official 490:119543c9f674 102
mbed_official 490:119543c9f674 103 /** @defgroup PWR_PVD_detection_level PVD detection level
mbed_official 490:119543c9f674 104 * @{
mbed_official 490:119543c9f674 105 */
mbed_official 490:119543c9f674 106 #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
mbed_official 490:119543c9f674 107 #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
mbed_official 490:119543c9f674 108 #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
mbed_official 490:119543c9f674 109 #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
mbed_official 490:119543c9f674 110 #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
mbed_official 490:119543c9f674 111 #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
mbed_official 490:119543c9f674 112 #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
mbed_official 490:119543c9f674 113 #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7 /* External input analog voltage
mbed_official 490:119543c9f674 114 (Compare internally to VREFINT) */
mbed_official 376:cb4d9db17537 115 /**
mbed_official 376:cb4d9db17537 116 * @}
mbed_official 376:cb4d9db17537 117 */
mbed_official 376:cb4d9db17537 118
mbed_official 490:119543c9f674 119 /** @defgroup PWR_PVD_Mode PWR PVD Mode
mbed_official 376:cb4d9db17537 120 * @{
mbed_official 376:cb4d9db17537 121 */
mbed_official 490:119543c9f674 122 #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
mbed_official 490:119543c9f674 123 #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
mbed_official 490:119543c9f674 124 #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
mbed_official 490:119543c9f674 125 #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
mbed_official 490:119543c9f674 126 #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
mbed_official 490:119543c9f674 127 #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
mbed_official 490:119543c9f674 128 #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
mbed_official 490:119543c9f674 129
mbed_official 376:cb4d9db17537 130 /**
mbed_official 376:cb4d9db17537 131 * @}
mbed_official 376:cb4d9db17537 132 */
mbed_official 376:cb4d9db17537 133
mbed_official 490:119543c9f674 134 /** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode PWR Regulator state in SLEEP/STOP mode
mbed_official 376:cb4d9db17537 135 * @{
mbed_official 376:cb4d9db17537 136 */
mbed_official 490:119543c9f674 137 #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000)
mbed_official 490:119543c9f674 138 #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPSDSR
mbed_official 376:cb4d9db17537 139
mbed_official 376:cb4d9db17537 140 /**
mbed_official 376:cb4d9db17537 141 * @}
mbed_official 376:cb4d9db17537 142 */
mbed_official 376:cb4d9db17537 143
mbed_official 490:119543c9f674 144 /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
mbed_official 376:cb4d9db17537 145 * @{
mbed_official 376:cb4d9db17537 146 */
mbed_official 490:119543c9f674 147 #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01)
mbed_official 490:119543c9f674 148 #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02)
mbed_official 376:cb4d9db17537 149 /**
mbed_official 376:cb4d9db17537 150 * @}
mbed_official 376:cb4d9db17537 151 */
mbed_official 376:cb4d9db17537 152
mbed_official 490:119543c9f674 153 /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
mbed_official 376:cb4d9db17537 154 * @{
mbed_official 376:cb4d9db17537 155 */
mbed_official 490:119543c9f674 156 #define PWR_STOPENTRY_WFI ((uint8_t)0x01)
mbed_official 490:119543c9f674 157 #define PWR_STOPENTRY_WFE ((uint8_t)0x02)
mbed_official 376:cb4d9db17537 158 /**
mbed_official 376:cb4d9db17537 159 * @}
mbed_official 376:cb4d9db17537 160 */
mbed_official 376:cb4d9db17537 161
mbed_official 490:119543c9f674 162 /** @defgroup PWR_Regulator_Voltage_Scale PWR Regulator Voltage Scale
mbed_official 376:cb4d9db17537 163 * @{
mbed_official 376:cb4d9db17537 164 */
mbed_official 376:cb4d9db17537 165
mbed_official 490:119543c9f674 166 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS_0
mbed_official 490:119543c9f674 167 #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1
mbed_official 490:119543c9f674 168 #define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS
mbed_official 376:cb4d9db17537 169
mbed_official 376:cb4d9db17537 170 #define IS_PWR_VOLTAGE_SCALING_RANGE(RANGE) (((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
mbed_official 376:cb4d9db17537 171 ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
mbed_official 376:cb4d9db17537 172 ((RANGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
mbed_official 376:cb4d9db17537 173 /**
mbed_official 376:cb4d9db17537 174 * @}
mbed_official 376:cb4d9db17537 175 */
mbed_official 376:cb4d9db17537 176
mbed_official 490:119543c9f674 177 /** @defgroup PWR_Flag PWR Flag
mbed_official 376:cb4d9db17537 178 * @{
mbed_official 376:cb4d9db17537 179 */
mbed_official 490:119543c9f674 180 #define PWR_FLAG_WU PWR_CSR_WUF
mbed_official 490:119543c9f674 181 #define PWR_FLAG_SB PWR_CSR_SBF
mbed_official 490:119543c9f674 182 #define PWR_FLAG_PVDO PWR_CSR_PVDO
mbed_official 490:119543c9f674 183 #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
mbed_official 490:119543c9f674 184 #define PWR_FLAG_VOS PWR_CSR_VOSF
mbed_official 490:119543c9f674 185 #define PWR_FLAG_REGLP PWR_CSR_REGLPF
mbed_official 376:cb4d9db17537 186
mbed_official 490:119543c9f674 187 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
mbed_official 490:119543c9f674 188 ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_VREFINTRDY) || \
mbed_official 490:119543c9f674 189 ((FLAG) == PWR_FLAG_VOS) || ((FLAG) == PWR_FLAG_REGLP))
mbed_official 376:cb4d9db17537 190 /**
mbed_official 376:cb4d9db17537 191 * @}
mbed_official 376:cb4d9db17537 192 */
mbed_official 376:cb4d9db17537 193
mbed_official 376:cb4d9db17537 194 /**
mbed_official 376:cb4d9db17537 195 * @}
mbed_official 376:cb4d9db17537 196 */
mbed_official 376:cb4d9db17537 197
mbed_official 490:119543c9f674 198 /** @defgroup PWR_Exported_Macro PWR Exported Macro
mbed_official 376:cb4d9db17537 199 * @{
mbed_official 376:cb4d9db17537 200 */
mbed_official 376:cb4d9db17537 201 /** @brief macros configure the main internal regulator output voltage.
mbed_official 376:cb4d9db17537 202 * @param __REGULATOR__: specifies the regulator output voltage to achieve
mbed_official 376:cb4d9db17537 203 * a tradeoff between performance and power consumption when the device does
mbed_official 376:cb4d9db17537 204 * not operate at the maximum frequency (refer to the datasheets for more details).
mbed_official 376:cb4d9db17537 205 * This parameter can be one of the following values:
mbed_official 376:cb4d9db17537 206 * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode,
mbed_official 376:cb4d9db17537 207 * System frequency up to 32 MHz.
mbed_official 376:cb4d9db17537 208 * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode,
mbed_official 376:cb4d9db17537 209 * System frequency up to 16 MHz.
mbed_official 376:cb4d9db17537 210 * @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output Scale 3 mode,
mbed_official 376:cb4d9db17537 211 * System frequency up to 4.2 MHz
mbed_official 376:cb4d9db17537 212 * @retval None
mbed_official 376:cb4d9db17537 213 */
mbed_official 376:cb4d9db17537 214 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) (MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)))
mbed_official 376:cb4d9db17537 215
mbed_official 376:cb4d9db17537 216 /** @brief Check PWR flag is set or not.
mbed_official 376:cb4d9db17537 217 * @param __FLAG__: specifies the flag to check.
mbed_official 376:cb4d9db17537 218 * This parameter can be one of the following values:
mbed_official 376:cb4d9db17537 219 * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
mbed_official 376:cb4d9db17537 220 * was received from the WKUP pin or from the RTC alarm (Alarm B),
mbed_official 376:cb4d9db17537 221 * RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
mbed_official 376:cb4d9db17537 222 * An additional wakeup event is detected if the WKUP pin is enabled
mbed_official 376:cb4d9db17537 223 * (by setting the EWUP bit) when the WKUP pin level is already high.
mbed_official 376:cb4d9db17537 224 * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
mbed_official 376:cb4d9db17537 225 * resumed from StandBy mode.
mbed_official 376:cb4d9db17537 226 * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
mbed_official 490:119543c9f674 227 * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode.
mbed_official 376:cb4d9db17537 228 * For this reason, this bit is equal to 0 after Standby or reset
mbed_official 376:cb4d9db17537 229 * until the PVDE bit is set.
mbed_official 376:cb4d9db17537 230 * @arg PWR_FLAG_VREFINTRDY: Internal voltage reference (VREFINT) ready flag.
mbed_official 376:cb4d9db17537 231 * This bit indicates the state of the internal voltage reference, VREFINT.
mbed_official 376:cb4d9db17537 232 * @arg PWR_FLAG_VOS: Voltage Scaling select flag. A delay is required for
mbed_official 376:cb4d9db17537 233 * the internal regulator to be ready after the voltage range is changed.
mbed_official 376:cb4d9db17537 234 * The VOSF bit indicates that the regulator has reached the voltage level
mbed_official 376:cb4d9db17537 235 * defined with bits VOS of PWR_CR register.
mbed_official 376:cb4d9db17537 236 * @arg PWR_FLAG_REGLP: Regulator LP flag. When the MCU exits from Low power run
mbed_official 376:cb4d9db17537 237 * mode, this bit stays at 1 until the regulator is ready in main mode.
mbed_official 376:cb4d9db17537 238 * A polling on this bit is recommended to wait for the regulator main mode.
mbed_official 376:cb4d9db17537 239 * This bit is reset by hardware when the regulator is ready.
mbed_official 376:cb4d9db17537 240 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 376:cb4d9db17537 241 */
mbed_official 490:119543c9f674 242 #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
mbed_official 376:cb4d9db17537 243
mbed_official 376:cb4d9db17537 244 /** @brief Clear the PWR's pending flags.
mbed_official 376:cb4d9db17537 245 * @param __FLAG__: specifies the flag to clear.
mbed_official 376:cb4d9db17537 246 * This parameter can be one of the following values:
mbed_official 376:cb4d9db17537 247 * @arg PWR_FLAG_WU: Wake Up flag
mbed_official 376:cb4d9db17537 248 * @arg PWR_FLAG_SB: StandBy flag
mbed_official 376:cb4d9db17537 249 */
mbed_official 490:119543c9f674 250 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) SET_BIT(PWR->CR, (__FLAG__) << 2)
mbed_official 376:cb4d9db17537 251
mbed_official 490:119543c9f674 252 /**
mbed_official 490:119543c9f674 253 * @brief Enable interrupt on PVD Exti Line 16.
mbed_official 490:119543c9f674 254 * @retval None.
mbed_official 490:119543c9f674 255 */
mbed_official 490:119543c9f674 256 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 257
mbed_official 376:cb4d9db17537 258 /**
mbed_official 490:119543c9f674 259 * @brief Disable interrupt on PVD Exti Line 16.
mbed_official 490:119543c9f674 260 * @retval None.
mbed_official 490:119543c9f674 261 */
mbed_official 490:119543c9f674 262 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 263
mbed_official 490:119543c9f674 264 /**
mbed_official 490:119543c9f674 265 * @brief Enable event on PVD Exti Line 16.
mbed_official 490:119543c9f674 266 * @retval None.
mbed_official 490:119543c9f674 267 */
mbed_official 490:119543c9f674 268 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 269
mbed_official 490:119543c9f674 270 /**
mbed_official 490:119543c9f674 271 * @brief Disable event on PVD Exti Line 16.
mbed_official 376:cb4d9db17537 272 * @retval None.
mbed_official 376:cb4d9db17537 273 */
mbed_official 490:119543c9f674 274 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 275
mbed_official 490:119543c9f674 276
mbed_official 490:119543c9f674 277 /**
mbed_official 490:119543c9f674 278 * @brief PVD EXTI line configuration: set falling edge trigger.
mbed_official 490:119543c9f674 279 * @retval None.
mbed_official 490:119543c9f674 280 */
mbed_official 490:119543c9f674 281 #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 282
mbed_official 490:119543c9f674 283
mbed_official 490:119543c9f674 284 /**
mbed_official 490:119543c9f674 285 * @brief Disable the PVD Extended Interrupt Falling Trigger.
mbed_official 490:119543c9f674 286 * @retval None.
mbed_official 490:119543c9f674 287 */
mbed_official 490:119543c9f674 288 #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 289
mbed_official 376:cb4d9db17537 290
mbed_official 376:cb4d9db17537 291 /**
mbed_official 490:119543c9f674 292 * @brief PVD EXTI line configuration: set rising edge trigger.
mbed_official 376:cb4d9db17537 293 * @retval None.
mbed_official 376:cb4d9db17537 294 */
mbed_official 490:119543c9f674 295 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 296
mbed_official 490:119543c9f674 297 /**
mbed_official 490:119543c9f674 298 * @brief Disable the PVD Extended Interrupt Rising Trigger.
mbed_official 490:119543c9f674 299 * This parameter can be:
mbed_official 490:119543c9f674 300 * @retval None.
mbed_official 490:119543c9f674 301 */
mbed_official 490:119543c9f674 302 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 303
mbed_official 490:119543c9f674 304 /**
mbed_official 490:119543c9f674 305 * @brief PVD EXTI line configuration: set rising & falling edge trigger.
mbed_official 490:119543c9f674 306 * @retval None.
mbed_official 490:119543c9f674 307 */
mbed_official 490:119543c9f674 308 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();
mbed_official 376:cb4d9db17537 309
mbed_official 376:cb4d9db17537 310 /**
mbed_official 490:119543c9f674 311 * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger.
mbed_official 376:cb4d9db17537 312 * This parameter can be:
mbed_official 490:119543c9f674 313 * @retval None.
mbed_official 490:119543c9f674 314 */
mbed_official 490:119543c9f674 315 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE()();
mbed_official 490:119543c9f674 316
mbed_official 490:119543c9f674 317
mbed_official 490:119543c9f674 318
mbed_official 490:119543c9f674 319 /**
mbed_official 490:119543c9f674 320 * @brief Check whether the specified PVD EXTI interrupt flag is set or not.
mbed_official 490:119543c9f674 321 * @retval EXTI PVD Line Status.
mbed_official 376:cb4d9db17537 322 */
mbed_official 490:119543c9f674 323 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD))
mbed_official 490:119543c9f674 324
mbed_official 490:119543c9f674 325 /**
mbed_official 490:119543c9f674 326 * @brief Clear the PVD EXTI flag.
mbed_official 490:119543c9f674 327 * @retval None.
mbed_official 490:119543c9f674 328 */
mbed_official 490:119543c9f674 329 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD))
mbed_official 490:119543c9f674 330
mbed_official 490:119543c9f674 331 /**
mbed_official 490:119543c9f674 332 * @brief Generate a Software interrupt on selected EXTI line.
mbed_official 490:119543c9f674 333 * @retval None.
mbed_official 490:119543c9f674 334 */
mbed_official 490:119543c9f674 335 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, PWR_EXTI_LINE_PVD)
mbed_official 490:119543c9f674 336 /**
mbed_official 490:119543c9f674 337 * @}
mbed_official 490:119543c9f674 338 */
mbed_official 376:cb4d9db17537 339
mbed_official 376:cb4d9db17537 340 /**
mbed_official 490:119543c9f674 341 * @brief Generate a Software interrupt on selected EXTI line.
mbed_official 490:119543c9f674 342 * @retval None.
mbed_official 376:cb4d9db17537 343 */
mbed_official 490:119543c9f674 344 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, PWR_EXTI_LINE_PVD)
mbed_official 376:cb4d9db17537 345
mbed_official 376:cb4d9db17537 346 /**
mbed_official 490:119543c9f674 347 * @}
mbed_official 490:119543c9f674 348 */
mbed_official 490:119543c9f674 349
mbed_official 490:119543c9f674 350 /** @defgroup PWR_Private_Macros PWR Private Macros
mbed_official 490:119543c9f674 351 * @{
mbed_official 376:cb4d9db17537 352 */
mbed_official 490:119543c9f674 353 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
mbed_official 490:119543c9f674 354 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
mbed_official 490:119543c9f674 355 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
mbed_official 490:119543c9f674 356 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
mbed_official 490:119543c9f674 357
mbed_official 490:119543c9f674 358 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \
mbed_official 490:119543c9f674 359 ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \
mbed_official 490:119543c9f674 360 ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \
mbed_official 490:119543c9f674 361 ((MODE) == PWR_PVD_MODE_NORMAL))
mbed_official 490:119543c9f674 362
mbed_official 490:119543c9f674 363 #if defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
mbed_official 490:119543c9f674 364 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
mbed_official 490:119543c9f674 365 ((PIN) == PWR_WAKEUP_PIN2) || \
mbed_official 490:119543c9f674 366 ((PIN) == PWR_WAKEUP_PIN3))
mbed_official 490:119543c9f674 367 #else
mbed_official 490:119543c9f674 368 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
mbed_official 490:119543c9f674 369 ((PIN) == PWR_WAKEUP_PIN2))
mbed_official 490:119543c9f674 370 #endif
mbed_official 490:119543c9f674 371
mbed_official 490:119543c9f674 372 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
mbed_official 490:119543c9f674 373 ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
mbed_official 490:119543c9f674 374 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
mbed_official 490:119543c9f674 375
mbed_official 490:119543c9f674 376 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
mbed_official 376:cb4d9db17537 377
mbed_official 376:cb4d9db17537 378 /**
mbed_official 376:cb4d9db17537 379 * @}
mbed_official 376:cb4d9db17537 380 */
mbed_official 376:cb4d9db17537 381
mbed_official 376:cb4d9db17537 382 /* Include PWR HAL Extension module */
mbed_official 376:cb4d9db17537 383 #include "stm32l0xx_hal_pwr_ex.h"
mbed_official 376:cb4d9db17537 384
mbed_official 490:119543c9f674 385 /** @defgroup PWR_Exported_Functions PWR Exported Functions
mbed_official 490:119543c9f674 386 * @{
mbed_official 490:119543c9f674 387 */
mbed_official 490:119543c9f674 388
mbed_official 490:119543c9f674 389 /** @defgroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 490:119543c9f674 390 * @{
mbed_official 490:119543c9f674 391 */
mbed_official 376:cb4d9db17537 392 void HAL_PWR_DeInit(void);
mbed_official 376:cb4d9db17537 393 void HAL_PWR_EnableBkUpAccess(void);
mbed_official 376:cb4d9db17537 394 void HAL_PWR_DisableBkUpAccess(void);
mbed_official 490:119543c9f674 395 /**
mbed_official 490:119543c9f674 396 * @}
mbed_official 490:119543c9f674 397 */
mbed_official 376:cb4d9db17537 398
mbed_official 490:119543c9f674 399 /** @defgroup PWR_Exported_Functions_Group2 Low Power modes configuration functions
mbed_official 490:119543c9f674 400 * @{
mbed_official 490:119543c9f674 401 */
mbed_official 490:119543c9f674 402
mbed_official 490:119543c9f674 403 /* PVD control functions ************************************************/
mbed_official 490:119543c9f674 404 void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);
mbed_official 376:cb4d9db17537 405 void HAL_PWR_EnablePVD(void);
mbed_official 376:cb4d9db17537 406 void HAL_PWR_DisablePVD(void);
mbed_official 490:119543c9f674 407 void HAL_PWR_PVD_IRQHandler(void);
mbed_official 490:119543c9f674 408 void HAL_PWR_PVDCallback(void);
mbed_official 376:cb4d9db17537 409
mbed_official 376:cb4d9db17537 410 /* WakeUp pins configuration functions ****************************************/
mbed_official 376:cb4d9db17537 411 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
mbed_official 376:cb4d9db17537 412 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
mbed_official 376:cb4d9db17537 413
mbed_official 376:cb4d9db17537 414 /* Low Power modes configuration functions ************************************/
mbed_official 376:cb4d9db17537 415 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
mbed_official 376:cb4d9db17537 416 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
mbed_official 376:cb4d9db17537 417 void HAL_PWR_EnterSTANDBYMode(void);
mbed_official 376:cb4d9db17537 418
mbed_official 490:119543c9f674 419 void HAL_PWR_EnableSleepOnExit(void);
mbed_official 490:119543c9f674 420 void HAL_PWR_DisableSleepOnExit(void);
mbed_official 490:119543c9f674 421 void HAL_PWR_EnableSEVOnPend(void);
mbed_official 490:119543c9f674 422 void HAL_PWR_DisableSEVOnPend(void);
mbed_official 490:119543c9f674 423
mbed_official 490:119543c9f674 424 /**
mbed_official 490:119543c9f674 425 * @}
mbed_official 490:119543c9f674 426 */
mbed_official 490:119543c9f674 427
mbed_official 490:119543c9f674 428 /**
mbed_official 490:119543c9f674 429 * @}
mbed_official 490:119543c9f674 430 */
mbed_official 376:cb4d9db17537 431
mbed_official 376:cb4d9db17537 432 /**
mbed_official 376:cb4d9db17537 433 * @}
mbed_official 376:cb4d9db17537 434 */
mbed_official 376:cb4d9db17537 435
mbed_official 376:cb4d9db17537 436 /**
mbed_official 376:cb4d9db17537 437 * @}
mbed_official 376:cb4d9db17537 438 */
mbed_official 376:cb4d9db17537 439
mbed_official 376:cb4d9db17537 440 #ifdef __cplusplus
mbed_official 376:cb4d9db17537 441 }
mbed_official 376:cb4d9db17537 442 #endif
mbed_official 376:cb4d9db17537 443
mbed_official 376:cb4d9db17537 444
mbed_official 376:cb4d9db17537 445 #endif /* __STM32L0xx_HAL_PWR_H */
mbed_official 376:cb4d9db17537 446
mbed_official 376:cb4d9db17537 447 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbed_official 490:119543c9f674 448