TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

Fork of TUKS-COURSE-TIMER by TUKS MCU Introductory course

Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

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