The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_ARCH_MAX/stm32f4xx_hal_pwr.h@89:552587b429a1, 2014-09-12 (annotated)
- Committer:
- bogdanm
- Date:
- Fri Sep 12 16:41:52 2014 +0100
- Revision:
- 89:552587b429a1
- Child:
- 92:4fc01daae5a5
Release 89 of the mbed library
Main changes:
- low power optimizations for Nordic targets
- code structure changes for Freescale K64F targets
- bug fixes in various backends
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 89:552587b429a1 | 1 | /** |
bogdanm | 89:552587b429a1 | 2 | ****************************************************************************** |
bogdanm | 89:552587b429a1 | 3 | * @file stm32f4xx_hal_pwr.h |
bogdanm | 89:552587b429a1 | 4 | * @author MCD Application Team |
bogdanm | 89:552587b429a1 | 5 | * @version V1.1.0RC2 |
bogdanm | 89:552587b429a1 | 6 | * @date 14-May-2014 |
bogdanm | 89:552587b429a1 | 7 | * @brief Header file of PWR HAL module. |
bogdanm | 89:552587b429a1 | 8 | ****************************************************************************** |
bogdanm | 89:552587b429a1 | 9 | * @attention |
bogdanm | 89:552587b429a1 | 10 | * |
bogdanm | 89:552587b429a1 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 89:552587b429a1 | 12 | * |
bogdanm | 89:552587b429a1 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 89:552587b429a1 | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 89:552587b429a1 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 89:552587b429a1 | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 89:552587b429a1 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 89:552587b429a1 | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 89:552587b429a1 | 19 | * and/or other materials provided with the distribution. |
bogdanm | 89:552587b429a1 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 89:552587b429a1 | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 89:552587b429a1 | 22 | * without specific prior written permission. |
bogdanm | 89:552587b429a1 | 23 | * |
bogdanm | 89:552587b429a1 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 89:552587b429a1 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 89:552587b429a1 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 89:552587b429a1 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 89:552587b429a1 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 89:552587b429a1 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 89:552587b429a1 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 89:552587b429a1 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 89:552587b429a1 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 89:552587b429a1 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 89:552587b429a1 | 34 | * |
bogdanm | 89:552587b429a1 | 35 | ****************************************************************************** |
bogdanm | 89:552587b429a1 | 36 | */ |
bogdanm | 89:552587b429a1 | 37 | |
bogdanm | 89:552587b429a1 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 89:552587b429a1 | 39 | #ifndef __STM32F4xx_HAL_PWR_H |
bogdanm | 89:552587b429a1 | 40 | #define __STM32F4xx_HAL_PWR_H |
bogdanm | 89:552587b429a1 | 41 | |
bogdanm | 89:552587b429a1 | 42 | #ifdef __cplusplus |
bogdanm | 89:552587b429a1 | 43 | extern "C" { |
bogdanm | 89:552587b429a1 | 44 | #endif |
bogdanm | 89:552587b429a1 | 45 | |
bogdanm | 89:552587b429a1 | 46 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 89:552587b429a1 | 47 | #include "stm32f4xx_hal_def.h" |
bogdanm | 89:552587b429a1 | 48 | |
bogdanm | 89:552587b429a1 | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
bogdanm | 89:552587b429a1 | 50 | * @{ |
bogdanm | 89:552587b429a1 | 51 | */ |
bogdanm | 89:552587b429a1 | 52 | |
bogdanm | 89:552587b429a1 | 53 | /** @addtogroup PWR |
bogdanm | 89:552587b429a1 | 54 | * @{ |
bogdanm | 89:552587b429a1 | 55 | */ |
bogdanm | 89:552587b429a1 | 56 | |
bogdanm | 89:552587b429a1 | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 89:552587b429a1 | 58 | /** |
bogdanm | 89:552587b429a1 | 59 | * @brief PWR PVD configuration structure definition |
bogdanm | 89:552587b429a1 | 60 | */ |
bogdanm | 89:552587b429a1 | 61 | typedef struct |
bogdanm | 89:552587b429a1 | 62 | { |
bogdanm | 89:552587b429a1 | 63 | uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level. |
bogdanm | 89:552587b429a1 | 64 | This parameter can be a value of @ref PWR_PVD_detection_level */ |
bogdanm | 89:552587b429a1 | 65 | |
bogdanm | 89:552587b429a1 | 66 | uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins. |
bogdanm | 89:552587b429a1 | 67 | This parameter can be a value of @ref PWR_PVD_Mode */ |
bogdanm | 89:552587b429a1 | 68 | }PWR_PVDTypeDef; |
bogdanm | 89:552587b429a1 | 69 | |
bogdanm | 89:552587b429a1 | 70 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 89:552587b429a1 | 71 | /* ------------- PWR registers bit address in the alias region ---------------*/ |
bogdanm | 89:552587b429a1 | 72 | #define PWR_OFFSET (PWR_BASE - PERIPH_BASE) |
bogdanm | 89:552587b429a1 | 73 | |
bogdanm | 89:552587b429a1 | 74 | /* --- CR Register ---*/ |
bogdanm | 89:552587b429a1 | 75 | /* Alias word address of DBP bit */ |
bogdanm | 89:552587b429a1 | 76 | #define CR_OFFSET (PWR_OFFSET + 0x00) |
bogdanm | 89:552587b429a1 | 77 | #define DBP_BitNumber 0x08 |
bogdanm | 89:552587b429a1 | 78 | #define CR_DBP_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (DBP_BitNumber * 4)) |
bogdanm | 89:552587b429a1 | 79 | |
bogdanm | 89:552587b429a1 | 80 | /* Alias word address of PVDE bit */ |
bogdanm | 89:552587b429a1 | 81 | #define PVDE_BitNumber 0x04 |
bogdanm | 89:552587b429a1 | 82 | #define CR_PVDE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PVDE_BitNumber * 4)) |
bogdanm | 89:552587b429a1 | 83 | |
bogdanm | 89:552587b429a1 | 84 | /* Alias word address of FPDS bit */ |
bogdanm | 89:552587b429a1 | 85 | #define FPDS_BitNumber 0x09 |
bogdanm | 89:552587b429a1 | 86 | #define CR_FPDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (FPDS_BitNumber * 4)) |
bogdanm | 89:552587b429a1 | 87 | |
bogdanm | 89:552587b429a1 | 88 | /* Alias word address of PMODE bit */ |
bogdanm | 89:552587b429a1 | 89 | #define PMODE_BitNumber 0x0E |
bogdanm | 89:552587b429a1 | 90 | #define CR_PMODE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PMODE_BitNumber * 4)) |
bogdanm | 89:552587b429a1 | 91 | |
bogdanm | 89:552587b429a1 | 92 | /* --- CSR Register ---*/ |
bogdanm | 89:552587b429a1 | 93 | /* Alias word address of EWUP bit */ |
bogdanm | 89:552587b429a1 | 94 | #define CSR_OFFSET (PWR_OFFSET + 0x04) |
bogdanm | 89:552587b429a1 | 95 | #define EWUP_BitNumber 0x08 |
bogdanm | 89:552587b429a1 | 96 | #define CSR_EWUP_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP_BitNumber * 4)) |
bogdanm | 89:552587b429a1 | 97 | |
bogdanm | 89:552587b429a1 | 98 | /* Alias word address of BRE bit */ |
bogdanm | 89:552587b429a1 | 99 | #define BRE_BitNumber 0x09 |
bogdanm | 89:552587b429a1 | 100 | #define CSR_BRE_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (BRE_BitNumber * 4)) |
bogdanm | 89:552587b429a1 | 101 | |
bogdanm | 89:552587b429a1 | 102 | /** @defgroup PWR_Exported_Constants |
bogdanm | 89:552587b429a1 | 103 | * @{ |
bogdanm | 89:552587b429a1 | 104 | */ |
bogdanm | 89:552587b429a1 | 105 | |
bogdanm | 89:552587b429a1 | 106 | /** @defgroup PWR_WakeUp_Pins |
bogdanm | 89:552587b429a1 | 107 | * @{ |
bogdanm | 89:552587b429a1 | 108 | */ |
bogdanm | 89:552587b429a1 | 109 | |
bogdanm | 89:552587b429a1 | 110 | #define PWR_WAKEUP_PIN1 PWR_CSR_EWUP |
bogdanm | 89:552587b429a1 | 111 | #define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1) |
bogdanm | 89:552587b429a1 | 112 | /** |
bogdanm | 89:552587b429a1 | 113 | * @} |
bogdanm | 89:552587b429a1 | 114 | */ |
bogdanm | 89:552587b429a1 | 115 | |
bogdanm | 89:552587b429a1 | 116 | /** @defgroup PWR_PVD_detection_level |
bogdanm | 89:552587b429a1 | 117 | * @{ |
bogdanm | 89:552587b429a1 | 118 | */ |
bogdanm | 89:552587b429a1 | 119 | #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0 |
bogdanm | 89:552587b429a1 | 120 | #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1 |
bogdanm | 89:552587b429a1 | 121 | #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2 |
bogdanm | 89:552587b429a1 | 122 | #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3 |
bogdanm | 89:552587b429a1 | 123 | #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4 |
bogdanm | 89:552587b429a1 | 124 | #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5 |
bogdanm | 89:552587b429a1 | 125 | #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6 |
bogdanm | 89:552587b429a1 | 126 | #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7 |
bogdanm | 89:552587b429a1 | 127 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \ |
bogdanm | 89:552587b429a1 | 128 | ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \ |
bogdanm | 89:552587b429a1 | 129 | ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \ |
bogdanm | 89:552587b429a1 | 130 | ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7)) |
bogdanm | 89:552587b429a1 | 131 | /** |
bogdanm | 89:552587b429a1 | 132 | * @} |
bogdanm | 89:552587b429a1 | 133 | */ |
bogdanm | 89:552587b429a1 | 134 | |
bogdanm | 89:552587b429a1 | 135 | /** @defgroup PWR_PVD_Mode |
bogdanm | 89:552587b429a1 | 136 | * @{ |
bogdanm | 89:552587b429a1 | 137 | */ |
bogdanm | 89:552587b429a1 | 138 | #define PWR_MODE_EVT ((uint32_t)0x00000000) /*!< No Interrupt */ |
bogdanm | 89:552587b429a1 | 139 | #define PWR_MODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */ |
bogdanm | 89:552587b429a1 | 140 | #define PWR_MODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */ |
bogdanm | 89:552587b429a1 | 141 | #define PWR_MODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
bogdanm | 89:552587b429a1 | 142 | #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_MODE_EVT) || ((MODE) == PWR_MODE_IT_RISING)|| \ |
bogdanm | 89:552587b429a1 | 143 | ((MODE) == PWR_MODE_IT_FALLING) || ((MODE) == PWR_MODE_IT_RISING_FALLING)) |
bogdanm | 89:552587b429a1 | 144 | /** |
bogdanm | 89:552587b429a1 | 145 | * @} |
bogdanm | 89:552587b429a1 | 146 | */ |
bogdanm | 89:552587b429a1 | 147 | |
bogdanm | 89:552587b429a1 | 148 | /** @defgroup PWR_Regulator_state_in_STOP_mode |
bogdanm | 89:552587b429a1 | 149 | * @{ |
bogdanm | 89:552587b429a1 | 150 | */ |
bogdanm | 89:552587b429a1 | 151 | #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000) |
bogdanm | 89:552587b429a1 | 152 | #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS |
bogdanm | 89:552587b429a1 | 153 | |
bogdanm | 89:552587b429a1 | 154 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ |
bogdanm | 89:552587b429a1 | 155 | ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) |
bogdanm | 89:552587b429a1 | 156 | /** |
bogdanm | 89:552587b429a1 | 157 | * @} |
bogdanm | 89:552587b429a1 | 158 | */ |
bogdanm | 89:552587b429a1 | 159 | |
bogdanm | 89:552587b429a1 | 160 | /** @defgroup PWR_SLEEP_mode_entry |
bogdanm | 89:552587b429a1 | 161 | * @{ |
bogdanm | 89:552587b429a1 | 162 | */ |
bogdanm | 89:552587b429a1 | 163 | #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) |
bogdanm | 89:552587b429a1 | 164 | #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) |
bogdanm | 89:552587b429a1 | 165 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) |
bogdanm | 89:552587b429a1 | 166 | /** |
bogdanm | 89:552587b429a1 | 167 | * @} |
bogdanm | 89:552587b429a1 | 168 | */ |
bogdanm | 89:552587b429a1 | 169 | |
bogdanm | 89:552587b429a1 | 170 | /** @defgroup PWR_STOP_mode_entry |
bogdanm | 89:552587b429a1 | 171 | * @{ |
bogdanm | 89:552587b429a1 | 172 | */ |
bogdanm | 89:552587b429a1 | 173 | #define PWR_STOPENTRY_WFI ((uint8_t)0x01) |
bogdanm | 89:552587b429a1 | 174 | #define PWR_STOPENTRY_WFE ((uint8_t)0x02) |
bogdanm | 89:552587b429a1 | 175 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) |
bogdanm | 89:552587b429a1 | 176 | /** |
bogdanm | 89:552587b429a1 | 177 | * @} |
bogdanm | 89:552587b429a1 | 178 | */ |
bogdanm | 89:552587b429a1 | 179 | |
bogdanm | 89:552587b429a1 | 180 | /** @defgroup PWR_Regulator_Voltage_Scale |
bogdanm | 89:552587b429a1 | 181 | * @{ |
bogdanm | 89:552587b429a1 | 182 | */ |
bogdanm | 89:552587b429a1 | 183 | #define PWR_REGULATOR_VOLTAGE_SCALE1 ((uint32_t)0x0000C000) |
bogdanm | 89:552587b429a1 | 184 | #define PWR_REGULATOR_VOLTAGE_SCALE2 ((uint32_t)0x00008000) |
bogdanm | 89:552587b429a1 | 185 | #define PWR_REGULATOR_VOLTAGE_SCALE3 ((uint32_t)0x00004000) |
bogdanm | 89:552587b429a1 | 186 | #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \ |
bogdanm | 89:552587b429a1 | 187 | ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \ |
bogdanm | 89:552587b429a1 | 188 | ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3)) |
bogdanm | 89:552587b429a1 | 189 | /** |
bogdanm | 89:552587b429a1 | 190 | * @} |
bogdanm | 89:552587b429a1 | 191 | */ |
bogdanm | 89:552587b429a1 | 192 | |
bogdanm | 89:552587b429a1 | 193 | /** @defgroup PWR_Flag |
bogdanm | 89:552587b429a1 | 194 | * @{ |
bogdanm | 89:552587b429a1 | 195 | */ |
bogdanm | 89:552587b429a1 | 196 | #define PWR_FLAG_WU PWR_CSR_WUF |
bogdanm | 89:552587b429a1 | 197 | #define PWR_FLAG_SB PWR_CSR_SBF |
bogdanm | 89:552587b429a1 | 198 | #define PWR_FLAG_PVDO PWR_CSR_PVDO |
bogdanm | 89:552587b429a1 | 199 | #define PWR_FLAG_BRR PWR_CSR_BRR |
bogdanm | 89:552587b429a1 | 200 | #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY |
bogdanm | 89:552587b429a1 | 201 | |
bogdanm | 89:552587b429a1 | 202 | /** |
bogdanm | 89:552587b429a1 | 203 | * @} |
bogdanm | 89:552587b429a1 | 204 | */ |
bogdanm | 89:552587b429a1 | 205 | |
bogdanm | 89:552587b429a1 | 206 | /** |
bogdanm | 89:552587b429a1 | 207 | * @} |
bogdanm | 89:552587b429a1 | 208 | */ |
bogdanm | 89:552587b429a1 | 209 | |
bogdanm | 89:552587b429a1 | 210 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 89:552587b429a1 | 211 | |
bogdanm | 89:552587b429a1 | 212 | /** @brief macros configure the main internal regulator output voltage. |
bogdanm | 89:552587b429a1 | 213 | * @param __REGULATOR__: specifies the regulator output voltage to achieve |
bogdanm | 89:552587b429a1 | 214 | * a tradeoff between performance and power consumption when the device does |
bogdanm | 89:552587b429a1 | 215 | * not operate at the maximum frequency (refer to the datasheets for more details). |
bogdanm | 89:552587b429a1 | 216 | * This parameter can be one of the following values: |
bogdanm | 89:552587b429a1 | 217 | * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode |
bogdanm | 89:552587b429a1 | 218 | * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode |
bogdanm | 89:552587b429a1 | 219 | * @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output Scale 3 mode |
bogdanm | 89:552587b429a1 | 220 | * @retval None |
bogdanm | 89:552587b429a1 | 221 | */ |
bogdanm | 89:552587b429a1 | 222 | #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) (MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__))) |
bogdanm | 89:552587b429a1 | 223 | |
bogdanm | 89:552587b429a1 | 224 | /** @brief Check PWR flag is set or not. |
bogdanm | 89:552587b429a1 | 225 | * @param __FLAG__: specifies the flag to check. |
bogdanm | 89:552587b429a1 | 226 | * This parameter can be one of the following values: |
bogdanm | 89:552587b429a1 | 227 | * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event |
bogdanm | 89:552587b429a1 | 228 | * was received from the WKUP pin or from the RTC alarm (Alarm A |
bogdanm | 89:552587b429a1 | 229 | * or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup. |
bogdanm | 89:552587b429a1 | 230 | * An additional wakeup event is detected if the WKUP pin is enabled |
bogdanm | 89:552587b429a1 | 231 | * (by setting the EWUP bit) when the WKUP pin level is already high. |
bogdanm | 89:552587b429a1 | 232 | * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was |
bogdanm | 89:552587b429a1 | 233 | * resumed from StandBy mode. |
bogdanm | 89:552587b429a1 | 234 | * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled |
bogdanm | 89:552587b429a1 | 235 | * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode |
bogdanm | 89:552587b429a1 | 236 | * For this reason, this bit is equal to 0 after Standby or reset |
bogdanm | 89:552587b429a1 | 237 | * until the PVDE bit is set. |
bogdanm | 89:552587b429a1 | 238 | * @arg PWR_FLAG_BRR: Backup regulator ready flag. This bit is not reset |
bogdanm | 89:552587b429a1 | 239 | * when the device wakes up from Standby mode or by a system reset |
bogdanm | 89:552587b429a1 | 240 | * or power reset. |
bogdanm | 89:552587b429a1 | 241 | * @arg PWR_FLAG_VOSRDY: This flag indicates that the Regulator voltage |
bogdanm | 89:552587b429a1 | 242 | * scaling output selection is ready. |
bogdanm | 89:552587b429a1 | 243 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
bogdanm | 89:552587b429a1 | 244 | */ |
bogdanm | 89:552587b429a1 | 245 | #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) |
bogdanm | 89:552587b429a1 | 246 | |
bogdanm | 89:552587b429a1 | 247 | /** @brief Clear the PWR's pending flags. |
bogdanm | 89:552587b429a1 | 248 | * @param __FLAG__: specifies the flag to clear. |
bogdanm | 89:552587b429a1 | 249 | * This parameter can be one of the following values: |
bogdanm | 89:552587b429a1 | 250 | * @arg PWR_FLAG_WU: Wake Up flag |
bogdanm | 89:552587b429a1 | 251 | * @arg PWR_FLAG_SB: StandBy flag |
bogdanm | 89:552587b429a1 | 252 | */ |
bogdanm | 89:552587b429a1 | 253 | #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2) |
bogdanm | 89:552587b429a1 | 254 | |
bogdanm | 89:552587b429a1 | 255 | #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */ |
bogdanm | 89:552587b429a1 | 256 | /** |
bogdanm | 89:552587b429a1 | 257 | * @brief Enable the PVD Exti Line. |
bogdanm | 89:552587b429a1 | 258 | * @param __EXTILINE__: specifies the PVD Exti sources to be enabled. |
bogdanm | 89:552587b429a1 | 259 | * This parameter can be: |
bogdanm | 89:552587b429a1 | 260 | * @arg PWR_EXTI_LINE_PVD |
bogdanm | 89:552587b429a1 | 261 | * @retval None. |
bogdanm | 89:552587b429a1 | 262 | */ |
bogdanm | 89:552587b429a1 | 263 | #define __HAL_PVD_EXTI_ENABLE_IT(__EXTILINE__) (EXTI->IMR |= (__EXTILINE__)) |
bogdanm | 89:552587b429a1 | 264 | |
bogdanm | 89:552587b429a1 | 265 | /** |
bogdanm | 89:552587b429a1 | 266 | * @brief Disable the PVD EXTI Line. |
bogdanm | 89:552587b429a1 | 267 | * @param __EXTILINE__: specifies the PVD EXTI sources to be disabled. |
bogdanm | 89:552587b429a1 | 268 | * This parameter can be: |
bogdanm | 89:552587b429a1 | 269 | * @arg PWR_EXTI_LINE_PVD |
bogdanm | 89:552587b429a1 | 270 | * @retval None. |
bogdanm | 89:552587b429a1 | 271 | */ |
bogdanm | 89:552587b429a1 | 272 | #define __HAL_PVD_EXTI_DISABLE_IT(__EXTILINE__) (EXTI->IMR &= ~(__EXTILINE__)) |
bogdanm | 89:552587b429a1 | 273 | |
bogdanm | 89:552587b429a1 | 274 | /** |
bogdanm | 89:552587b429a1 | 275 | * @brief checks whether the specified PVD Exti interrupt flag is set or not. |
bogdanm | 89:552587b429a1 | 276 | * @param __EXTILINE__: specifies the PVD Exti sources to be cleared. |
bogdanm | 89:552587b429a1 | 277 | * This parameter can be: |
bogdanm | 89:552587b429a1 | 278 | * @arg PWR_EXTI_LINE_PVD |
bogdanm | 89:552587b429a1 | 279 | * @retval EXTI PVD Line Status. |
bogdanm | 89:552587b429a1 | 280 | */ |
bogdanm | 89:552587b429a1 | 281 | #define __HAL_PVD_EXTI_GET_FLAG(__EXTILINE__) (EXTI->PR & (__EXTILINE__)) |
bogdanm | 89:552587b429a1 | 282 | |
bogdanm | 89:552587b429a1 | 283 | /** |
bogdanm | 89:552587b429a1 | 284 | * @brief Clear the PVD Exti flag. |
bogdanm | 89:552587b429a1 | 285 | * @param __EXTILINE__: specifies the PVD Exti sources to be cleared. |
bogdanm | 89:552587b429a1 | 286 | * This parameter can be: |
bogdanm | 89:552587b429a1 | 287 | * @arg PWR_EXTI_LINE_PVD |
bogdanm | 89:552587b429a1 | 288 | * @retval None. |
bogdanm | 89:552587b429a1 | 289 | */ |
bogdanm | 89:552587b429a1 | 290 | #define __HAL_PVD_EXTI_CLEAR_FLAG(__EXTILINE__) (EXTI->PR = (__EXTILINE__)) |
bogdanm | 89:552587b429a1 | 291 | |
bogdanm | 89:552587b429a1 | 292 | |
bogdanm | 89:552587b429a1 | 293 | /* Include PWR HAL Extension module */ |
bogdanm | 89:552587b429a1 | 294 | #include "stm32f4xx_hal_pwr_ex.h" |
bogdanm | 89:552587b429a1 | 295 | |
bogdanm | 89:552587b429a1 | 296 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 89:552587b429a1 | 297 | |
bogdanm | 89:552587b429a1 | 298 | /* Initialization and de-initialization functions *******************************/ |
bogdanm | 89:552587b429a1 | 299 | void HAL_PWR_DeInit(void); |
bogdanm | 89:552587b429a1 | 300 | void HAL_PWR_EnableBkUpAccess(void); |
bogdanm | 89:552587b429a1 | 301 | void HAL_PWR_DisableBkUpAccess(void); |
bogdanm | 89:552587b429a1 | 302 | |
bogdanm | 89:552587b429a1 | 303 | /* Peripheral Control functions ************************************************/ |
bogdanm | 89:552587b429a1 | 304 | void HAL_PWR_PVDConfig(PWR_PVDTypeDef *sConfigPVD); |
bogdanm | 89:552587b429a1 | 305 | void HAL_PWR_EnablePVD(void); |
bogdanm | 89:552587b429a1 | 306 | void HAL_PWR_DisablePVD(void); |
bogdanm | 89:552587b429a1 | 307 | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); |
bogdanm | 89:552587b429a1 | 308 | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); |
bogdanm | 89:552587b429a1 | 309 | |
bogdanm | 89:552587b429a1 | 310 | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); |
bogdanm | 89:552587b429a1 | 311 | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); |
bogdanm | 89:552587b429a1 | 312 | void HAL_PWR_EnterSTANDBYMode(void); |
bogdanm | 89:552587b429a1 | 313 | |
bogdanm | 89:552587b429a1 | 314 | void HAL_PWR_PVD_IRQHandler(void); |
bogdanm | 89:552587b429a1 | 315 | void HAL_PWR_PVDCallback(void); |
bogdanm | 89:552587b429a1 | 316 | |
bogdanm | 89:552587b429a1 | 317 | |
bogdanm | 89:552587b429a1 | 318 | /** |
bogdanm | 89:552587b429a1 | 319 | * @} |
bogdanm | 89:552587b429a1 | 320 | */ |
bogdanm | 89:552587b429a1 | 321 | |
bogdanm | 89:552587b429a1 | 322 | /** |
bogdanm | 89:552587b429a1 | 323 | * @} |
bogdanm | 89:552587b429a1 | 324 | */ |
bogdanm | 89:552587b429a1 | 325 | |
bogdanm | 89:552587b429a1 | 326 | #ifdef __cplusplus |
bogdanm | 89:552587b429a1 | 327 | } |
bogdanm | 89:552587b429a1 | 328 | #endif |
bogdanm | 89:552587b429a1 | 329 | |
bogdanm | 89:552587b429a1 | 330 | |
bogdanm | 89:552587b429a1 | 331 | #endif /* __STM32F4xx_HAL_PWR_H */ |
bogdanm | 89:552587b429a1 | 332 | |
bogdanm | 89:552587b429a1 | 333 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |