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