version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_NUCLEO_F302R8/stm32f30x_pwr.h@82:6473597d706e, 2014-04-07 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Apr 07 18:28:36 2014 +0100
- Revision:
- 82:6473597d706e
Release 82 of the mbed library
Main changes:
- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 82:6473597d706e | 1 | /** |
bogdanm | 82:6473597d706e | 2 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 3 | * @file stm32f30x_pwr.h |
bogdanm | 82:6473597d706e | 4 | * @author MCD Application Team |
bogdanm | 82:6473597d706e | 5 | * @version V1.1.0 |
bogdanm | 82:6473597d706e | 6 | * @date 27-February-2014 |
bogdanm | 82:6473597d706e | 7 | * @brief This file contains all the functions prototypes for the PWR firmware |
bogdanm | 82:6473597d706e | 8 | * library. |
bogdanm | 82:6473597d706e | 9 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 10 | * @attention |
bogdanm | 82:6473597d706e | 11 | * |
bogdanm | 82:6473597d706e | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 82:6473597d706e | 13 | * |
bogdanm | 82:6473597d706e | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 82:6473597d706e | 15 | * are permitted provided that the following conditions are met: |
bogdanm | 82:6473597d706e | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 82:6473597d706e | 17 | * this list of conditions and the following disclaimer. |
bogdanm | 82:6473597d706e | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 82:6473597d706e | 19 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 82:6473597d706e | 20 | * and/or other materials provided with the distribution. |
bogdanm | 82:6473597d706e | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 82:6473597d706e | 22 | * may be used to endorse or promote products derived from this software |
bogdanm | 82:6473597d706e | 23 | * without specific prior written permission. |
bogdanm | 82:6473597d706e | 24 | * |
bogdanm | 82:6473597d706e | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 82:6473597d706e | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 82:6473597d706e | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 82:6473597d706e | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 82:6473597d706e | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 82:6473597d706e | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 82:6473597d706e | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 82:6473597d706e | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 82:6473597d706e | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 82:6473597d706e | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 82:6473597d706e | 35 | * |
bogdanm | 82:6473597d706e | 36 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 37 | */ |
bogdanm | 82:6473597d706e | 38 | |
bogdanm | 82:6473597d706e | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 82:6473597d706e | 40 | #ifndef __STM32F30x_PWR_H |
bogdanm | 82:6473597d706e | 41 | #define __STM32F30x_PWR_H |
bogdanm | 82:6473597d706e | 42 | |
bogdanm | 82:6473597d706e | 43 | #ifdef __cplusplus |
bogdanm | 82:6473597d706e | 44 | extern "C" { |
bogdanm | 82:6473597d706e | 45 | #endif |
bogdanm | 82:6473597d706e | 46 | |
bogdanm | 82:6473597d706e | 47 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 48 | #include "stm32f30x.h" |
bogdanm | 82:6473597d706e | 49 | |
bogdanm | 82:6473597d706e | 50 | /** @addtogroup STM32F30x_StdPeriph_Driver |
bogdanm | 82:6473597d706e | 51 | * @{ |
bogdanm | 82:6473597d706e | 52 | */ |
bogdanm | 82:6473597d706e | 53 | |
bogdanm | 82:6473597d706e | 54 | /** @addtogroup PWR |
bogdanm | 82:6473597d706e | 55 | * @{ |
bogdanm | 82:6473597d706e | 56 | */ |
bogdanm | 82:6473597d706e | 57 | |
bogdanm | 82:6473597d706e | 58 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 59 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 60 | |
bogdanm | 82:6473597d706e | 61 | /** @defgroup PWR_Exported_Constants |
bogdanm | 82:6473597d706e | 62 | * @{ |
bogdanm | 82:6473597d706e | 63 | */ |
bogdanm | 82:6473597d706e | 64 | |
bogdanm | 82:6473597d706e | 65 | /** @defgroup PWR_PVD_detection_level |
bogdanm | 82:6473597d706e | 66 | * @{ |
bogdanm | 82:6473597d706e | 67 | */ |
bogdanm | 82:6473597d706e | 68 | |
bogdanm | 82:6473597d706e | 69 | #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0 |
bogdanm | 82:6473597d706e | 70 | #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1 |
bogdanm | 82:6473597d706e | 71 | #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2 |
bogdanm | 82:6473597d706e | 72 | #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3 |
bogdanm | 82:6473597d706e | 73 | #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4 |
bogdanm | 82:6473597d706e | 74 | #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5 |
bogdanm | 82:6473597d706e | 75 | #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6 |
bogdanm | 82:6473597d706e | 76 | #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7 |
bogdanm | 82:6473597d706e | 77 | |
bogdanm | 82:6473597d706e | 78 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \ |
bogdanm | 82:6473597d706e | 79 | ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \ |
bogdanm | 82:6473597d706e | 80 | ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \ |
bogdanm | 82:6473597d706e | 81 | ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7)) |
bogdanm | 82:6473597d706e | 82 | /** |
bogdanm | 82:6473597d706e | 83 | * @} |
bogdanm | 82:6473597d706e | 84 | */ |
bogdanm | 82:6473597d706e | 85 | |
bogdanm | 82:6473597d706e | 86 | /** @defgroup PWR_WakeUp_Pins |
bogdanm | 82:6473597d706e | 87 | * @{ |
bogdanm | 82:6473597d706e | 88 | */ |
bogdanm | 82:6473597d706e | 89 | |
bogdanm | 82:6473597d706e | 90 | #define PWR_WakeUpPin_1 PWR_CSR_EWUP1 |
bogdanm | 82:6473597d706e | 91 | #define PWR_WakeUpPin_2 PWR_CSR_EWUP2 |
bogdanm | 82:6473597d706e | 92 | #define PWR_WakeUpPin_3 PWR_CSR_EWUP3 |
bogdanm | 82:6473597d706e | 93 | #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUpPin_1) || \ |
bogdanm | 82:6473597d706e | 94 | ((PIN) == PWR_WakeUpPin_2) || \ |
bogdanm | 82:6473597d706e | 95 | ((PIN) == PWR_WakeUpPin_3)) |
bogdanm | 82:6473597d706e | 96 | /** |
bogdanm | 82:6473597d706e | 97 | * @} |
bogdanm | 82:6473597d706e | 98 | */ |
bogdanm | 82:6473597d706e | 99 | |
bogdanm | 82:6473597d706e | 100 | |
bogdanm | 82:6473597d706e | 101 | /** @defgroup PWR_Regulator_state_is_Sleep_STOP_mode |
bogdanm | 82:6473597d706e | 102 | * @{ |
bogdanm | 82:6473597d706e | 103 | */ |
bogdanm | 82:6473597d706e | 104 | |
bogdanm | 82:6473597d706e | 105 | #define PWR_Regulator_ON ((uint32_t)0x00000000) |
bogdanm | 82:6473597d706e | 106 | #define PWR_Regulator_LowPower PWR_CR_LPSDSR |
bogdanm | 82:6473597d706e | 107 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ |
bogdanm | 82:6473597d706e | 108 | ((REGULATOR) == PWR_Regulator_LowPower)) |
bogdanm | 82:6473597d706e | 109 | /** |
bogdanm | 82:6473597d706e | 110 | * @} |
bogdanm | 82:6473597d706e | 111 | */ |
bogdanm | 82:6473597d706e | 112 | |
bogdanm | 82:6473597d706e | 113 | /** @defgroup PWR_SLEEP_mode_entry |
bogdanm | 82:6473597d706e | 114 | * @{ |
bogdanm | 82:6473597d706e | 115 | */ |
bogdanm | 82:6473597d706e | 116 | |
bogdanm | 82:6473597d706e | 117 | #define PWR_SLEEPEntry_WFI ((uint8_t)0x01) |
bogdanm | 82:6473597d706e | 118 | #define PWR_SLEEPEntry_WFE ((uint8_t)0x02) |
bogdanm | 82:6473597d706e | 119 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE)) |
bogdanm | 82:6473597d706e | 120 | |
bogdanm | 82:6473597d706e | 121 | /** |
bogdanm | 82:6473597d706e | 122 | * @} |
bogdanm | 82:6473597d706e | 123 | */ |
bogdanm | 82:6473597d706e | 124 | |
bogdanm | 82:6473597d706e | 125 | /** @defgroup PWR_STOP_mode_entry |
bogdanm | 82:6473597d706e | 126 | * @{ |
bogdanm | 82:6473597d706e | 127 | */ |
bogdanm | 82:6473597d706e | 128 | |
bogdanm | 82:6473597d706e | 129 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) |
bogdanm | 82:6473597d706e | 130 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) |
bogdanm | 82:6473597d706e | 131 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) |
bogdanm | 82:6473597d706e | 132 | |
bogdanm | 82:6473597d706e | 133 | /** |
bogdanm | 82:6473597d706e | 134 | * @} |
bogdanm | 82:6473597d706e | 135 | */ |
bogdanm | 82:6473597d706e | 136 | |
bogdanm | 82:6473597d706e | 137 | /** @defgroup PWR_Flag |
bogdanm | 82:6473597d706e | 138 | * @{ |
bogdanm | 82:6473597d706e | 139 | */ |
bogdanm | 82:6473597d706e | 140 | |
bogdanm | 82:6473597d706e | 141 | #define PWR_FLAG_WU PWR_CSR_WUF |
bogdanm | 82:6473597d706e | 142 | #define PWR_FLAG_SB PWR_CSR_SBF |
bogdanm | 82:6473597d706e | 143 | #define PWR_FLAG_PVDO PWR_CSR_PVDO |
bogdanm | 82:6473597d706e | 144 | #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF |
bogdanm | 82:6473597d706e | 145 | |
bogdanm | 82:6473597d706e | 146 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ |
bogdanm | 82:6473597d706e | 147 | ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_VREFINTRDY)) |
bogdanm | 82:6473597d706e | 148 | |
bogdanm | 82:6473597d706e | 149 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) |
bogdanm | 82:6473597d706e | 150 | /** |
bogdanm | 82:6473597d706e | 151 | * @} |
bogdanm | 82:6473597d706e | 152 | */ |
bogdanm | 82:6473597d706e | 153 | |
bogdanm | 82:6473597d706e | 154 | /** |
bogdanm | 82:6473597d706e | 155 | * @} |
bogdanm | 82:6473597d706e | 156 | */ |
bogdanm | 82:6473597d706e | 157 | |
bogdanm | 82:6473597d706e | 158 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 159 | /* Exported functions ------------------------------------------------------- */ |
bogdanm | 82:6473597d706e | 160 | |
bogdanm | 82:6473597d706e | 161 | /* Function used to set the PWR configuration to the default reset state ******/ |
bogdanm | 82:6473597d706e | 162 | void PWR_DeInit(void); |
bogdanm | 82:6473597d706e | 163 | |
bogdanm | 82:6473597d706e | 164 | /* Backup Domain Access function **********************************************/ |
bogdanm | 82:6473597d706e | 165 | void PWR_BackupAccessCmd(FunctionalState NewState); |
bogdanm | 82:6473597d706e | 166 | |
bogdanm | 82:6473597d706e | 167 | /* PVD configuration functions ************************************************/ |
bogdanm | 82:6473597d706e | 168 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); |
bogdanm | 82:6473597d706e | 169 | void PWR_PVDCmd(FunctionalState NewState); |
bogdanm | 82:6473597d706e | 170 | |
bogdanm | 82:6473597d706e | 171 | /* WakeUp pins configuration functions ****************************************/ |
bogdanm | 82:6473597d706e | 172 | void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 173 | |
bogdanm | 82:6473597d706e | 174 | /* Low Power modes configuration functions ************************************/ |
bogdanm | 82:6473597d706e | 175 | void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry); |
bogdanm | 82:6473597d706e | 176 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); |
bogdanm | 82:6473597d706e | 177 | void PWR_EnterSTANDBYMode(void); |
bogdanm | 82:6473597d706e | 178 | |
bogdanm | 82:6473597d706e | 179 | /* Flags management functions *************************************************/ |
bogdanm | 82:6473597d706e | 180 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); |
bogdanm | 82:6473597d706e | 181 | void PWR_ClearFlag(uint32_t PWR_FLAG); |
bogdanm | 82:6473597d706e | 182 | |
bogdanm | 82:6473597d706e | 183 | #ifdef __cplusplus |
bogdanm | 82:6473597d706e | 184 | } |
bogdanm | 82:6473597d706e | 185 | #endif |
bogdanm | 82:6473597d706e | 186 | |
bogdanm | 82:6473597d706e | 187 | #endif /* __STM32F30x_PWR_H */ |
bogdanm | 82:6473597d706e | 188 | |
bogdanm | 82:6473597d706e | 189 | /** |
bogdanm | 82:6473597d706e | 190 | * @} |
bogdanm | 82:6473597d706e | 191 | */ |
bogdanm | 82:6473597d706e | 192 | |
bogdanm | 82:6473597d706e | 193 | /** |
bogdanm | 82:6473597d706e | 194 | * @} |
bogdanm | 82:6473597d706e | 195 | */ |
bogdanm | 82:6473597d706e | 196 | |
bogdanm | 82:6473597d706e | 197 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |