mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Jul 02 16:30:08 2015 +0100
Revision:
581:39197bcd20f2
Parent:
532:fe11edbda85c
Child:
613:bc40b8d2aec4
Synchronized with git revision ae2d3cdffe70184eb8736d94f76c45c93f4b7724

Full URL: https://github.com/mbedmicro/mbed/commit/ae2d3cdffe70184eb8736d94f76c45c93f4b7724/

Make it possible to build the core mbed library with yotta

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 235:685d5f11838f 1 /**
mbed_official 235:685d5f11838f 2 ******************************************************************************
mbed_official 235:685d5f11838f 3 * @file stm32f4xx_hal_pwr.h
mbed_official 235:685d5f11838f 4 * @author MCD Application Team
mbed_official 532:fe11edbda85c 5 * @version V1.3.0
mbed_official 532:fe11edbda85c 6 * @date 09-March-2015
mbed_official 235:685d5f11838f 7 * @brief Header file of PWR HAL module.
mbed_official 235:685d5f11838f 8 ******************************************************************************
mbed_official 235:685d5f11838f 9 * @attention
mbed_official 235:685d5f11838f 10 *
mbed_official 532:fe11edbda85c 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 235:685d5f11838f 12 *
mbed_official 235:685d5f11838f 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 235:685d5f11838f 14 * are permitted provided that the following conditions are met:
mbed_official 235:685d5f11838f 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 235:685d5f11838f 16 * this list of conditions and the following disclaimer.
mbed_official 235:685d5f11838f 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 235:685d5f11838f 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 235:685d5f11838f 19 * and/or other materials provided with the distribution.
mbed_official 235:685d5f11838f 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 235:685d5f11838f 21 * may be used to endorse or promote products derived from this software
mbed_official 235:685d5f11838f 22 * without specific prior written permission.
mbed_official 235:685d5f11838f 23 *
mbed_official 235:685d5f11838f 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 235:685d5f11838f 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 235:685d5f11838f 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 235:685d5f11838f 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 235:685d5f11838f 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 235:685d5f11838f 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 235:685d5f11838f 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 235:685d5f11838f 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 235:685d5f11838f 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 235:685d5f11838f 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 235:685d5f11838f 34 *
mbed_official 235:685d5f11838f 35 ******************************************************************************
mbed_official 235:685d5f11838f 36 */
mbed_official 235:685d5f11838f 37
mbed_official 235:685d5f11838f 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 235:685d5f11838f 39 #ifndef __STM32F4xx_HAL_PWR_H
mbed_official 235:685d5f11838f 40 #define __STM32F4xx_HAL_PWR_H
mbed_official 235:685d5f11838f 41
mbed_official 235:685d5f11838f 42 #ifdef __cplusplus
mbed_official 235:685d5f11838f 43 extern "C" {
mbed_official 235:685d5f11838f 44 #endif
mbed_official 235:685d5f11838f 45
mbed_official 235:685d5f11838f 46 /* Includes ------------------------------------------------------------------*/
mbed_official 235:685d5f11838f 47 #include "stm32f4xx_hal_def.h"
mbed_official 235:685d5f11838f 48
mbed_official 235:685d5f11838f 49 /** @addtogroup STM32F4xx_HAL_Driver
mbed_official 235:685d5f11838f 50 * @{
mbed_official 235:685d5f11838f 51 */
mbed_official 235:685d5f11838f 52
mbed_official 235:685d5f11838f 53 /** @addtogroup PWR
mbed_official 235:685d5f11838f 54 * @{
mbed_official 235:685d5f11838f 55 */
mbed_official 235:685d5f11838f 56
mbed_official 235:685d5f11838f 57 /* Exported types ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 58
mbed_official 532:fe11edbda85c 59 /** @defgroup PWR_Exported_Types PWR Exported Types
mbed_official 532:fe11edbda85c 60 * @{
mbed_official 532:fe11edbda85c 61 */
mbed_official 532:fe11edbda85c 62
mbed_official 235:685d5f11838f 63 /**
mbed_official 235:685d5f11838f 64 * @brief PWR PVD configuration structure definition
mbed_official 235:685d5f11838f 65 */
mbed_official 235:685d5f11838f 66 typedef struct
mbed_official 235:685d5f11838f 67 {
mbed_official 235:685d5f11838f 68 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level.
mbed_official 235:685d5f11838f 69 This parameter can be a value of @ref PWR_PVD_detection_level */
mbed_official 235:685d5f11838f 70
mbed_official 235:685d5f11838f 71 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
mbed_official 235:685d5f11838f 72 This parameter can be a value of @ref PWR_PVD_Mode */
mbed_official 235:685d5f11838f 73 }PWR_PVDTypeDef;
mbed_official 235:685d5f11838f 74
mbed_official 235:685d5f11838f 75 /**
mbed_official 235:685d5f11838f 76 * @}
mbed_official 235:685d5f11838f 77 */
mbed_official 235:685d5f11838f 78
mbed_official 532:fe11edbda85c 79 /* Exported constants --------------------------------------------------------*/
mbed_official 532:fe11edbda85c 80 /** @defgroup PWR_Exported_Constants PWR Exported Constants
mbed_official 532:fe11edbda85c 81 * @{
mbed_official 532:fe11edbda85c 82 */
mbed_official 532:fe11edbda85c 83
mbed_official 532:fe11edbda85c 84 /** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins
mbed_official 532:fe11edbda85c 85 * @{
mbed_official 532:fe11edbda85c 86 */
mbed_official 532:fe11edbda85c 87 #define PWR_WAKEUP_PIN1 ((uint32_t)0x00000100)
mbed_official 532:fe11edbda85c 88 #define PWR_WAKEUP_PIN2 ((uint32_t)0x00000080)
mbed_official 532:fe11edbda85c 89 /**
mbed_official 532:fe11edbda85c 90 * @}
mbed_official 532:fe11edbda85c 91 */
mbed_official 532:fe11edbda85c 92
mbed_official 532:fe11edbda85c 93 /** @defgroup PWR_PVD_detection_level PWR PVD detection level
mbed_official 235:685d5f11838f 94 * @{
mbed_official 235:685d5f11838f 95 */
mbed_official 235:685d5f11838f 96 #define PWR_PVDLEVEL_0 PWR_CR_PLS_LEV0
mbed_official 235:685d5f11838f 97 #define PWR_PVDLEVEL_1 PWR_CR_PLS_LEV1
mbed_official 235:685d5f11838f 98 #define PWR_PVDLEVEL_2 PWR_CR_PLS_LEV2
mbed_official 235:685d5f11838f 99 #define PWR_PVDLEVEL_3 PWR_CR_PLS_LEV3
mbed_official 235:685d5f11838f 100 #define PWR_PVDLEVEL_4 PWR_CR_PLS_LEV4
mbed_official 235:685d5f11838f 101 #define PWR_PVDLEVEL_5 PWR_CR_PLS_LEV5
mbed_official 235:685d5f11838f 102 #define PWR_PVDLEVEL_6 PWR_CR_PLS_LEV6
mbed_official 532:fe11edbda85c 103 #define PWR_PVDLEVEL_7 PWR_CR_PLS_LEV7/* External input analog voltage
mbed_official 532:fe11edbda85c 104 (Compare internally to VREFINT) */
mbed_official 235:685d5f11838f 105 /**
mbed_official 235:685d5f11838f 106 * @}
mbed_official 235:685d5f11838f 107 */
mbed_official 235:685d5f11838f 108
mbed_official 532:fe11edbda85c 109 /** @defgroup PWR_PVD_Mode PWR PVD Mode
mbed_official 235:685d5f11838f 110 * @{
mbed_official 235:685d5f11838f 111 */
mbed_official 532:fe11edbda85c 112 #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
mbed_official 532:fe11edbda85c 113 #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
mbed_official 532:fe11edbda85c 114 #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
mbed_official 532:fe11edbda85c 115 #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
mbed_official 532:fe11edbda85c 116 #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
mbed_official 532:fe11edbda85c 117 #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
mbed_official 532:fe11edbda85c 118 #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
mbed_official 235:685d5f11838f 119 /**
mbed_official 235:685d5f11838f 120 * @}
mbed_official 532:fe11edbda85c 121 */
mbed_official 235:685d5f11838f 122
mbed_official 532:fe11edbda85c 123
mbed_official 532:fe11edbda85c 124 /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in SLEEP/STOP mode
mbed_official 235:685d5f11838f 125 * @{
mbed_official 235:685d5f11838f 126 */
mbed_official 235:685d5f11838f 127 #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000)
mbed_official 235:685d5f11838f 128 #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS
mbed_official 235:685d5f11838f 129 /**
mbed_official 235:685d5f11838f 130 * @}
mbed_official 235:685d5f11838f 131 */
mbed_official 235:685d5f11838f 132
mbed_official 532:fe11edbda85c 133 /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
mbed_official 235:685d5f11838f 134 * @{
mbed_official 235:685d5f11838f 135 */
mbed_official 235:685d5f11838f 136 #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01)
mbed_official 235:685d5f11838f 137 #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02)
mbed_official 235:685d5f11838f 138 /**
mbed_official 235:685d5f11838f 139 * @}
mbed_official 235:685d5f11838f 140 */
mbed_official 235:685d5f11838f 141
mbed_official 532:fe11edbda85c 142 /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
mbed_official 235:685d5f11838f 143 * @{
mbed_official 235:685d5f11838f 144 */
mbed_official 235:685d5f11838f 145 #define PWR_STOPENTRY_WFI ((uint8_t)0x01)
mbed_official 235:685d5f11838f 146 #define PWR_STOPENTRY_WFE ((uint8_t)0x02)
mbed_official 235:685d5f11838f 147 /**
mbed_official 235:685d5f11838f 148 * @}
mbed_official 235:685d5f11838f 149 */
mbed_official 235:685d5f11838f 150
mbed_official 532:fe11edbda85c 151 /** @defgroup PWR_Flag PWR Flag
mbed_official 235:685d5f11838f 152 * @{
mbed_official 235:685d5f11838f 153 */
mbed_official 235:685d5f11838f 154 #define PWR_FLAG_WU PWR_CSR_WUF
mbed_official 235:685d5f11838f 155 #define PWR_FLAG_SB PWR_CSR_SBF
mbed_official 235:685d5f11838f 156 #define PWR_FLAG_PVDO PWR_CSR_PVDO
mbed_official 235:685d5f11838f 157 #define PWR_FLAG_BRR PWR_CSR_BRR
mbed_official 235:685d5f11838f 158 #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
mbed_official 235:685d5f11838f 159 /**
mbed_official 235:685d5f11838f 160 * @}
mbed_official 235:685d5f11838f 161 */
mbed_official 235:685d5f11838f 162
mbed_official 235:685d5f11838f 163 /**
mbed_official 235:685d5f11838f 164 * @}
mbed_official 235:685d5f11838f 165 */
mbed_official 235:685d5f11838f 166
mbed_official 235:685d5f11838f 167 /* Exported macro ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 168 /** @defgroup PWR_Exported_Macro PWR Exported Macro
mbed_official 532:fe11edbda85c 169 * @{
mbed_official 532:fe11edbda85c 170 */
mbed_official 235:685d5f11838f 171
mbed_official 532:fe11edbda85c 172 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F17xx)
mbed_official 532:fe11edbda85c 173 /** @brief macros configure the main internal regulator output voltage.
mbed_official 532:fe11edbda85c 174 * @param __REGULATOR__: specifies the regulator output voltage to achieve
mbed_official 532:fe11edbda85c 175 * a tradeoff between performance and power consumption when the device does
mbed_official 532:fe11edbda85c 176 * not operate at the maximum frequency (refer to the datasheets for more details).
mbed_official 532:fe11edbda85c 177 * This parameter can be one of the following values:
mbed_official 532:fe11edbda85c 178 * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode
mbed_official 532:fe11edbda85c 179 * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode
mbed_official 532:fe11edbda85c 180 * @retval None
mbed_official 532:fe11edbda85c 181 */
mbed_official 532:fe11edbda85c 182 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
mbed_official 532:fe11edbda85c 183 __IO uint32_t tmpreg; \
mbed_official 532:fe11edbda85c 184 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
mbed_official 532:fe11edbda85c 185 /* Delay after an RCC peripheral clock enabling */ \
mbed_official 532:fe11edbda85c 186 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
mbed_official 532:fe11edbda85c 187 UNUSED(tmpreg); \
mbed_official 532:fe11edbda85c 188 } while(0)
mbed_official 532:fe11edbda85c 189 #else
mbed_official 235:685d5f11838f 190 /** @brief macros configure the main internal regulator output voltage.
mbed_official 235:685d5f11838f 191 * @param __REGULATOR__: specifies the regulator output voltage to achieve
mbed_official 235:685d5f11838f 192 * a tradeoff between performance and power consumption when the device does
mbed_official 235:685d5f11838f 193 * not operate at the maximum frequency (refer to the datasheets for more details).
mbed_official 235:685d5f11838f 194 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 195 * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode
mbed_official 235:685d5f11838f 196 * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode
mbed_official 235:685d5f11838f 197 * @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output Scale 3 mode
mbed_official 235:685d5f11838f 198 * @retval None
mbed_official 235:685d5f11838f 199 */
mbed_official 532:fe11edbda85c 200 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
mbed_official 532:fe11edbda85c 201 __IO uint32_t tmpreg; \
mbed_official 532:fe11edbda85c 202 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
mbed_official 532:fe11edbda85c 203 /* Delay after an RCC peripheral clock enabling */ \
mbed_official 532:fe11edbda85c 204 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
mbed_official 532:fe11edbda85c 205 UNUSED(tmpreg); \
mbed_official 532:fe11edbda85c 206 } while(0)
mbed_official 532:fe11edbda85c 207 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
mbed_official 235:685d5f11838f 208
mbed_official 235:685d5f11838f 209 /** @brief Check PWR flag is set or not.
mbed_official 235:685d5f11838f 210 * @param __FLAG__: specifies the flag to check.
mbed_official 235:685d5f11838f 211 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 212 * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
mbed_official 235:685d5f11838f 213 * was received from the WKUP pin or from the RTC alarm (Alarm A
mbed_official 235:685d5f11838f 214 * or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
mbed_official 235:685d5f11838f 215 * An additional wakeup event is detected if the WKUP pin is enabled
mbed_official 235:685d5f11838f 216 * (by setting the EWUP bit) when the WKUP pin level is already high.
mbed_official 235:685d5f11838f 217 * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
mbed_official 235:685d5f11838f 218 * resumed from StandBy mode.
mbed_official 235:685d5f11838f 219 * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
mbed_official 235:685d5f11838f 220 * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode
mbed_official 235:685d5f11838f 221 * For this reason, this bit is equal to 0 after Standby or reset
mbed_official 235:685d5f11838f 222 * until the PVDE bit is set.
mbed_official 235:685d5f11838f 223 * @arg PWR_FLAG_BRR: Backup regulator ready flag. This bit is not reset
mbed_official 235:685d5f11838f 224 * when the device wakes up from Standby mode or by a system reset
mbed_official 235:685d5f11838f 225 * or power reset.
mbed_official 235:685d5f11838f 226 * @arg PWR_FLAG_VOSRDY: This flag indicates that the Regulator voltage
mbed_official 235:685d5f11838f 227 * scaling output selection is ready.
mbed_official 235:685d5f11838f 228 * @retval The new state of __FLAG__ (TRUE or FALSE).
mbed_official 235:685d5f11838f 229 */
mbed_official 235:685d5f11838f 230 #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
mbed_official 235:685d5f11838f 231
mbed_official 235:685d5f11838f 232 /** @brief Clear the PWR's pending flags.
mbed_official 235:685d5f11838f 233 * @param __FLAG__: specifies the flag to clear.
mbed_official 235:685d5f11838f 234 * This parameter can be one of the following values:
mbed_official 235:685d5f11838f 235 * @arg PWR_FLAG_WU: Wake Up flag
mbed_official 235:685d5f11838f 236 * @arg PWR_FLAG_SB: StandBy flag
mbed_official 235:685d5f11838f 237 */
mbed_official 235:685d5f11838f 238 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2)
mbed_official 235:685d5f11838f 239
mbed_official 532:fe11edbda85c 240 /**
mbed_official 532:fe11edbda85c 241 * @brief Enable the PVD Exti Line 16.
mbed_official 532:fe11edbda85c 242 * @retval None.
mbed_official 532:fe11edbda85c 243 */
mbed_official 532:fe11edbda85c 244 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() (EXTI->IMR |= (PWR_EXTI_LINE_PVD))
mbed_official 532:fe11edbda85c 245
mbed_official 532:fe11edbda85c 246 /**
mbed_official 532:fe11edbda85c 247 * @brief Disable the PVD EXTI Line 16.
mbed_official 532:fe11edbda85c 248 * @retval None.
mbed_official 532:fe11edbda85c 249 */
mbed_official 532:fe11edbda85c 250 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() (EXTI->IMR &= ~(PWR_EXTI_LINE_PVD))
mbed_official 532:fe11edbda85c 251
mbed_official 235:685d5f11838f 252 /**
mbed_official 532:fe11edbda85c 253 * @brief Enable event on PVD Exti Line 16.
mbed_official 532:fe11edbda85c 254 * @retval None.
mbed_official 532:fe11edbda85c 255 */
mbed_official 532:fe11edbda85c 256 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() (EXTI->EMR |= (PWR_EXTI_LINE_PVD))
mbed_official 532:fe11edbda85c 257
mbed_official 532:fe11edbda85c 258 /**
mbed_official 532:fe11edbda85c 259 * @brief Disable event on PVD Exti Line 16.
mbed_official 532:fe11edbda85c 260 * @retval None.
mbed_official 532:fe11edbda85c 261 */
mbed_official 532:fe11edbda85c 262 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(PWR_EXTI_LINE_PVD))
mbed_official 532:fe11edbda85c 263
mbed_official 532:fe11edbda85c 264 /**
mbed_official 532:fe11edbda85c 265 * @brief Enable the PVD Extended Interrupt Rising Trigger.
mbed_official 235:685d5f11838f 266 * @retval None.
mbed_official 235:685d5f11838f 267 */
mbed_official 532:fe11edbda85c 268 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
mbed_official 532:fe11edbda85c 269
mbed_official 532:fe11edbda85c 270 /**
mbed_official 532:fe11edbda85c 271 * @brief Disable the PVD Extended Interrupt Rising Trigger.
mbed_official 532:fe11edbda85c 272 * @retval None.
mbed_official 532:fe11edbda85c 273 */
mbed_official 532:fe11edbda85c 274 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, PWR_EXTI_LINE_PVD)
mbed_official 532:fe11edbda85c 275
mbed_official 532:fe11edbda85c 276 /**
mbed_official 532:fe11edbda85c 277 * @brief Enable the PVD Extended Interrupt Falling Trigger.
mbed_official 532:fe11edbda85c 278 * @retval None.
mbed_official 532:fe11edbda85c 279 */
mbed_official 532:fe11edbda85c 280 #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
mbed_official 532:fe11edbda85c 281
mbed_official 235:685d5f11838f 282
mbed_official 235:685d5f11838f 283 /**
mbed_official 532:fe11edbda85c 284 * @brief Disable the PVD Extended Interrupt Falling Trigger.
mbed_official 235:685d5f11838f 285 * @retval None.
mbed_official 235:685d5f11838f 286 */
mbed_official 532:fe11edbda85c 287 #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, PWR_EXTI_LINE_PVD)
mbed_official 532:fe11edbda85c 288
mbed_official 532:fe11edbda85c 289
mbed_official 532:fe11edbda85c 290 /**
mbed_official 532:fe11edbda85c 291 * @brief PVD EXTI line configuration: set rising & falling edge trigger.
mbed_official 532:fe11edbda85c 292 * @retval None.
mbed_official 532:fe11edbda85c 293 */
mbed_official 532:fe11edbda85c 294 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();
mbed_official 532:fe11edbda85c 295
mbed_official 532:fe11edbda85c 296 /**
mbed_official 532:fe11edbda85c 297 * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger.
mbed_official 532:fe11edbda85c 298 * This parameter can be:
mbed_official 532:fe11edbda85c 299 * @retval None.
mbed_official 532:fe11edbda85c 300 */
mbed_official 532:fe11edbda85c 301 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();
mbed_official 235:685d5f11838f 302
mbed_official 235:685d5f11838f 303 /**
mbed_official 235:685d5f11838f 304 * @brief checks whether the specified PVD Exti interrupt flag is set or not.
mbed_official 235:685d5f11838f 305 * @retval EXTI PVD Line Status.
mbed_official 235:685d5f11838f 306 */
mbed_official 532:fe11edbda85c 307 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR & (PWR_EXTI_LINE_PVD))
mbed_official 235:685d5f11838f 308
mbed_official 235:685d5f11838f 309 /**
mbed_official 235:685d5f11838f 310 * @brief Clear the PVD Exti flag.
mbed_official 235:685d5f11838f 311 * @retval None.
mbed_official 235:685d5f11838f 312 */
mbed_official 532:fe11edbda85c 313 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() (EXTI->PR = (PWR_EXTI_LINE_PVD))
mbed_official 235:685d5f11838f 314
mbed_official 235:685d5f11838f 315 /**
mbed_official 532:fe11edbda85c 316 * @brief Generates a Software interrupt on PVD EXTI line.
mbed_official 235:685d5f11838f 317 * @retval None
mbed_official 235:685d5f11838f 318 */
mbed_official 532:fe11edbda85c 319 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_PVD))
mbed_official 532:fe11edbda85c 320
mbed_official 532:fe11edbda85c 321 /**
mbed_official 532:fe11edbda85c 322 * @}
mbed_official 532:fe11edbda85c 323 */
mbed_official 235:685d5f11838f 324
mbed_official 235:685d5f11838f 325 /* Include PWR HAL Extension module */
mbed_official 235:685d5f11838f 326 #include "stm32f4xx_hal_pwr_ex.h"
mbed_official 235:685d5f11838f 327
mbed_official 235:685d5f11838f 328 /* Exported functions --------------------------------------------------------*/
mbed_official 532:fe11edbda85c 329 /** @addtogroup PWR_Exported_Functions PWR Exported Functions
mbed_official 532:fe11edbda85c 330 * @{
mbed_official 532:fe11edbda85c 331 */
mbed_official 532:fe11edbda85c 332
mbed_official 532:fe11edbda85c 333 /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 532:fe11edbda85c 334 * @{
mbed_official 532:fe11edbda85c 335 */
mbed_official 235:685d5f11838f 336 /* Initialization and de-initialization functions *****************************/
mbed_official 235:685d5f11838f 337 void HAL_PWR_DeInit(void);
mbed_official 235:685d5f11838f 338 void HAL_PWR_EnableBkUpAccess(void);
mbed_official 235:685d5f11838f 339 void HAL_PWR_DisableBkUpAccess(void);
mbed_official 532:fe11edbda85c 340 /**
mbed_official 532:fe11edbda85c 341 * @}
mbed_official 532:fe11edbda85c 342 */
mbed_official 235:685d5f11838f 343
mbed_official 532:fe11edbda85c 344 /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
mbed_official 532:fe11edbda85c 345 * @{
mbed_official 532:fe11edbda85c 346 */
mbed_official 235:685d5f11838f 347 /* Peripheral Control functions **********************************************/
mbed_official 235:685d5f11838f 348 /* PVD configuration */
mbed_official 532:fe11edbda85c 349 void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);
mbed_official 235:685d5f11838f 350 void HAL_PWR_EnablePVD(void);
mbed_official 235:685d5f11838f 351 void HAL_PWR_DisablePVD(void);
mbed_official 235:685d5f11838f 352
mbed_official 235:685d5f11838f 353 /* WakeUp pins configuration */
mbed_official 235:685d5f11838f 354 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
mbed_official 235:685d5f11838f 355 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
mbed_official 235:685d5f11838f 356
mbed_official 235:685d5f11838f 357 /* Low Power modes entry */
mbed_official 235:685d5f11838f 358 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
mbed_official 235:685d5f11838f 359 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
mbed_official 235:685d5f11838f 360 void HAL_PWR_EnterSTANDBYMode(void);
mbed_official 235:685d5f11838f 361
mbed_official 532:fe11edbda85c 362 /* Power PVD IRQ Handler */
mbed_official 235:685d5f11838f 363 void HAL_PWR_PVD_IRQHandler(void);
mbed_official 235:685d5f11838f 364 void HAL_PWR_PVDCallback(void);
mbed_official 235:685d5f11838f 365
mbed_official 532:fe11edbda85c 366 /* Cortex System Control functions *******************************************/
mbed_official 532:fe11edbda85c 367 void HAL_PWR_EnableSleepOnExit(void);
mbed_official 532:fe11edbda85c 368 void HAL_PWR_DisableSleepOnExit(void);
mbed_official 532:fe11edbda85c 369 void HAL_PWR_EnableSEVOnPend(void);
mbed_official 532:fe11edbda85c 370 void HAL_PWR_DisableSEVOnPend(void);
mbed_official 532:fe11edbda85c 371 /**
mbed_official 532:fe11edbda85c 372 * @}
mbed_official 532:fe11edbda85c 373 */
mbed_official 532:fe11edbda85c 374
mbed_official 532:fe11edbda85c 375 /**
mbed_official 532:fe11edbda85c 376 * @}
mbed_official 532:fe11edbda85c 377 */
mbed_official 532:fe11edbda85c 378
mbed_official 532:fe11edbda85c 379 /* Private types -------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 380 /* Private variables ---------------------------------------------------------*/
mbed_official 532:fe11edbda85c 381 /* Private constants ---------------------------------------------------------*/
mbed_official 532:fe11edbda85c 382 /** @defgroup PWR_Private_Constants PWR Private Constants
mbed_official 532:fe11edbda85c 383 * @{
mbed_official 532:fe11edbda85c 384 */
mbed_official 532:fe11edbda85c 385
mbed_official 532:fe11edbda85c 386 /** @defgroup PWR_PVD_EXTI_Line PWR PVD EXTI Line
mbed_official 532:fe11edbda85c 387 * @{
mbed_official 532:fe11edbda85c 388 */
mbed_official 532:fe11edbda85c 389 #define PWR_EXTI_LINE_PVD ((uint32_t)EXTI_IMR_MR16) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
mbed_official 532:fe11edbda85c 390 /**
mbed_official 532:fe11edbda85c 391 * @}
mbed_official 532:fe11edbda85c 392 */
mbed_official 532:fe11edbda85c 393
mbed_official 532:fe11edbda85c 394 /** @defgroup PWR_register_alias_address PWR Register alias address
mbed_official 532:fe11edbda85c 395 * @{
mbed_official 532:fe11edbda85c 396 */
mbed_official 532:fe11edbda85c 397 /* ------------- PWR registers bit address in the alias region ---------------*/
mbed_official 532:fe11edbda85c 398 #define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
mbed_official 532:fe11edbda85c 399 #define PWR_CR_OFFSET 0x00
mbed_official 532:fe11edbda85c 400 #define PWR_CSR_OFFSET 0x04
mbed_official 532:fe11edbda85c 401 #define PWR_CR_OFFSET_BB (PWR_OFFSET + PWR_CR_OFFSET)
mbed_official 532:fe11edbda85c 402 #define PWR_CSR_OFFSET_BB (PWR_OFFSET + PWR_CSR_OFFSET)
mbed_official 532:fe11edbda85c 403 /**
mbed_official 532:fe11edbda85c 404 * @}
mbed_official 532:fe11edbda85c 405 */
mbed_official 532:fe11edbda85c 406
mbed_official 532:fe11edbda85c 407 /** @defgroup PWR_CR_register_alias PWR CR Register alias address
mbed_official 532:fe11edbda85c 408 * @{
mbed_official 532:fe11edbda85c 409 */
mbed_official 532:fe11edbda85c 410 /* --- CR Register ---*/
mbed_official 532:fe11edbda85c 411 /* Alias word address of DBP bit */
mbed_official 532:fe11edbda85c 412 #define DBP_BIT_NUMBER POSITION_VAL(PWR_CR_DBP)
mbed_official 532:fe11edbda85c 413 #define CR_DBP_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32) + (DBP_BIT_NUMBER * 4))
mbed_official 532:fe11edbda85c 414
mbed_official 532:fe11edbda85c 415 /* Alias word address of PVDE bit */
mbed_official 532:fe11edbda85c 416 #define PVDE_BIT_NUMBER POSITION_VAL(PWR_CR_PVDE)
mbed_official 532:fe11edbda85c 417 #define CR_PVDE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32) + (PVDE_BIT_NUMBER * 4))
mbed_official 532:fe11edbda85c 418
mbed_official 532:fe11edbda85c 419 /* Alias word address of PMODE bit */
mbed_official 532:fe11edbda85c 420 #define PMODE_BIT_NUMBER POSITION_VAL(PWR_CR_PMODE)
mbed_official 532:fe11edbda85c 421 #define CR_PMODE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32) + (PMODE_BIT_NUMBER * 4))
mbed_official 532:fe11edbda85c 422 /**
mbed_official 532:fe11edbda85c 423 * @}
mbed_official 532:fe11edbda85c 424 */
mbed_official 532:fe11edbda85c 425
mbed_official 532:fe11edbda85c 426 /** @defgroup PWR_CSR_register_alias PWR CSR Register alias address
mbed_official 532:fe11edbda85c 427 * @{
mbed_official 532:fe11edbda85c 428 */
mbed_official 532:fe11edbda85c 429 /* --- CSR Register ---*/
mbed_official 532:fe11edbda85c 430 /* Alias word address of EWUP bit */
mbed_official 532:fe11edbda85c 431 #define EWUP_BIT_NUMBER POSITION_VAL(PWR_CSR_EWUP)
mbed_official 532:fe11edbda85c 432 #define CSR_EWUP_BB (PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32) + (EWUP_BIT_NUMBER * 4))
mbed_official 532:fe11edbda85c 433 /**
mbed_official 532:fe11edbda85c 434 * @}
mbed_official 532:fe11edbda85c 435 */
mbed_official 532:fe11edbda85c 436
mbed_official 532:fe11edbda85c 437 /**
mbed_official 532:fe11edbda85c 438 * @}
mbed_official 532:fe11edbda85c 439 */
mbed_official 532:fe11edbda85c 440 /* Private macros ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 441 /** @defgroup PWR_Private_Macros PWR Private Macros
mbed_official 532:fe11edbda85c 442 * @{
mbed_official 532:fe11edbda85c 443 */
mbed_official 532:fe11edbda85c 444
mbed_official 532:fe11edbda85c 445 /** @defgroup PWR_IS_PWR_Definitions PWR Private macros to check input parameters
mbed_official 532:fe11edbda85c 446 * @{
mbed_official 532:fe11edbda85c 447 */
mbed_official 532:fe11edbda85c 448 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2))
mbed_official 532:fe11edbda85c 449 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
mbed_official 532:fe11edbda85c 450 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
mbed_official 532:fe11edbda85c 451 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
mbed_official 532:fe11edbda85c 452 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
mbed_official 532:fe11edbda85c 453 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \
mbed_official 532:fe11edbda85c 454 ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \
mbed_official 532:fe11edbda85c 455 ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \
mbed_official 532:fe11edbda85c 456 ((MODE) == PWR_PVD_MODE_NORMAL))
mbed_official 532:fe11edbda85c 457 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
mbed_official 532:fe11edbda85c 458 ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
mbed_official 532:fe11edbda85c 459 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
mbed_official 532:fe11edbda85c 460 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
mbed_official 532:fe11edbda85c 461 /**
mbed_official 532:fe11edbda85c 462 * @}
mbed_official 532:fe11edbda85c 463 */
mbed_official 532:fe11edbda85c 464
mbed_official 532:fe11edbda85c 465 /**
mbed_official 532:fe11edbda85c 466 * @}
mbed_official 532:fe11edbda85c 467 */
mbed_official 235:685d5f11838f 468
mbed_official 235:685d5f11838f 469 /**
mbed_official 235:685d5f11838f 470 * @}
mbed_official 235:685d5f11838f 471 */
mbed_official 235:685d5f11838f 472
mbed_official 235:685d5f11838f 473 /**
mbed_official 235:685d5f11838f 474 * @}
mbed_official 235:685d5f11838f 475 */
mbed_official 235:685d5f11838f 476
mbed_official 235:685d5f11838f 477 #ifdef __cplusplus
mbed_official 235:685d5f11838f 478 }
mbed_official 235:685d5f11838f 479 #endif
mbed_official 235:685d5f11838f 480
mbed_official 235:685d5f11838f 481
mbed_official 235:685d5f11838f 482 #endif /* __STM32F4xx_HAL_PWR_H */
mbed_official 235:685d5f11838f 483
mbed_official 235:685d5f11838f 484 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/