Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
TARGET_NUCLEO_F031K6/stm32f0xx_hal_pwr.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
- Parent:
- 109:9296ab0bfc11
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| Kojto | 109:9296ab0bfc11 | 1 | /** | 
| Kojto | 109:9296ab0bfc11 | 2 | ****************************************************************************** | 
| Kojto | 109:9296ab0bfc11 | 3 | * @file stm32f0xx_hal_pwr.h | 
| Kojto | 109:9296ab0bfc11 | 4 | * @author MCD Application Team | 
| Kojto | 122:f9eeca106725 | 5 | * @version V1.4.0 | 
| Kojto | 122:f9eeca106725 | 6 | * @date 27-May-2016 | 
| Kojto | 109:9296ab0bfc11 | 7 | * @brief Header file of PWR HAL module. | 
| Kojto | 109:9296ab0bfc11 | 8 | ****************************************************************************** | 
| Kojto | 109:9296ab0bfc11 | 9 | * @attention | 
| Kojto | 109:9296ab0bfc11 | 10 | * | 
| Kojto | 122:f9eeca106725 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | 
| Kojto | 109:9296ab0bfc11 | 12 | * | 
| Kojto | 109:9296ab0bfc11 | 13 | * Redistribution and use in source and binary forms, with or without modification, | 
| Kojto | 109:9296ab0bfc11 | 14 | * are permitted provided that the following conditions are met: | 
| Kojto | 109:9296ab0bfc11 | 15 | * 1. Redistributions of source code must retain the above copyright notice, | 
| Kojto | 109:9296ab0bfc11 | 16 | * this list of conditions and the following disclaimer. | 
| Kojto | 109:9296ab0bfc11 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, | 
| Kojto | 109:9296ab0bfc11 | 18 | * this list of conditions and the following disclaimer in the documentation | 
| Kojto | 109:9296ab0bfc11 | 19 | * and/or other materials provided with the distribution. | 
| Kojto | 109:9296ab0bfc11 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors | 
| Kojto | 109:9296ab0bfc11 | 21 | * may be used to endorse or promote products derived from this software | 
| Kojto | 109:9296ab0bfc11 | 22 | * without specific prior written permission. | 
| Kojto | 109:9296ab0bfc11 | 23 | * | 
| Kojto | 109:9296ab0bfc11 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
| Kojto | 109:9296ab0bfc11 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
| Kojto | 109:9296ab0bfc11 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
| Kojto | 109:9296ab0bfc11 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | 
| Kojto | 109:9296ab0bfc11 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
| Kojto | 109:9296ab0bfc11 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 
| Kojto | 109:9296ab0bfc11 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
| Kojto | 109:9296ab0bfc11 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
| Kojto | 109:9296ab0bfc11 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
| Kojto | 109:9296ab0bfc11 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| Kojto | 109:9296ab0bfc11 | 34 | * | 
| Kojto | 109:9296ab0bfc11 | 35 | ****************************************************************************** | 
| Kojto | 109:9296ab0bfc11 | 36 | */ | 
| Kojto | 109:9296ab0bfc11 | 37 | |
| Kojto | 109:9296ab0bfc11 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ | 
| Kojto | 109:9296ab0bfc11 | 39 | #ifndef __STM32F0xx_HAL_PWR_H | 
| Kojto | 109:9296ab0bfc11 | 40 | #define __STM32F0xx_HAL_PWR_H | 
| Kojto | 109:9296ab0bfc11 | 41 | |
| Kojto | 109:9296ab0bfc11 | 42 | #ifdef __cplusplus | 
| Kojto | 109:9296ab0bfc11 | 43 | extern "C" { | 
| Kojto | 109:9296ab0bfc11 | 44 | #endif | 
| Kojto | 109:9296ab0bfc11 | 45 | |
| Kojto | 109:9296ab0bfc11 | 46 | /* Includes ------------------------------------------------------------------*/ | 
| Kojto | 109:9296ab0bfc11 | 47 | #include "stm32f0xx_hal_def.h" | 
| Kojto | 109:9296ab0bfc11 | 48 | |
| Kojto | 109:9296ab0bfc11 | 49 | /** @addtogroup STM32F0xx_HAL_Driver | 
| Kojto | 109:9296ab0bfc11 | 50 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 51 | */ | 
| Kojto | 109:9296ab0bfc11 | 52 | |
| Kojto | 109:9296ab0bfc11 | 53 | /** @addtogroup PWR PWR | 
| Kojto | 109:9296ab0bfc11 | 54 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 55 | */ | 
| Kojto | 109:9296ab0bfc11 | 56 | |
| Kojto | 109:9296ab0bfc11 | 57 | /* Exported types ------------------------------------------------------------*/ | 
| Kojto | 109:9296ab0bfc11 | 58 | /* Exported constants --------------------------------------------------------*/ | 
| Kojto | 109:9296ab0bfc11 | 59 | |
| Kojto | 109:9296ab0bfc11 | 60 | /** @defgroup PWR_Exported_Constants PWR Exported Constants | 
| Kojto | 109:9296ab0bfc11 | 61 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 62 | */ | 
| Kojto | 109:9296ab0bfc11 | 63 | |
| Kojto | 109:9296ab0bfc11 | 64 | /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode | 
| Kojto | 109:9296ab0bfc11 | 65 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 66 | */ | 
| Kojto | 109:9296ab0bfc11 | 67 | #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000) | 
| Kojto | 109:9296ab0bfc11 | 68 | #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS | 
| Kojto | 109:9296ab0bfc11 | 69 | |
| Kojto | 109:9296ab0bfc11 | 70 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ | 
| Kojto | 109:9296ab0bfc11 | 71 | ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) | 
| Kojto | 109:9296ab0bfc11 | 72 | /** | 
| Kojto | 109:9296ab0bfc11 | 73 | * @} | 
| Kojto | 109:9296ab0bfc11 | 74 | */ | 
| Kojto | 109:9296ab0bfc11 | 75 | |
| Kojto | 109:9296ab0bfc11 | 76 | /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry | 
| Kojto | 109:9296ab0bfc11 | 77 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 78 | */ | 
| Kojto | 109:9296ab0bfc11 | 79 | #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) | 
| Kojto | 109:9296ab0bfc11 | 80 | #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) | 
| Kojto | 109:9296ab0bfc11 | 81 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) | 
| Kojto | 109:9296ab0bfc11 | 82 | /** | 
| Kojto | 109:9296ab0bfc11 | 83 | * @} | 
| Kojto | 109:9296ab0bfc11 | 84 | */ | 
| Kojto | 109:9296ab0bfc11 | 85 | |
| Kojto | 109:9296ab0bfc11 | 86 | /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry | 
| Kojto | 109:9296ab0bfc11 | 87 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 88 | */ | 
| Kojto | 109:9296ab0bfc11 | 89 | #define PWR_STOPENTRY_WFI ((uint8_t)0x01) | 
| Kojto | 109:9296ab0bfc11 | 90 | #define PWR_STOPENTRY_WFE ((uint8_t)0x02) | 
| Kojto | 109:9296ab0bfc11 | 91 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) | 
| Kojto | 109:9296ab0bfc11 | 92 | /** | 
| Kojto | 109:9296ab0bfc11 | 93 | * @} | 
| Kojto | 109:9296ab0bfc11 | 94 | */ | 
| Kojto | 109:9296ab0bfc11 | 95 | |
| Kojto | 109:9296ab0bfc11 | 96 | |
| Kojto | 109:9296ab0bfc11 | 97 | /** | 
| Kojto | 109:9296ab0bfc11 | 98 | * @} | 
| Kojto | 109:9296ab0bfc11 | 99 | */ | 
| Kojto | 109:9296ab0bfc11 | 100 | |
| Kojto | 109:9296ab0bfc11 | 101 | /* Exported macro ------------------------------------------------------------*/ | 
| Kojto | 109:9296ab0bfc11 | 102 | /** @defgroup PWR_Exported_Macro PWR Exported Macro | 
| Kojto | 109:9296ab0bfc11 | 103 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 104 | */ | 
| Kojto | 109:9296ab0bfc11 | 105 | |
| Kojto | 109:9296ab0bfc11 | 106 | /** @brief Check PWR flag is set or not. | 
| Kojto | 109:9296ab0bfc11 | 107 | * @param __FLAG__: specifies the flag to check. | 
| Kojto | 109:9296ab0bfc11 | 108 | * This parameter can be one of the following values: | 
| Kojto | 109:9296ab0bfc11 | 109 | * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event | 
| Kojto | 109:9296ab0bfc11 | 110 | * was received from the WKUP pin or from the RTC alarm (Alarm A), | 
| Kojto | 109:9296ab0bfc11 | 111 | * RTC Tamper event, RTC TimeStamp event or RTC Wakeup. | 
| Kojto | 109:9296ab0bfc11 | 112 | * An additional wakeup event is detected if the WKUP pin is enabled | 
| Kojto | 109:9296ab0bfc11 | 113 | * (by setting the EWUP bit) when the WKUP pin level is already high. | 
| Kojto | 109:9296ab0bfc11 | 114 | * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was | 
| Kojto | 109:9296ab0bfc11 | 115 | * resumed from StandBy mode. | 
| Kojto | 109:9296ab0bfc11 | 116 | * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled | 
| Kojto | 109:9296ab0bfc11 | 117 | * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode | 
| Kojto | 109:9296ab0bfc11 | 118 | * For this reason, this bit is equal to 0 after Standby or reset | 
| Kojto | 109:9296ab0bfc11 | 119 | * until the PVDE bit is set. | 
| Kojto | 109:9296ab0bfc11 | 120 | * Warning: this Flag is not available on STM32F030x8 products | 
| Kojto | 109:9296ab0bfc11 | 121 | * @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference | 
| Kojto | 109:9296ab0bfc11 | 122 | * voltage VREFINT is ready. | 
| Kojto | 109:9296ab0bfc11 | 123 | * Warning: this Flag is not available on STM32F030x8 products | 
| Kojto | 109:9296ab0bfc11 | 124 | * @retval The new state of __FLAG__ (TRUE or FALSE). | 
| Kojto | 109:9296ab0bfc11 | 125 | */ | 
| Kojto | 109:9296ab0bfc11 | 126 | #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) | 
| Kojto | 109:9296ab0bfc11 | 127 | |
| Kojto | 109:9296ab0bfc11 | 128 | /** @brief Clear the PWR's pending flags. | 
| Kojto | 109:9296ab0bfc11 | 129 | * @param __FLAG__: specifies the flag to clear. | 
| Kojto | 109:9296ab0bfc11 | 130 | * This parameter can be one of the following values: | 
| Kojto | 109:9296ab0bfc11 | 131 | * @arg PWR_FLAG_WU: Wake Up flag | 
| Kojto | 109:9296ab0bfc11 | 132 | * @arg PWR_FLAG_SB: StandBy flag | 
| Kojto | 109:9296ab0bfc11 | 133 | */ | 
| Kojto | 109:9296ab0bfc11 | 134 | #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2) | 
| Kojto | 109:9296ab0bfc11 | 135 | |
| Kojto | 109:9296ab0bfc11 | 136 | |
| Kojto | 109:9296ab0bfc11 | 137 | /** | 
| Kojto | 109:9296ab0bfc11 | 138 | * @} | 
| Kojto | 109:9296ab0bfc11 | 139 | */ | 
| Kojto | 109:9296ab0bfc11 | 140 | |
| Kojto | 109:9296ab0bfc11 | 141 | /* Include PWR HAL Extension module */ | 
| Kojto | 109:9296ab0bfc11 | 142 | #include "stm32f0xx_hal_pwr_ex.h" | 
| Kojto | 109:9296ab0bfc11 | 143 | |
| Kojto | 109:9296ab0bfc11 | 144 | /* Exported functions --------------------------------------------------------*/ | 
| Kojto | 109:9296ab0bfc11 | 145 | |
| Kojto | 109:9296ab0bfc11 | 146 | /** @addtogroup PWR_Exported_Functions PWR Exported Functions | 
| Kojto | 109:9296ab0bfc11 | 147 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 148 | */ | 
| Kojto | 109:9296ab0bfc11 | 149 | |
| Kojto | 109:9296ab0bfc11 | 150 | /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions | 
| Kojto | 109:9296ab0bfc11 | 151 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 152 | */ | 
| Kojto | 109:9296ab0bfc11 | 153 | |
| Kojto | 109:9296ab0bfc11 | 154 | /* Initialization and de-initialization functions *****************************/ | 
| Kojto | 109:9296ab0bfc11 | 155 | void HAL_PWR_DeInit(void); | 
| Kojto | 109:9296ab0bfc11 | 156 | |
| Kojto | 109:9296ab0bfc11 | 157 | /** | 
| Kojto | 109:9296ab0bfc11 | 158 | * @} | 
| Kojto | 109:9296ab0bfc11 | 159 | */ | 
| Kojto | 109:9296ab0bfc11 | 160 | |
| Kojto | 109:9296ab0bfc11 | 161 | /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions | 
| Kojto | 109:9296ab0bfc11 | 162 | * @{ | 
| Kojto | 109:9296ab0bfc11 | 163 | */ | 
| Kojto | 109:9296ab0bfc11 | 164 | |
| Kojto | 109:9296ab0bfc11 | 165 | /* Peripheral Control functions **********************************************/ | 
| Kojto | 109:9296ab0bfc11 | 166 | void HAL_PWR_EnableBkUpAccess(void); | 
| Kojto | 109:9296ab0bfc11 | 167 | void HAL_PWR_DisableBkUpAccess(void); | 
| Kojto | 109:9296ab0bfc11 | 168 | |
| Kojto | 109:9296ab0bfc11 | 169 | /* WakeUp pins configuration functions ****************************************/ | 
| Kojto | 109:9296ab0bfc11 | 170 | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); | 
| Kojto | 109:9296ab0bfc11 | 171 | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); | 
| Kojto | 109:9296ab0bfc11 | 172 | |
| Kojto | 109:9296ab0bfc11 | 173 | /* Low Power modes configuration functions ************************************/ | 
| Kojto | 109:9296ab0bfc11 | 174 | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); | 
| Kojto | 109:9296ab0bfc11 | 175 | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); | 
| Kojto | 109:9296ab0bfc11 | 176 | void HAL_PWR_EnterSTANDBYMode(void); | 
| Kojto | 109:9296ab0bfc11 | 177 | |
| Kojto | 109:9296ab0bfc11 | 178 | void HAL_PWR_EnableSleepOnExit(void); | 
| Kojto | 109:9296ab0bfc11 | 179 | void HAL_PWR_DisableSleepOnExit(void); | 
| Kojto | 109:9296ab0bfc11 | 180 | void HAL_PWR_EnableSEVOnPend(void); | 
| Kojto | 109:9296ab0bfc11 | 181 | void HAL_PWR_DisableSEVOnPend(void); | 
| Kojto | 109:9296ab0bfc11 | 182 | |
| Kojto | 109:9296ab0bfc11 | 183 | /** | 
| Kojto | 109:9296ab0bfc11 | 184 | * @} | 
| Kojto | 109:9296ab0bfc11 | 185 | */ | 
| Kojto | 109:9296ab0bfc11 | 186 | |
| Kojto | 109:9296ab0bfc11 | 187 | /** | 
| Kojto | 109:9296ab0bfc11 | 188 | * @} | 
| Kojto | 109:9296ab0bfc11 | 189 | */ | 
| Kojto | 109:9296ab0bfc11 | 190 | |
| Kojto | 109:9296ab0bfc11 | 191 | /** | 
| Kojto | 109:9296ab0bfc11 | 192 | * @} | 
| Kojto | 109:9296ab0bfc11 | 193 | */ | 
| Kojto | 109:9296ab0bfc11 | 194 | |
| Kojto | 109:9296ab0bfc11 | 195 | /** | 
| Kojto | 109:9296ab0bfc11 | 196 | * @} | 
| Kojto | 109:9296ab0bfc11 | 197 | */ | 
| Kojto | 109:9296ab0bfc11 | 198 | |
| Kojto | 109:9296ab0bfc11 | 199 | #ifdef __cplusplus | 
| Kojto | 109:9296ab0bfc11 | 200 | } | 
| Kojto | 109:9296ab0bfc11 | 201 | #endif | 
| Kojto | 109:9296ab0bfc11 | 202 | |
| Kojto | 109:9296ab0bfc11 | 203 | |
| Kojto | 109:9296ab0bfc11 | 204 | #endif /* __STM32F0xx_HAL_PWR_H */ | 
| Kojto | 109:9296ab0bfc11 | 205 | |
| Kojto | 109:9296ab0bfc11 | 206 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | 
| Kojto | 109:9296ab0bfc11 | 207 | 


