mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_pwr.h@630:825f75ca301e, 2015-09-28 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Sep 28 10:45:10 2015 +0100
- Revision:
- 630:825f75ca301e
- Parent:
- 441:d2c15dda23c1
Synchronized with git revision 54fbe4144faf309c37205a5d39fa665daa919f10
Full URL: https://github.com/mbedmicro/mbed/commit/54fbe4144faf309c37205a5d39fa665daa919f10/
NUCLEO_F031K6 : Add new target
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 340:28d1f895c6fe | 1 | /** |
mbed_official | 340:28d1f895c6fe | 2 | ****************************************************************************** |
mbed_official | 340:28d1f895c6fe | 3 | * @file stm32f0xx_hal_pwr.h |
mbed_official | 340:28d1f895c6fe | 4 | * @author MCD Application Team |
mbed_official | 630:825f75ca301e | 5 | * @version V1.3.0 |
mbed_official | 630:825f75ca301e | 6 | * @date 26-June-2015 |
mbed_official | 340:28d1f895c6fe | 7 | * @brief Header file of PWR HAL module. |
mbed_official | 340:28d1f895c6fe | 8 | ****************************************************************************** |
mbed_official | 340:28d1f895c6fe | 9 | * @attention |
mbed_official | 340:28d1f895c6fe | 10 | * |
mbed_official | 630:825f75ca301e | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
mbed_official | 340:28d1f895c6fe | 12 | * |
mbed_official | 340:28d1f895c6fe | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 340:28d1f895c6fe | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 340:28d1f895c6fe | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 340:28d1f895c6fe | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 340:28d1f895c6fe | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 340:28d1f895c6fe | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 340:28d1f895c6fe | 19 | * and/or other materials provided with the distribution. |
mbed_official | 340:28d1f895c6fe | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 340:28d1f895c6fe | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 340:28d1f895c6fe | 22 | * without specific prior written permission. |
mbed_official | 340:28d1f895c6fe | 23 | * |
mbed_official | 340:28d1f895c6fe | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 340:28d1f895c6fe | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 340:28d1f895c6fe | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 340:28d1f895c6fe | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 340:28d1f895c6fe | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 340:28d1f895c6fe | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 340:28d1f895c6fe | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 340:28d1f895c6fe | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 340:28d1f895c6fe | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 340:28d1f895c6fe | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 340:28d1f895c6fe | 34 | * |
mbed_official | 340:28d1f895c6fe | 35 | ****************************************************************************** |
mbed_official | 340:28d1f895c6fe | 36 | */ |
mbed_official | 340:28d1f895c6fe | 37 | |
mbed_official | 340:28d1f895c6fe | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 340:28d1f895c6fe | 39 | #ifndef __STM32F0xx_HAL_PWR_H |
mbed_official | 340:28d1f895c6fe | 40 | #define __STM32F0xx_HAL_PWR_H |
mbed_official | 340:28d1f895c6fe | 41 | |
mbed_official | 340:28d1f895c6fe | 42 | #ifdef __cplusplus |
mbed_official | 340:28d1f895c6fe | 43 | extern "C" { |
mbed_official | 340:28d1f895c6fe | 44 | #endif |
mbed_official | 340:28d1f895c6fe | 45 | |
mbed_official | 340:28d1f895c6fe | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 340:28d1f895c6fe | 47 | #include "stm32f0xx_hal_def.h" |
mbed_official | 340:28d1f895c6fe | 48 | |
mbed_official | 340:28d1f895c6fe | 49 | /** @addtogroup STM32F0xx_HAL_Driver |
mbed_official | 340:28d1f895c6fe | 50 | * @{ |
mbed_official | 340:28d1f895c6fe | 51 | */ |
mbed_official | 340:28d1f895c6fe | 52 | |
mbed_official | 630:825f75ca301e | 53 | /** @addtogroup PWR PWR |
mbed_official | 340:28d1f895c6fe | 54 | * @{ |
mbed_official | 340:28d1f895c6fe | 55 | */ |
mbed_official | 340:28d1f895c6fe | 56 | |
mbed_official | 340:28d1f895c6fe | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 340:28d1f895c6fe | 58 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 340:28d1f895c6fe | 59 | |
mbed_official | 340:28d1f895c6fe | 60 | /** @defgroup PWR_Exported_Constants PWR Exported Constants |
mbed_official | 340:28d1f895c6fe | 61 | * @{ |
mbed_official | 340:28d1f895c6fe | 62 | */ |
mbed_official | 340:28d1f895c6fe | 63 | |
mbed_official | 340:28d1f895c6fe | 64 | /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode |
mbed_official | 340:28d1f895c6fe | 65 | * @{ |
mbed_official | 340:28d1f895c6fe | 66 | */ |
mbed_official | 340:28d1f895c6fe | 67 | #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000) |
mbed_official | 340:28d1f895c6fe | 68 | #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS |
mbed_official | 340:28d1f895c6fe | 69 | |
mbed_official | 340:28d1f895c6fe | 70 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ |
mbed_official | 340:28d1f895c6fe | 71 | ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) |
mbed_official | 340:28d1f895c6fe | 72 | /** |
mbed_official | 340:28d1f895c6fe | 73 | * @} |
mbed_official | 340:28d1f895c6fe | 74 | */ |
mbed_official | 340:28d1f895c6fe | 75 | |
mbed_official | 340:28d1f895c6fe | 76 | /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry |
mbed_official | 340:28d1f895c6fe | 77 | * @{ |
mbed_official | 340:28d1f895c6fe | 78 | */ |
mbed_official | 340:28d1f895c6fe | 79 | #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) |
mbed_official | 340:28d1f895c6fe | 80 | #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) |
mbed_official | 340:28d1f895c6fe | 81 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) |
mbed_official | 340:28d1f895c6fe | 82 | /** |
mbed_official | 340:28d1f895c6fe | 83 | * @} |
mbed_official | 340:28d1f895c6fe | 84 | */ |
mbed_official | 340:28d1f895c6fe | 85 | |
mbed_official | 340:28d1f895c6fe | 86 | /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry |
mbed_official | 340:28d1f895c6fe | 87 | * @{ |
mbed_official | 340:28d1f895c6fe | 88 | */ |
mbed_official | 340:28d1f895c6fe | 89 | #define PWR_STOPENTRY_WFI ((uint8_t)0x01) |
mbed_official | 340:28d1f895c6fe | 90 | #define PWR_STOPENTRY_WFE ((uint8_t)0x02) |
mbed_official | 340:28d1f895c6fe | 91 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) |
mbed_official | 340:28d1f895c6fe | 92 | /** |
mbed_official | 340:28d1f895c6fe | 93 | * @} |
mbed_official | 340:28d1f895c6fe | 94 | */ |
mbed_official | 340:28d1f895c6fe | 95 | |
mbed_official | 340:28d1f895c6fe | 96 | |
mbed_official | 340:28d1f895c6fe | 97 | /** |
mbed_official | 340:28d1f895c6fe | 98 | * @} |
mbed_official | 340:28d1f895c6fe | 99 | */ |
mbed_official | 340:28d1f895c6fe | 100 | |
mbed_official | 340:28d1f895c6fe | 101 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 340:28d1f895c6fe | 102 | /** @defgroup PWR_Exported_Macro PWR Exported Macro |
mbed_official | 340:28d1f895c6fe | 103 | * @{ |
mbed_official | 340:28d1f895c6fe | 104 | */ |
mbed_official | 340:28d1f895c6fe | 105 | |
mbed_official | 340:28d1f895c6fe | 106 | /** @brief Check PWR flag is set or not. |
mbed_official | 340:28d1f895c6fe | 107 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 340:28d1f895c6fe | 108 | * This parameter can be one of the following values: |
mbed_official | 340:28d1f895c6fe | 109 | * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event |
mbed_official | 340:28d1f895c6fe | 110 | * was received from the WKUP pin or from the RTC alarm (Alarm A), |
mbed_official | 340:28d1f895c6fe | 111 | * RTC Tamper event, RTC TimeStamp event or RTC Wakeup. |
mbed_official | 340:28d1f895c6fe | 112 | * An additional wakeup event is detected if the WKUP pin is enabled |
mbed_official | 340:28d1f895c6fe | 113 | * (by setting the EWUP bit) when the WKUP pin level is already high. |
mbed_official | 340:28d1f895c6fe | 114 | * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was |
mbed_official | 340:28d1f895c6fe | 115 | * resumed from StandBy mode. |
mbed_official | 340:28d1f895c6fe | 116 | * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled |
mbed_official | 340:28d1f895c6fe | 117 | * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode |
mbed_official | 340:28d1f895c6fe | 118 | * For this reason, this bit is equal to 0 after Standby or reset |
mbed_official | 340:28d1f895c6fe | 119 | * until the PVDE bit is set. |
mbed_official | 340:28d1f895c6fe | 120 | * Warning: this Flag is not available on STM32F030x8 products |
mbed_official | 340:28d1f895c6fe | 121 | * @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference |
mbed_official | 340:28d1f895c6fe | 122 | * voltage VREFINT is ready. |
mbed_official | 340:28d1f895c6fe | 123 | * Warning: this Flag is not available on STM32F030x8 products |
mbed_official | 340:28d1f895c6fe | 124 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 340:28d1f895c6fe | 125 | */ |
mbed_official | 340:28d1f895c6fe | 126 | #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) |
mbed_official | 340:28d1f895c6fe | 127 | |
mbed_official | 340:28d1f895c6fe | 128 | /** @brief Clear the PWR's pending flags. |
mbed_official | 340:28d1f895c6fe | 129 | * @param __FLAG__: specifies the flag to clear. |
mbed_official | 340:28d1f895c6fe | 130 | * This parameter can be one of the following values: |
mbed_official | 340:28d1f895c6fe | 131 | * @arg PWR_FLAG_WU: Wake Up flag |
mbed_official | 340:28d1f895c6fe | 132 | * @arg PWR_FLAG_SB: StandBy flag |
mbed_official | 340:28d1f895c6fe | 133 | */ |
mbed_official | 340:28d1f895c6fe | 134 | #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2) |
mbed_official | 340:28d1f895c6fe | 135 | |
mbed_official | 340:28d1f895c6fe | 136 | |
mbed_official | 340:28d1f895c6fe | 137 | /** |
mbed_official | 340:28d1f895c6fe | 138 | * @} |
mbed_official | 340:28d1f895c6fe | 139 | */ |
mbed_official | 340:28d1f895c6fe | 140 | |
mbed_official | 340:28d1f895c6fe | 141 | /* Include PWR HAL Extension module */ |
mbed_official | 340:28d1f895c6fe | 142 | #include "stm32f0xx_hal_pwr_ex.h" |
mbed_official | 340:28d1f895c6fe | 143 | |
mbed_official | 340:28d1f895c6fe | 144 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 340:28d1f895c6fe | 145 | |
mbed_official | 340:28d1f895c6fe | 146 | /** @addtogroup PWR_Exported_Functions PWR Exported Functions |
mbed_official | 340:28d1f895c6fe | 147 | * @{ |
mbed_official | 340:28d1f895c6fe | 148 | */ |
mbed_official | 340:28d1f895c6fe | 149 | |
mbed_official | 340:28d1f895c6fe | 150 | /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions |
mbed_official | 340:28d1f895c6fe | 151 | * @{ |
mbed_official | 340:28d1f895c6fe | 152 | */ |
mbed_official | 340:28d1f895c6fe | 153 | |
mbed_official | 340:28d1f895c6fe | 154 | /* Initialization and de-initialization functions *****************************/ |
mbed_official | 340:28d1f895c6fe | 155 | void HAL_PWR_DeInit(void); |
mbed_official | 340:28d1f895c6fe | 156 | |
mbed_official | 340:28d1f895c6fe | 157 | /** |
mbed_official | 340:28d1f895c6fe | 158 | * @} |
mbed_official | 340:28d1f895c6fe | 159 | */ |
mbed_official | 340:28d1f895c6fe | 160 | |
mbed_official | 340:28d1f895c6fe | 161 | /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions |
mbed_official | 340:28d1f895c6fe | 162 | * @{ |
mbed_official | 340:28d1f895c6fe | 163 | */ |
mbed_official | 340:28d1f895c6fe | 164 | |
mbed_official | 340:28d1f895c6fe | 165 | /* Peripheral Control functions **********************************************/ |
mbed_official | 340:28d1f895c6fe | 166 | void HAL_PWR_EnableBkUpAccess(void); |
mbed_official | 340:28d1f895c6fe | 167 | void HAL_PWR_DisableBkUpAccess(void); |
mbed_official | 340:28d1f895c6fe | 168 | |
mbed_official | 340:28d1f895c6fe | 169 | /* WakeUp pins configuration functions ****************************************/ |
mbed_official | 340:28d1f895c6fe | 170 | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); |
mbed_official | 340:28d1f895c6fe | 171 | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); |
mbed_official | 340:28d1f895c6fe | 172 | |
mbed_official | 340:28d1f895c6fe | 173 | /* Low Power modes configuration functions ************************************/ |
mbed_official | 340:28d1f895c6fe | 174 | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); |
mbed_official | 340:28d1f895c6fe | 175 | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); |
mbed_official | 340:28d1f895c6fe | 176 | void HAL_PWR_EnterSTANDBYMode(void); |
mbed_official | 340:28d1f895c6fe | 177 | |
mbed_official | 441:d2c15dda23c1 | 178 | void HAL_PWR_EnableSleepOnExit(void); |
mbed_official | 441:d2c15dda23c1 | 179 | void HAL_PWR_DisableSleepOnExit(void); |
mbed_official | 441:d2c15dda23c1 | 180 | void HAL_PWR_EnableSEVOnPend(void); |
mbed_official | 441:d2c15dda23c1 | 181 | void HAL_PWR_DisableSEVOnPend(void); |
mbed_official | 441:d2c15dda23c1 | 182 | |
mbed_official | 340:28d1f895c6fe | 183 | /** |
mbed_official | 340:28d1f895c6fe | 184 | * @} |
mbed_official | 340:28d1f895c6fe | 185 | */ |
mbed_official | 340:28d1f895c6fe | 186 | |
mbed_official | 340:28d1f895c6fe | 187 | /** |
mbed_official | 340:28d1f895c6fe | 188 | * @} |
mbed_official | 340:28d1f895c6fe | 189 | */ |
mbed_official | 340:28d1f895c6fe | 190 | |
mbed_official | 340:28d1f895c6fe | 191 | /** |
mbed_official | 340:28d1f895c6fe | 192 | * @} |
mbed_official | 340:28d1f895c6fe | 193 | */ |
mbed_official | 340:28d1f895c6fe | 194 | |
mbed_official | 340:28d1f895c6fe | 195 | /** |
mbed_official | 340:28d1f895c6fe | 196 | * @} |
mbed_official | 340:28d1f895c6fe | 197 | */ |
mbed_official | 340:28d1f895c6fe | 198 | |
mbed_official | 340:28d1f895c6fe | 199 | #ifdef __cplusplus |
mbed_official | 340:28d1f895c6fe | 200 | } |
mbed_official | 340:28d1f895c6fe | 201 | #endif |
mbed_official | 340:28d1f895c6fe | 202 | |
mbed_official | 340:28d1f895c6fe | 203 | |
mbed_official | 340:28d1f895c6fe | 204 | #endif /* __STM32F0xx_HAL_PWR_H */ |
mbed_official | 340:28d1f895c6fe | 205 | |
mbed_official | 340:28d1f895c6fe | 206 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
mbed_official | 340:28d1f895c6fe | 207 |