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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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