mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Aug 14 13:15:17 2015 +0100
Revision:
610:813dcc80987e
Synchronized with git revision 6d84db41c6833e0b9b024741eb0616a5f62d5599

Full URL: https://github.com/mbedmicro/mbed/commit/6d84db41c6833e0b9b024741eb0616a5f62d5599/

DISCO_F746NG - Improvements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 610:813dcc80987e 1 /**
mbed_official 610:813dcc80987e 2 ******************************************************************************
mbed_official 610:813dcc80987e 3 * @file stm32l4xx_hal_pwr.h
mbed_official 610:813dcc80987e 4 * @author MCD Application Team
mbed_official 610:813dcc80987e 5 * @version V1.0.0
mbed_official 610:813dcc80987e 6 * @date 26-June-2015
mbed_official 610:813dcc80987e 7 * @brief Header file of PWR HAL module.
mbed_official 610:813dcc80987e 8 ******************************************************************************
mbed_official 610:813dcc80987e 9 * @attention
mbed_official 610:813dcc80987e 10 *
mbed_official 610:813dcc80987e 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 610:813dcc80987e 12 *
mbed_official 610:813dcc80987e 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 610:813dcc80987e 14 * are permitted provided that the following conditions are met:
mbed_official 610:813dcc80987e 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 610:813dcc80987e 16 * this list of conditions and the following disclaimer.
mbed_official 610:813dcc80987e 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 610:813dcc80987e 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 610:813dcc80987e 19 * and/or other materials provided with the distribution.
mbed_official 610:813dcc80987e 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 610:813dcc80987e 21 * may be used to endorse or promote products derived from this software
mbed_official 610:813dcc80987e 22 * without specific prior written permission.
mbed_official 610:813dcc80987e 23 *
mbed_official 610:813dcc80987e 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 610:813dcc80987e 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 610:813dcc80987e 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 610:813dcc80987e 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 610:813dcc80987e 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 610:813dcc80987e 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 610:813dcc80987e 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 610:813dcc80987e 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 610:813dcc80987e 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 610:813dcc80987e 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 610:813dcc80987e 34 *
mbed_official 610:813dcc80987e 35 ******************************************************************************
mbed_official 610:813dcc80987e 36 */
mbed_official 610:813dcc80987e 37
mbed_official 610:813dcc80987e 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 610:813dcc80987e 39 #ifndef __STM32L4xx_HAL_PWR_H
mbed_official 610:813dcc80987e 40 #define __STM32L4xx_HAL_PWR_H
mbed_official 610:813dcc80987e 41
mbed_official 610:813dcc80987e 42 #ifdef __cplusplus
mbed_official 610:813dcc80987e 43 extern "C" {
mbed_official 610:813dcc80987e 44 #endif
mbed_official 610:813dcc80987e 45
mbed_official 610:813dcc80987e 46 /* Includes ------------------------------------------------------------------*/
mbed_official 610:813dcc80987e 47 #include "stm32l4xx_hal_def.h"
mbed_official 610:813dcc80987e 48
mbed_official 610:813dcc80987e 49 /** @addtogroup STM32L4xx_HAL_Driver
mbed_official 610:813dcc80987e 50 * @{
mbed_official 610:813dcc80987e 51 */
mbed_official 610:813dcc80987e 52
mbed_official 610:813dcc80987e 53 /** @addtogroup PWR
mbed_official 610:813dcc80987e 54 * @{
mbed_official 610:813dcc80987e 55 */
mbed_official 610:813dcc80987e 56
mbed_official 610:813dcc80987e 57 /* Exported types ------------------------------------------------------------*/
mbed_official 610:813dcc80987e 58
mbed_official 610:813dcc80987e 59 /** @defgroup PWR_Exported_Types PWR Exported Types
mbed_official 610:813dcc80987e 60 * @{
mbed_official 610:813dcc80987e 61 */
mbed_official 610:813dcc80987e 62
mbed_official 610:813dcc80987e 63 /**
mbed_official 610:813dcc80987e 64 * @brief PWR PVD configuration structure definition
mbed_official 610:813dcc80987e 65 */
mbed_official 610:813dcc80987e 66 typedef struct
mbed_official 610:813dcc80987e 67 {
mbed_official 610:813dcc80987e 68 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level.
mbed_official 610:813dcc80987e 69 This parameter can be a value of @ref PWR_PVD_detection_level. */
mbed_official 610:813dcc80987e 70
mbed_official 610:813dcc80987e 71 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
mbed_official 610:813dcc80987e 72 This parameter can be a value of @ref PWR_PVD_Mode. */
mbed_official 610:813dcc80987e 73 }PWR_PVDTypeDef;
mbed_official 610:813dcc80987e 74
mbed_official 610:813dcc80987e 75
mbed_official 610:813dcc80987e 76 /**
mbed_official 610:813dcc80987e 77 * @}
mbed_official 610:813dcc80987e 78 */
mbed_official 610:813dcc80987e 79
mbed_official 610:813dcc80987e 80 /* Exported constants --------------------------------------------------------*/
mbed_official 610:813dcc80987e 81
mbed_official 610:813dcc80987e 82 /** @defgroup PWR_Exported_Constants PWR Exported Constants
mbed_official 610:813dcc80987e 83 * @{
mbed_official 610:813dcc80987e 84 */
mbed_official 610:813dcc80987e 85
mbed_official 610:813dcc80987e 86
mbed_official 610:813dcc80987e 87 /** @defgroup PWR_PVD_detection_level Programmable Voltage Detection levels
mbed_official 610:813dcc80987e 88 * @{
mbed_official 610:813dcc80987e 89 */
mbed_official 610:813dcc80987e 90 #define PWR_PVDLEVEL_0 PWR_CR2_PLS_LEV0 /*!< PVD threshold around 2.0 V */
mbed_official 610:813dcc80987e 91 #define PWR_PVDLEVEL_1 PWR_CR2_PLS_LEV1 /*!< PVD threshold around 2.2 V */
mbed_official 610:813dcc80987e 92 #define PWR_PVDLEVEL_2 PWR_CR2_PLS_LEV2 /*!< PVD threshold around 2.4 V */
mbed_official 610:813dcc80987e 93 #define PWR_PVDLEVEL_3 PWR_CR2_PLS_LEV3 /*!< PVD threshold around 2.5 V */
mbed_official 610:813dcc80987e 94 #define PWR_PVDLEVEL_4 PWR_CR2_PLS_LEV4 /*!< PVD threshold around 2.6 V */
mbed_official 610:813dcc80987e 95 #define PWR_PVDLEVEL_5 PWR_CR2_PLS_LEV5 /*!< PVD threshold around 2.8 V */
mbed_official 610:813dcc80987e 96 #define PWR_PVDLEVEL_6 PWR_CR2_PLS_LEV6 /*!< PVD threshold around 2.9 V */
mbed_official 610:813dcc80987e 97 #define PWR_PVDLEVEL_7 PWR_CR2_PLS_LEV7 /*!< External input analog voltage (compared internally to VREFINT) */
mbed_official 610:813dcc80987e 98 /**
mbed_official 610:813dcc80987e 99 * @}
mbed_official 610:813dcc80987e 100 */
mbed_official 610:813dcc80987e 101
mbed_official 610:813dcc80987e 102 /** @defgroup PWR_PVD_Mode PWR PVD interrupt and event mode
mbed_official 610:813dcc80987e 103 * @{
mbed_official 610:813dcc80987e 104 */
mbed_official 610:813dcc80987e 105 #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
mbed_official 610:813dcc80987e 106 #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
mbed_official 610:813dcc80987e 107 #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
mbed_official 610:813dcc80987e 108 #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
mbed_official 610:813dcc80987e 109 #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
mbed_official 610:813dcc80987e 110 #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
mbed_official 610:813dcc80987e 111 #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
mbed_official 610:813dcc80987e 112 /**
mbed_official 610:813dcc80987e 113 * @}
mbed_official 610:813dcc80987e 114 */
mbed_official 610:813dcc80987e 115
mbed_official 610:813dcc80987e 116
mbed_official 610:813dcc80987e 117
mbed_official 610:813dcc80987e 118
mbed_official 610:813dcc80987e 119 /** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode PWR regulator mode
mbed_official 610:813dcc80987e 120 * @{
mbed_official 610:813dcc80987e 121 */
mbed_official 610:813dcc80987e 122 #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000) /*!< Regulator in main mode */
mbed_official 610:813dcc80987e 123 #define PWR_LOWPOWERREGULATOR_ON PWR_CR1_LPR /*!< Regulator in low-power mode */
mbed_official 610:813dcc80987e 124 /**
mbed_official 610:813dcc80987e 125 * @}
mbed_official 610:813dcc80987e 126 */
mbed_official 610:813dcc80987e 127
mbed_official 610:813dcc80987e 128 /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
mbed_official 610:813dcc80987e 129 * @{
mbed_official 610:813dcc80987e 130 */
mbed_official 610:813dcc80987e 131 #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) /*!< Wait For Interruption instruction to enter Sleep mode */
mbed_official 610:813dcc80987e 132 #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) /*!< Wait For Event instruction to enter Sleep mode */
mbed_official 610:813dcc80987e 133 /**
mbed_official 610:813dcc80987e 134 * @}
mbed_official 610:813dcc80987e 135 */
mbed_official 610:813dcc80987e 136
mbed_official 610:813dcc80987e 137 /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
mbed_official 610:813dcc80987e 138 * @{
mbed_official 610:813dcc80987e 139 */
mbed_official 610:813dcc80987e 140 #define PWR_STOPENTRY_WFI ((uint8_t)0x01) /*!< Wait For Interruption instruction to enter Stop mode */
mbed_official 610:813dcc80987e 141 #define PWR_STOPENTRY_WFE ((uint8_t)0x02) /*!< Wait For Event instruction to enter Stop mode */
mbed_official 610:813dcc80987e 142 /**
mbed_official 610:813dcc80987e 143 * @}
mbed_official 610:813dcc80987e 144 */
mbed_official 610:813dcc80987e 145
mbed_official 610:813dcc80987e 146
mbed_official 610:813dcc80987e 147 /** @defgroup PWR_PVD_EXTI_LINE PWR PVD external interrupt line
mbed_official 610:813dcc80987e 148 * @{
mbed_official 610:813dcc80987e 149 */
mbed_official 610:813dcc80987e 150 #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
mbed_official 610:813dcc80987e 151 /**
mbed_official 610:813dcc80987e 152 * @}
mbed_official 610:813dcc80987e 153 */
mbed_official 610:813dcc80987e 154
mbed_official 610:813dcc80987e 155 /** @defgroup PWR_PVD_EVENT_LINE PWR PVD event line
mbed_official 610:813dcc80987e 156 * @{
mbed_official 610:813dcc80987e 157 */
mbed_official 610:813dcc80987e 158 #define PWR_EVENT_LINE_PVD ((uint32_t)0x00010000) /*!< Event line 16 Connected to the PVD Event Line */
mbed_official 610:813dcc80987e 159 /**
mbed_official 610:813dcc80987e 160 * @}
mbed_official 610:813dcc80987e 161 */
mbed_official 610:813dcc80987e 162
mbed_official 610:813dcc80987e 163 /**
mbed_official 610:813dcc80987e 164 * @}
mbed_official 610:813dcc80987e 165 */
mbed_official 610:813dcc80987e 166
mbed_official 610:813dcc80987e 167 /* Exported macros -----------------------------------------------------------*/
mbed_official 610:813dcc80987e 168 /** @defgroup PWR_Exported_Macros PWR Exported Macros
mbed_official 610:813dcc80987e 169 * @{
mbed_official 610:813dcc80987e 170 */
mbed_official 610:813dcc80987e 171
mbed_official 610:813dcc80987e 172 /** @brief Check whether or not a specific PWR flag is set.
mbed_official 610:813dcc80987e 173 * @param __FLAG__: specifies the flag to check.
mbed_official 610:813dcc80987e 174 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 175 * @arg PWR_FLAG_WUF1: Wake Up Flag 1. Indicates that a wakeup event
mbed_official 610:813dcc80987e 176 * was received from the WKUP pin 1.
mbed_official 610:813dcc80987e 177 * @arg PWR_FLAG_WUF2: Wake Up Flag 2. Indicates that a wakeup event
mbed_official 610:813dcc80987e 178 * was received from the WKUP pin 2.
mbed_official 610:813dcc80987e 179 * @arg PWR_FLAG_WUF3: Wake Up Flag 3. Indicates that a wakeup event
mbed_official 610:813dcc80987e 180 * was received from the WKUP pin 3.
mbed_official 610:813dcc80987e 181 * @arg PWR_FLAG_WUF4: Wake Up Flag 4. Indicates that a wakeup event
mbed_official 610:813dcc80987e 182 * was received from the WKUP pin 4.
mbed_official 610:813dcc80987e 183 * @arg PWR_FLAG_WUF5: Wake Up Flag 5. Indicates that a wakeup event
mbed_official 610:813dcc80987e 184 * was received from the WKUP pin 5.
mbed_official 610:813dcc80987e 185 * @arg PWR_FLAG_SB: StandBy Flag. Indicates that the system
mbed_official 610:813dcc80987e 186 * entered StandBy mode.
mbed_official 610:813dcc80987e 187 * @arg PWR_FLAG_WUFI: Wake-Up Flag Internal. Set when a wakeup is detected on
mbed_official 610:813dcc80987e 188 * the internal wakeup line.
mbed_official 610:813dcc80987e 189 * @arg PWR_FLAG_REGLPS: Low Power Regulator Started. Indicates whether or not the
mbed_official 610:813dcc80987e 190 * low-power regulator is ready.
mbed_official 610:813dcc80987e 191 * @arg PWR_FLAG_REGLPF: Low Power Regulator Flag. Indicates whether the
mbed_official 610:813dcc80987e 192 * regulator is ready in main mode or is in low-power mode.
mbed_official 610:813dcc80987e 193 * @arg PWR_FLAG_VOSF: Voltage Scaling Flag. Indicates whether the regulator is ready
mbed_official 610:813dcc80987e 194 * in the selected voltage range or is still changing to the required voltage level.
mbed_official 610:813dcc80987e 195 * @arg PWR_FLAG_PVDO: Power Voltage Detector Output. Indicates whether VDD voltage is
mbed_official 610:813dcc80987e 196 * below or above the selected PVD threshold.
mbed_official 610:813dcc80987e 197 * @arg PWR_FLAG_PVMO1: Peripheral Voltage Monitoring Output 1. Indicates whether VDDUSB voltage is
mbed_official 610:813dcc80987e 198 * is below or above PVM1 threshold (applicable when USB feature is supported).
mbed_official 610:813dcc80987e 199 * @arg PWR_FLAG_PVMO2: Peripheral Voltage Monitoring Output 2. Indicates whether VDDIO2 voltage is
mbed_official 610:813dcc80987e 200 * is below or above PVM2 threshold (applicable when VDDIO2 is present on device).
mbed_official 610:813dcc80987e 201 * @arg PWR_FLAG_PVMO3: Peripheral Voltage Monitoring Output 3. Indicates whether VDDA voltage is
mbed_official 610:813dcc80987e 202 * is below or above PVM3 threshold.
mbed_official 610:813dcc80987e 203 * @arg PWR_FLAG_PVMO4: Peripheral Voltage Monitoring Output 4. Indicates whether VDDA voltage is
mbed_official 610:813dcc80987e 204 * is below or above PVM4 threshold.
mbed_official 610:813dcc80987e 205 *
mbed_official 610:813dcc80987e 206 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 610:813dcc80987e 207 */
mbed_official 610:813dcc80987e 208 #define __HAL_PWR_GET_FLAG(__FLAG__) ( ((((uint8_t)(__FLAG__)) >> 5U) == 1) ?\
mbed_official 610:813dcc80987e 209 (PWR->SR1 & (1U << ((__FLAG__) & 31U))) :\
mbed_official 610:813dcc80987e 210 (PWR->SR2 & (1U << ((__FLAG__) & 31U))) )
mbed_official 610:813dcc80987e 211
mbed_official 610:813dcc80987e 212 /** @brief Clear a specific PWR flag.
mbed_official 610:813dcc80987e 213 * @param __FLAG__: specifies the flag to clear.
mbed_official 610:813dcc80987e 214 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 215 * @arg PWR_FLAG_WUF1: Wake Up Flag 1. Indicates that a wakeup event
mbed_official 610:813dcc80987e 216 * was received from the WKUP pin 1.
mbed_official 610:813dcc80987e 217 * @arg PWR_FLAG_WUF2: Wake Up Flag 2. Indicates that a wakeup event
mbed_official 610:813dcc80987e 218 * was received from the WKUP pin 2.
mbed_official 610:813dcc80987e 219 * @arg PWR_FLAG_WUF3: Wake Up Flag 3. Indicates that a wakeup event
mbed_official 610:813dcc80987e 220 * was received from the WKUP pin 3.
mbed_official 610:813dcc80987e 221 * @arg PWR_FLAG_WUF4: Wake Up Flag 4. Indicates that a wakeup event
mbed_official 610:813dcc80987e 222 * was received from the WKUP pin 4.
mbed_official 610:813dcc80987e 223 * @arg PWR_FLAG_WUF5: Wake Up Flag 5. Indicates that a wakeup event
mbed_official 610:813dcc80987e 224 * was received from the WKUP pin 5.
mbed_official 610:813dcc80987e 225 * @arg PWR_FLAG_WU: Encompasses all five Wake Up Flags.
mbed_official 610:813dcc80987e 226 * @arg PWR_FLAG_SB: Standby Flag. Indicates that the system
mbed_official 610:813dcc80987e 227 * entered Standby mode.
mbed_official 610:813dcc80987e 228 * @retval None
mbed_official 610:813dcc80987e 229 */
mbed_official 610:813dcc80987e 230 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) ( (((uint8_t)(__FLAG__)) == PWR_FLAG_WU) ?\
mbed_official 610:813dcc80987e 231 (PWR->SCR = (__FLAG__)) :\
mbed_official 610:813dcc80987e 232 (PWR->SCR = (1U << ((__FLAG__) & 31U))) )
mbed_official 610:813dcc80987e 233 /**
mbed_official 610:813dcc80987e 234 * @brief Enable the PVD Extended Interrupt Line.
mbed_official 610:813dcc80987e 235 * @retval None
mbed_official 610:813dcc80987e 236 */
mbed_official 610:813dcc80987e 237 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 238
mbed_official 610:813dcc80987e 239 /**
mbed_official 610:813dcc80987e 240 * @brief Disable the PVD Extended Interrupt Line.
mbed_official 610:813dcc80987e 241 * @retval None
mbed_official 610:813dcc80987e 242 */
mbed_official 610:813dcc80987e 243 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 244
mbed_official 610:813dcc80987e 245 /**
mbed_official 610:813dcc80987e 246 * @brief Enable the PVD Event Line.
mbed_official 610:813dcc80987e 247 * @retval None
mbed_official 610:813dcc80987e 248 */
mbed_official 610:813dcc80987e 249 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EVENT_LINE_PVD)
mbed_official 610:813dcc80987e 250
mbed_official 610:813dcc80987e 251 /**
mbed_official 610:813dcc80987e 252 * @brief Disable the PVD Event Line.
mbed_official 610:813dcc80987e 253 * @retval None
mbed_official 610:813dcc80987e 254 */
mbed_official 610:813dcc80987e 255 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EVENT_LINE_PVD)
mbed_official 610:813dcc80987e 256
mbed_official 610:813dcc80987e 257 /**
mbed_official 610:813dcc80987e 258 * @brief Enable the PVD Extended Interrupt Rising Trigger.
mbed_official 610:813dcc80987e 259 * @retval None
mbed_official 610:813dcc80987e 260 */
mbed_official 610:813dcc80987e 261 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 262
mbed_official 610:813dcc80987e 263 /**
mbed_official 610:813dcc80987e 264 * @brief Disable the PVD Extended Interrupt Rising Trigger.
mbed_official 610:813dcc80987e 265 * @retval None
mbed_official 610:813dcc80987e 266 */
mbed_official 610:813dcc80987e 267 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 268
mbed_official 610:813dcc80987e 269 /**
mbed_official 610:813dcc80987e 270 * @brief Enable the PVD Extended Interrupt Falling Trigger.
mbed_official 610:813dcc80987e 271 * @retval None
mbed_official 610:813dcc80987e 272 */
mbed_official 610:813dcc80987e 273 #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 274
mbed_official 610:813dcc80987e 275
mbed_official 610:813dcc80987e 276 /**
mbed_official 610:813dcc80987e 277 * @brief Disable the PVD Extended Interrupt Falling Trigger.
mbed_official 610:813dcc80987e 278 * @retval None
mbed_official 610:813dcc80987e 279 */
mbed_official 610:813dcc80987e 280 #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 281
mbed_official 610:813dcc80987e 282
mbed_official 610:813dcc80987e 283 /**
mbed_official 610:813dcc80987e 284 * @brief Enable the PVD Extended Interrupt Rising & Falling Trigger.
mbed_official 610:813dcc80987e 285 * @retval None
mbed_official 610:813dcc80987e 286 */
mbed_official 610:813dcc80987e 287 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() \
mbed_official 610:813dcc80987e 288 do { \
mbed_official 610:813dcc80987e 289 __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE(); \
mbed_official 610:813dcc80987e 290 __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); \
mbed_official 610:813dcc80987e 291 } while(0)
mbed_official 610:813dcc80987e 292
mbed_official 610:813dcc80987e 293 /**
mbed_official 610:813dcc80987e 294 * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger.
mbed_official 610:813dcc80987e 295 * @retval None
mbed_official 610:813dcc80987e 296 */
mbed_official 610:813dcc80987e 297 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() \
mbed_official 610:813dcc80987e 298 do { \
mbed_official 610:813dcc80987e 299 __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE(); \
mbed_official 610:813dcc80987e 300 __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); \
mbed_official 610:813dcc80987e 301 } while(0)
mbed_official 610:813dcc80987e 302
mbed_official 610:813dcc80987e 303 /**
mbed_official 610:813dcc80987e 304 * @brief Generate a Software interrupt on selected EXTI line.
mbed_official 610:813dcc80987e 305 * @retval None
mbed_official 610:813dcc80987e 306 */
mbed_official 610:813dcc80987e 307 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 308
mbed_official 610:813dcc80987e 309 /**
mbed_official 610:813dcc80987e 310 * @brief Check whether or not the PVD EXTI interrupt flag is set.
mbed_official 610:813dcc80987e 311 * @retval EXTI PVD Line Status.
mbed_official 610:813dcc80987e 312 */
mbed_official 610:813dcc80987e 313 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR1 & PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 314
mbed_official 610:813dcc80987e 315 /**
mbed_official 610:813dcc80987e 316 * @brief Clear the PVD EXTI interrupt flag.
mbed_official 610:813dcc80987e 317 * @retval None
mbed_official 610:813dcc80987e 318 */
mbed_official 610:813dcc80987e 319 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, PWR_EXTI_LINE_PVD)
mbed_official 610:813dcc80987e 320
mbed_official 610:813dcc80987e 321 /**
mbed_official 610:813dcc80987e 322 * @}
mbed_official 610:813dcc80987e 323 */
mbed_official 610:813dcc80987e 324
mbed_official 610:813dcc80987e 325
mbed_official 610:813dcc80987e 326 /* Private macros --------------------------------------------------------*/
mbed_official 610:813dcc80987e 327 /** @addtogroup PWR_Private_Macros PWR Private Macros
mbed_official 610:813dcc80987e 328 * @{
mbed_official 610:813dcc80987e 329 */
mbed_official 610:813dcc80987e 330
mbed_official 610:813dcc80987e 331 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
mbed_official 610:813dcc80987e 332 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
mbed_official 610:813dcc80987e 333 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
mbed_official 610:813dcc80987e 334 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
mbed_official 610:813dcc80987e 335
mbed_official 610:813dcc80987e 336 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_NORMAL) ||\
mbed_official 610:813dcc80987e 337 ((MODE) == PWR_PVD_MODE_IT_RISING) ||\
mbed_official 610:813dcc80987e 338 ((MODE) == PWR_PVD_MODE_IT_FALLING) ||\
mbed_official 610:813dcc80987e 339 ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) ||\
mbed_official 610:813dcc80987e 340 ((MODE) == PWR_PVD_MODE_EVENT_RISING) ||\
mbed_official 610:813dcc80987e 341 ((MODE) == PWR_PVD_MODE_EVENT_FALLING) ||\
mbed_official 610:813dcc80987e 342 ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING))
mbed_official 610:813dcc80987e 343
mbed_official 610:813dcc80987e 344 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
mbed_official 610:813dcc80987e 345 ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
mbed_official 610:813dcc80987e 346
mbed_official 610:813dcc80987e 347 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
mbed_official 610:813dcc80987e 348
mbed_official 610:813dcc80987e 349 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE) )
mbed_official 610:813dcc80987e 350
mbed_official 610:813dcc80987e 351 /**
mbed_official 610:813dcc80987e 352 * @}
mbed_official 610:813dcc80987e 353 */
mbed_official 610:813dcc80987e 354
mbed_official 610:813dcc80987e 355 /* Include PWR HAL Extended module */
mbed_official 610:813dcc80987e 356 #include "stm32l4xx_hal_pwr_ex.h"
mbed_official 610:813dcc80987e 357
mbed_official 610:813dcc80987e 358 /* Exported functions --------------------------------------------------------*/
mbed_official 610:813dcc80987e 359
mbed_official 610:813dcc80987e 360 /** @addtogroup PWR_Exported_Functions PWR Exported Functions
mbed_official 610:813dcc80987e 361 * @{
mbed_official 610:813dcc80987e 362 */
mbed_official 610:813dcc80987e 363
mbed_official 610:813dcc80987e 364 /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 610:813dcc80987e 365 * @{
mbed_official 610:813dcc80987e 366 */
mbed_official 610:813dcc80987e 367
mbed_official 610:813dcc80987e 368 /* Initialization and de-initialization functions *******************************/
mbed_official 610:813dcc80987e 369 void HAL_PWR_DeInit(void);
mbed_official 610:813dcc80987e 370 void HAL_PWR_EnableBkUpAccess(void);
mbed_official 610:813dcc80987e 371 void HAL_PWR_DisableBkUpAccess(void);
mbed_official 610:813dcc80987e 372
mbed_official 610:813dcc80987e 373 /**
mbed_official 610:813dcc80987e 374 * @}
mbed_official 610:813dcc80987e 375 */
mbed_official 610:813dcc80987e 376
mbed_official 610:813dcc80987e 377 /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
mbed_official 610:813dcc80987e 378 * @{
mbed_official 610:813dcc80987e 379 */
mbed_official 610:813dcc80987e 380
mbed_official 610:813dcc80987e 381 /* Peripheral Control functions ************************************************/
mbed_official 610:813dcc80987e 382 HAL_StatusTypeDef HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);
mbed_official 610:813dcc80987e 383 void HAL_PWR_EnablePVD(void);
mbed_official 610:813dcc80987e 384 void HAL_PWR_DisablePVD(void);
mbed_official 610:813dcc80987e 385
mbed_official 610:813dcc80987e 386
mbed_official 610:813dcc80987e 387 /* WakeUp pins configuration functions ****************************************/
mbed_official 610:813dcc80987e 388 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity);
mbed_official 610:813dcc80987e 389 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
mbed_official 610:813dcc80987e 390
mbed_official 610:813dcc80987e 391 /* Low Power modes configuration functions ************************************/
mbed_official 610:813dcc80987e 392 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
mbed_official 610:813dcc80987e 393 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
mbed_official 610:813dcc80987e 394 void HAL_PWR_EnterSTANDBYMode(void);
mbed_official 610:813dcc80987e 395
mbed_official 610:813dcc80987e 396 void HAL_PWR_EnableSleepOnExit(void);
mbed_official 610:813dcc80987e 397 void HAL_PWR_DisableSleepOnExit(void);
mbed_official 610:813dcc80987e 398 void HAL_PWR_EnableSEVOnPend(void);
mbed_official 610:813dcc80987e 399 void HAL_PWR_DisableSEVOnPend(void);
mbed_official 610:813dcc80987e 400
mbed_official 610:813dcc80987e 401 void HAL_PWR_PVDCallback(void);
mbed_official 610:813dcc80987e 402
mbed_official 610:813dcc80987e 403
mbed_official 610:813dcc80987e 404 /**
mbed_official 610:813dcc80987e 405 * @}
mbed_official 610:813dcc80987e 406 */
mbed_official 610:813dcc80987e 407
mbed_official 610:813dcc80987e 408 /**
mbed_official 610:813dcc80987e 409 * @}
mbed_official 610:813dcc80987e 410 */
mbed_official 610:813dcc80987e 411
mbed_official 610:813dcc80987e 412 /**
mbed_official 610:813dcc80987e 413 * @}
mbed_official 610:813dcc80987e 414 */
mbed_official 610:813dcc80987e 415
mbed_official 610:813dcc80987e 416 /**
mbed_official 610:813dcc80987e 417 * @}
mbed_official 610:813dcc80987e 418 */
mbed_official 610:813dcc80987e 419
mbed_official 610:813dcc80987e 420 #ifdef __cplusplus
mbed_official 610:813dcc80987e 421 }
mbed_official 610:813dcc80987e 422 #endif
mbed_official 610:813dcc80987e 423
mbed_official 610:813dcc80987e 424
mbed_official 610:813dcc80987e 425 #endif /* __STM32L4xx_HAL_PWR_H */
mbed_official 610:813dcc80987e 426
mbed_official 610:813dcc80987e 427 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/