Julien Kern / mbed

Dependents:   Printf

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Jun 09 14:29:26 2015 +0100
Revision:
101:7cff1c4259d7
Release 101 of the mbed library

Changes:
- new platform: APPNEARME_MICRONFCBOARD, MTS_DRAGONFLY_F411RE, MAX32600MBED, WIZwiki_W7500
- Silabs memory optimization in gpio, pwm fixes
- SPI - ssel documentation fixes and its use

Who changed what in which revision?

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