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:
Fri Jun 19 09:15:11 2015 +0100
Revision:
573:ad23fe03a082
Child:
610:813dcc80987e
Synchronized with git revision d47834cd4d729e5b36b4c1ad4650f8b8f6a9ab86

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

DISCO_F746NG - Add new target

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 573:ad23fe03a082 1 /**
mbed_official 573:ad23fe03a082 2 ******************************************************************************
mbed_official 573:ad23fe03a082 3 * @file stm32f7xx_hal_pwr.c
mbed_official 573:ad23fe03a082 4 * @author MCD Application Team
mbed_official 573:ad23fe03a082 5 * @version V1.0.0
mbed_official 573:ad23fe03a082 6 * @date 12-May-2015
mbed_official 573:ad23fe03a082 7 * @brief PWR HAL module driver.
mbed_official 573:ad23fe03a082 8 * This file provides firmware functions to manage the following
mbed_official 573:ad23fe03a082 9 * functionalities of the Power Controller (PWR) peripheral:
mbed_official 573:ad23fe03a082 10 * + Initialization and de-initialization functions
mbed_official 573:ad23fe03a082 11 * + Peripheral Control functions
mbed_official 573:ad23fe03a082 12 *
mbed_official 573:ad23fe03a082 13 ******************************************************************************
mbed_official 573:ad23fe03a082 14 * @attention
mbed_official 573:ad23fe03a082 15 *
mbed_official 573:ad23fe03a082 16 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 573:ad23fe03a082 17 *
mbed_official 573:ad23fe03a082 18 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 573:ad23fe03a082 19 * are permitted provided that the following conditions are met:
mbed_official 573:ad23fe03a082 20 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 573:ad23fe03a082 21 * this list of conditions and the following disclaimer.
mbed_official 573:ad23fe03a082 22 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 573:ad23fe03a082 23 * this list of conditions and the following disclaimer in the documentation
mbed_official 573:ad23fe03a082 24 * and/or other materials provided with the distribution.
mbed_official 573:ad23fe03a082 25 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 573:ad23fe03a082 26 * may be used to endorse or promote products derived from this software
mbed_official 573:ad23fe03a082 27 * without specific prior written permission.
mbed_official 573:ad23fe03a082 28 *
mbed_official 573:ad23fe03a082 29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 573:ad23fe03a082 30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 573:ad23fe03a082 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 573:ad23fe03a082 32 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 573:ad23fe03a082 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 573:ad23fe03a082 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 573:ad23fe03a082 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 573:ad23fe03a082 36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 573:ad23fe03a082 37 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 573:ad23fe03a082 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 573:ad23fe03a082 39 *
mbed_official 573:ad23fe03a082 40 ******************************************************************************
mbed_official 573:ad23fe03a082 41 */
mbed_official 573:ad23fe03a082 42
mbed_official 573:ad23fe03a082 43 /* Includes ------------------------------------------------------------------*/
mbed_official 573:ad23fe03a082 44 #include "stm32f7xx_hal.h"
mbed_official 573:ad23fe03a082 45
mbed_official 573:ad23fe03a082 46 /** @addtogroup STM32F7xx_HAL_Driver
mbed_official 573:ad23fe03a082 47 * @{
mbed_official 573:ad23fe03a082 48 */
mbed_official 573:ad23fe03a082 49
mbed_official 573:ad23fe03a082 50 /** @defgroup PWR PWR
mbed_official 573:ad23fe03a082 51 * @brief PWR HAL module driver
mbed_official 573:ad23fe03a082 52 * @{
mbed_official 573:ad23fe03a082 53 */
mbed_official 573:ad23fe03a082 54
mbed_official 573:ad23fe03a082 55 #ifdef HAL_PWR_MODULE_ENABLED
mbed_official 573:ad23fe03a082 56
mbed_official 573:ad23fe03a082 57 /* Private typedef -----------------------------------------------------------*/
mbed_official 573:ad23fe03a082 58 /* Private define ------------------------------------------------------------*/
mbed_official 573:ad23fe03a082 59 /** @addtogroup PWR_Private_Constants
mbed_official 573:ad23fe03a082 60 * @{
mbed_official 573:ad23fe03a082 61 */
mbed_official 573:ad23fe03a082 62
mbed_official 573:ad23fe03a082 63 /** @defgroup PWR_PVD_Mode_Mask PWR PVD Mode Mask
mbed_official 573:ad23fe03a082 64 * @{
mbed_official 573:ad23fe03a082 65 */
mbed_official 573:ad23fe03a082 66 #define PVD_MODE_IT ((uint32_t)0x00010000)
mbed_official 573:ad23fe03a082 67 #define PVD_MODE_EVT ((uint32_t)0x00020000)
mbed_official 573:ad23fe03a082 68 #define PVD_RISING_EDGE ((uint32_t)0x00000001)
mbed_official 573:ad23fe03a082 69 #define PVD_FALLING_EDGE ((uint32_t)0x00000002)
mbed_official 573:ad23fe03a082 70 /**
mbed_official 573:ad23fe03a082 71 * @}
mbed_official 573:ad23fe03a082 72 */
mbed_official 573:ad23fe03a082 73
mbed_official 573:ad23fe03a082 74 /** @defgroup PWR_ENABLE_WUP_Mask PWR Enable WUP Mask
mbed_official 573:ad23fe03a082 75 * @{
mbed_official 573:ad23fe03a082 76 */
mbed_official 573:ad23fe03a082 77 #define PWR_EWUP_MASK ((uint32_t)0x00003F00)
mbed_official 573:ad23fe03a082 78 /**
mbed_official 573:ad23fe03a082 79 * @}
mbed_official 573:ad23fe03a082 80 */
mbed_official 573:ad23fe03a082 81
mbed_official 573:ad23fe03a082 82 /**
mbed_official 573:ad23fe03a082 83 * @}
mbed_official 573:ad23fe03a082 84 */
mbed_official 573:ad23fe03a082 85 /* Private macro -------------------------------------------------------------*/
mbed_official 573:ad23fe03a082 86 /* Private variables ---------------------------------------------------------*/
mbed_official 573:ad23fe03a082 87 /* Private function prototypes -----------------------------------------------*/
mbed_official 573:ad23fe03a082 88 /* Private functions ---------------------------------------------------------*/
mbed_official 573:ad23fe03a082 89
mbed_official 573:ad23fe03a082 90 /** @defgroup PWR_Exported_Functions PWR Exported Functions
mbed_official 573:ad23fe03a082 91 * @{
mbed_official 573:ad23fe03a082 92 */
mbed_official 573:ad23fe03a082 93
mbed_official 573:ad23fe03a082 94 /** @defgroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 573:ad23fe03a082 95 * @brief Initialization and de-initialization functions
mbed_official 573:ad23fe03a082 96 *
mbed_official 573:ad23fe03a082 97 @verbatim
mbed_official 573:ad23fe03a082 98 ===============================================================================
mbed_official 573:ad23fe03a082 99 ##### Initialization and de-initialization functions #####
mbed_official 573:ad23fe03a082 100 ===============================================================================
mbed_official 573:ad23fe03a082 101 [..]
mbed_official 573:ad23fe03a082 102 After reset, the backup domain (RTC registers, RTC backup data
mbed_official 573:ad23fe03a082 103 registers and backup SRAM) is protected against possible unwanted
mbed_official 573:ad23fe03a082 104 write accesses.
mbed_official 573:ad23fe03a082 105 To enable access to the RTC Domain and RTC registers, proceed as follows:
mbed_official 573:ad23fe03a082 106 (+) Enable the Power Controller (PWR) APB1 interface clock using the
mbed_official 573:ad23fe03a082 107 __HAL_RCC_PWR_CLK_ENABLE() macro.
mbed_official 573:ad23fe03a082 108 (+) Enable access to RTC domain using the HAL_PWR_EnableBkUpAccess() function.
mbed_official 573:ad23fe03a082 109
mbed_official 573:ad23fe03a082 110 @endverbatim
mbed_official 573:ad23fe03a082 111 * @{
mbed_official 573:ad23fe03a082 112 */
mbed_official 573:ad23fe03a082 113
mbed_official 573:ad23fe03a082 114 /**
mbed_official 573:ad23fe03a082 115 * @brief Deinitializes the HAL PWR peripheral registers to their default reset values.
mbed_official 573:ad23fe03a082 116 * @retval None
mbed_official 573:ad23fe03a082 117 */
mbed_official 573:ad23fe03a082 118 void HAL_PWR_DeInit(void)
mbed_official 573:ad23fe03a082 119 {
mbed_official 573:ad23fe03a082 120 __HAL_RCC_PWR_FORCE_RESET();
mbed_official 573:ad23fe03a082 121 __HAL_RCC_PWR_RELEASE_RESET();
mbed_official 573:ad23fe03a082 122 }
mbed_official 573:ad23fe03a082 123
mbed_official 573:ad23fe03a082 124 /**
mbed_official 573:ad23fe03a082 125 * @brief Enables access to the backup domain (RTC registers, RTC
mbed_official 573:ad23fe03a082 126 * backup data registers and backup SRAM).
mbed_official 573:ad23fe03a082 127 * @note If the HSE divided by 2, 3, ..31 is used as the RTC clock, the
mbed_official 573:ad23fe03a082 128 * Backup Domain Access should be kept enabled.
mbed_official 573:ad23fe03a082 129 * @retval None
mbed_official 573:ad23fe03a082 130 */
mbed_official 573:ad23fe03a082 131 void HAL_PWR_EnableBkUpAccess(void)
mbed_official 573:ad23fe03a082 132 {
mbed_official 573:ad23fe03a082 133 /* Enable access to RTC and backup registers */
mbed_official 573:ad23fe03a082 134 SET_BIT(PWR->CR1, PWR_CR1_DBP);
mbed_official 573:ad23fe03a082 135 }
mbed_official 573:ad23fe03a082 136
mbed_official 573:ad23fe03a082 137 /**
mbed_official 573:ad23fe03a082 138 * @brief Disables access to the backup domain (RTC registers, RTC
mbed_official 573:ad23fe03a082 139 * backup data registers and backup SRAM).
mbed_official 573:ad23fe03a082 140 * @note If the HSE divided by 2, 3, ..31 is used as the RTC clock, the
mbed_official 573:ad23fe03a082 141 * Backup Domain Access should be kept enabled.
mbed_official 573:ad23fe03a082 142 * @retval None
mbed_official 573:ad23fe03a082 143 */
mbed_official 573:ad23fe03a082 144 void HAL_PWR_DisableBkUpAccess(void)
mbed_official 573:ad23fe03a082 145 {
mbed_official 573:ad23fe03a082 146 /* Disable access to RTC and backup registers */
mbed_official 573:ad23fe03a082 147 CLEAR_BIT(PWR->CR1, PWR_CR1_DBP);
mbed_official 573:ad23fe03a082 148 }
mbed_official 573:ad23fe03a082 149
mbed_official 573:ad23fe03a082 150 /**
mbed_official 573:ad23fe03a082 151 * @}
mbed_official 573:ad23fe03a082 152 */
mbed_official 573:ad23fe03a082 153
mbed_official 573:ad23fe03a082 154 /** @defgroup PWR_Exported_Functions_Group2 Peripheral Control functions
mbed_official 573:ad23fe03a082 155 * @brief Low Power modes configuration functions
mbed_official 573:ad23fe03a082 156 *
mbed_official 573:ad23fe03a082 157 @verbatim
mbed_official 573:ad23fe03a082 158
mbed_official 573:ad23fe03a082 159 ===============================================================================
mbed_official 573:ad23fe03a082 160 ##### Peripheral Control functions #####
mbed_official 573:ad23fe03a082 161 ===============================================================================
mbed_official 573:ad23fe03a082 162
mbed_official 573:ad23fe03a082 163 *** PVD configuration ***
mbed_official 573:ad23fe03a082 164 =========================
mbed_official 573:ad23fe03a082 165 [..]
mbed_official 573:ad23fe03a082 166 (+) The PVD is used to monitor the VDD power supply by comparing it to a
mbed_official 573:ad23fe03a082 167 threshold selected by the PVD Level (PLS[2:0] bits in the PWR_CR).
mbed_official 573:ad23fe03a082 168 (+) A PVDO flag is available to indicate if VDD/VDDA is higher or lower
mbed_official 573:ad23fe03a082 169 than the PVD threshold. This event is internally connected to the EXTI
mbed_official 573:ad23fe03a082 170 line16 and can generate an interrupt if enabled. This is done through
mbed_official 573:ad23fe03a082 171 __HAL_PWR_PVD_EXTI_ENABLE_IT() macro.
mbed_official 573:ad23fe03a082 172 (+) The PVD is stopped in Standby mode.
mbed_official 573:ad23fe03a082 173
mbed_official 573:ad23fe03a082 174 *** Wake-up pin configuration ***
mbed_official 573:ad23fe03a082 175 ================================
mbed_official 573:ad23fe03a082 176 [..]
mbed_official 573:ad23fe03a082 177 (+) Wake-up pin is used to wake up the system from Standby mode. This pin is
mbed_official 573:ad23fe03a082 178 forced in input pull-down configuration and is active on rising edges.
mbed_official 573:ad23fe03a082 179 (+) There are to 6 Wake-up pin in the STM32F7 devices family
mbed_official 573:ad23fe03a082 180
mbed_official 573:ad23fe03a082 181 *** Low Power modes configuration ***
mbed_official 573:ad23fe03a082 182 =====================================
mbed_official 573:ad23fe03a082 183 [..]
mbed_official 573:ad23fe03a082 184 The devices feature 3 low-power modes:
mbed_official 573:ad23fe03a082 185 (+) Sleep mode: Cortex-M7 core stopped, peripherals kept running.
mbed_official 573:ad23fe03a082 186 (+) Stop mode: all clocks are stopped, regulator running, regulator
mbed_official 573:ad23fe03a082 187 in low power mode
mbed_official 573:ad23fe03a082 188 (+) Standby mode: 1.2V domain powered off.
mbed_official 573:ad23fe03a082 189
mbed_official 573:ad23fe03a082 190 *** Sleep mode ***
mbed_official 573:ad23fe03a082 191 ==================
mbed_official 573:ad23fe03a082 192 [..]
mbed_official 573:ad23fe03a082 193 (+) Entry:
mbed_official 573:ad23fe03a082 194 The Sleep mode is entered by using the HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI)
mbed_official 573:ad23fe03a082 195 functions with
mbed_official 573:ad23fe03a082 196 (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction
mbed_official 573:ad23fe03a082 197 (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction
mbed_official 573:ad23fe03a082 198
mbed_official 573:ad23fe03a082 199 -@@- The Regulator parameter is not used for the STM32F7 family
mbed_official 573:ad23fe03a082 200 and is kept as parameter just to maintain compatibility with the
mbed_official 573:ad23fe03a082 201 lower power families (STM32L).
mbed_official 573:ad23fe03a082 202 (+) Exit:
mbed_official 573:ad23fe03a082 203 Any peripheral interrupt acknowledged by the nested vectored interrupt
mbed_official 573:ad23fe03a082 204 controller (NVIC) can wake up the device from Sleep mode.
mbed_official 573:ad23fe03a082 205
mbed_official 573:ad23fe03a082 206 *** Stop mode ***
mbed_official 573:ad23fe03a082 207 =================
mbed_official 573:ad23fe03a082 208 [..]
mbed_official 573:ad23fe03a082 209 In Stop mode, all clocks in the 1.2V domain are stopped, the PLL, the HSI,
mbed_official 573:ad23fe03a082 210 and the HSE RC oscillators are disabled. Internal SRAM and register contents
mbed_official 573:ad23fe03a082 211 are preserved.
mbed_official 573:ad23fe03a082 212 The voltage regulator can be configured either in normal or low-power mode.
mbed_official 573:ad23fe03a082 213 To minimize the consumption In Stop mode, FLASH can be powered off before
mbed_official 573:ad23fe03a082 214 entering the Stop mode using the HAL_PWREx_EnableFlashPowerDown() function.
mbed_official 573:ad23fe03a082 215 It can be switched on again by software after exiting the Stop mode using
mbed_official 573:ad23fe03a082 216 the HAL_PWREx_DisableFlashPowerDown() function.
mbed_official 573:ad23fe03a082 217
mbed_official 573:ad23fe03a082 218 (+) Entry:
mbed_official 573:ad23fe03a082 219 The Stop mode is entered using the HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON)
mbed_official 573:ad23fe03a082 220 function with:
mbed_official 573:ad23fe03a082 221 (++) Main regulator ON.
mbed_official 573:ad23fe03a082 222 (++) Low Power regulator ON.
mbed_official 573:ad23fe03a082 223 (+) Exit:
mbed_official 573:ad23fe03a082 224 Any EXTI Line (Internal or External) configured in Interrupt/Event mode.
mbed_official 573:ad23fe03a082 225
mbed_official 573:ad23fe03a082 226 *** Standby mode ***
mbed_official 573:ad23fe03a082 227 ====================
mbed_official 573:ad23fe03a082 228 [..]
mbed_official 573:ad23fe03a082 229 (+)
mbed_official 573:ad23fe03a082 230 The Standby mode allows to achieve the lowest power consumption. It is based
mbed_official 573:ad23fe03a082 231 on the Cortex-M7 deep sleep mode, with the voltage regulator disabled.
mbed_official 573:ad23fe03a082 232 The 1.2V domain is consequently powered off. The PLL, the HSI oscillator and
mbed_official 573:ad23fe03a082 233 the HSE oscillator are also switched off. SRAM and register contents are lost
mbed_official 573:ad23fe03a082 234 except for the RTC registers, RTC backup registers, backup SRAM and Standby
mbed_official 573:ad23fe03a082 235 circuitry.
mbed_official 573:ad23fe03a082 236
mbed_official 573:ad23fe03a082 237 The voltage regulator is OFF.
mbed_official 573:ad23fe03a082 238
mbed_official 573:ad23fe03a082 239 (++) Entry:
mbed_official 573:ad23fe03a082 240 (+++) The Standby mode is entered using the HAL_PWR_EnterSTANDBYMode() function.
mbed_official 573:ad23fe03a082 241 (++) Exit:
mbed_official 573:ad23fe03a082 242 (+++) WKUP pin rising or falling edge, RTC alarm (Alarm A and Alarm B), RTC
mbed_official 573:ad23fe03a082 243 wakeup, tamper event, time stamp event, external reset in NRST pin, IWDG reset.
mbed_official 573:ad23fe03a082 244
mbed_official 573:ad23fe03a082 245 *** Auto-wakeup (AWU) from low-power mode ***
mbed_official 573:ad23fe03a082 246 =============================================
mbed_official 573:ad23fe03a082 247 [..]
mbed_official 573:ad23fe03a082 248
mbed_official 573:ad23fe03a082 249 (+) The MCU can be woken up from low-power mode by an RTC Alarm event, an RTC
mbed_official 573:ad23fe03a082 250 Wakeup event, a tamper event or a time-stamp event, without depending on
mbed_official 573:ad23fe03a082 251 an external interrupt (Auto-wakeup mode).
mbed_official 573:ad23fe03a082 252
mbed_official 573:ad23fe03a082 253 (+) RTC auto-wakeup (AWU) from the Stop and Standby modes
mbed_official 573:ad23fe03a082 254
mbed_official 573:ad23fe03a082 255 (++) To wake up from the Stop mode with an RTC alarm event, it is necessary to
mbed_official 573:ad23fe03a082 256 configure the RTC to generate the RTC alarm using the HAL_RTC_SetAlarm_IT() function.
mbed_official 573:ad23fe03a082 257
mbed_official 573:ad23fe03a082 258 (++) To wake up from the Stop mode with an RTC Tamper or time stamp event, it
mbed_official 573:ad23fe03a082 259 is necessary to configure the RTC to detect the tamper or time stamp event using the
mbed_official 573:ad23fe03a082 260 HAL_RTCEx_SetTimeStamp_IT() or HAL_RTCEx_SetTamper_IT() functions.
mbed_official 573:ad23fe03a082 261
mbed_official 573:ad23fe03a082 262 (++) To wake up from the Stop mode with an RTC WakeUp event, it is necessary to
mbed_official 573:ad23fe03a082 263 configure the RTC to generate the RTC WakeUp event using the HAL_RTCEx_SetWakeUpTimer_IT() function.
mbed_official 573:ad23fe03a082 264
mbed_official 573:ad23fe03a082 265 @endverbatim
mbed_official 573:ad23fe03a082 266 * @{
mbed_official 573:ad23fe03a082 267 */
mbed_official 573:ad23fe03a082 268
mbed_official 573:ad23fe03a082 269 /**
mbed_official 573:ad23fe03a082 270 * @brief Configures the voltage threshold detected by the Power Voltage Detector(PVD).
mbed_official 573:ad23fe03a082 271 * @param sConfigPVD: pointer to an PWR_PVDTypeDef structure that contains the configuration
mbed_official 573:ad23fe03a082 272 * information for the PVD.
mbed_official 573:ad23fe03a082 273 * @note Refer to the electrical characteristics of your device datasheet for
mbed_official 573:ad23fe03a082 274 * more details about the voltage threshold corresponding to each
mbed_official 573:ad23fe03a082 275 * detection level.
mbed_official 573:ad23fe03a082 276 * @retval None
mbed_official 573:ad23fe03a082 277 */
mbed_official 573:ad23fe03a082 278 void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD)
mbed_official 573:ad23fe03a082 279 {
mbed_official 573:ad23fe03a082 280 /* Check the parameters */
mbed_official 573:ad23fe03a082 281 assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel));
mbed_official 573:ad23fe03a082 282 assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode));
mbed_official 573:ad23fe03a082 283
mbed_official 573:ad23fe03a082 284 /* Set PLS[7:5] bits according to PVDLevel value */
mbed_official 573:ad23fe03a082 285 MODIFY_REG(PWR->CR1, PWR_CR1_PLS, sConfigPVD->PVDLevel);
mbed_official 573:ad23fe03a082 286
mbed_official 573:ad23fe03a082 287 /* Clear any previous config. Keep it clear if no event or IT mode is selected */
mbed_official 573:ad23fe03a082 288 __HAL_PWR_PVD_EXTI_DISABLE_EVENT();
mbed_official 573:ad23fe03a082 289 __HAL_PWR_PVD_EXTI_DISABLE_IT();
mbed_official 573:ad23fe03a082 290 __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();
mbed_official 573:ad23fe03a082 291 __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();
mbed_official 573:ad23fe03a082 292
mbed_official 573:ad23fe03a082 293 /* Configure interrupt mode */
mbed_official 573:ad23fe03a082 294 if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT)
mbed_official 573:ad23fe03a082 295 {
mbed_official 573:ad23fe03a082 296 __HAL_PWR_PVD_EXTI_ENABLE_IT();
mbed_official 573:ad23fe03a082 297 }
mbed_official 573:ad23fe03a082 298
mbed_official 573:ad23fe03a082 299 /* Configure event mode */
mbed_official 573:ad23fe03a082 300 if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT)
mbed_official 573:ad23fe03a082 301 {
mbed_official 573:ad23fe03a082 302 __HAL_PWR_PVD_EXTI_ENABLE_EVENT();
mbed_official 573:ad23fe03a082 303 }
mbed_official 573:ad23fe03a082 304
mbed_official 573:ad23fe03a082 305 /* Configure the edge */
mbed_official 573:ad23fe03a082 306 if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE)
mbed_official 573:ad23fe03a082 307 {
mbed_official 573:ad23fe03a082 308 __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();
mbed_official 573:ad23fe03a082 309 }
mbed_official 573:ad23fe03a082 310
mbed_official 573:ad23fe03a082 311 if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE)
mbed_official 573:ad23fe03a082 312 {
mbed_official 573:ad23fe03a082 313 __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();
mbed_official 573:ad23fe03a082 314 }
mbed_official 573:ad23fe03a082 315 }
mbed_official 573:ad23fe03a082 316
mbed_official 573:ad23fe03a082 317 /**
mbed_official 573:ad23fe03a082 318 * @brief Enables the Power Voltage Detector(PVD).
mbed_official 573:ad23fe03a082 319 * @retval None
mbed_official 573:ad23fe03a082 320 */
mbed_official 573:ad23fe03a082 321 void HAL_PWR_EnablePVD(void)
mbed_official 573:ad23fe03a082 322 {
mbed_official 573:ad23fe03a082 323 /* Enable the power voltage detector */
mbed_official 573:ad23fe03a082 324 SET_BIT(PWR->CR1, PWR_CR1_PVDE);
mbed_official 573:ad23fe03a082 325 }
mbed_official 573:ad23fe03a082 326
mbed_official 573:ad23fe03a082 327 /**
mbed_official 573:ad23fe03a082 328 * @brief Disables the Power Voltage Detector(PVD).
mbed_official 573:ad23fe03a082 329 * @retval None
mbed_official 573:ad23fe03a082 330 */
mbed_official 573:ad23fe03a082 331 void HAL_PWR_DisablePVD(void)
mbed_official 573:ad23fe03a082 332 {
mbed_official 573:ad23fe03a082 333 /* Disable the power voltage detector */
mbed_official 573:ad23fe03a082 334 CLEAR_BIT(PWR->CR1, PWR_CR1_PVDE);
mbed_official 573:ad23fe03a082 335 }
mbed_official 573:ad23fe03a082 336
mbed_official 573:ad23fe03a082 337 /**
mbed_official 573:ad23fe03a082 338 * @brief Enable the WakeUp PINx functionality.
mbed_official 573:ad23fe03a082 339 * @param WakeUpPinPolarity: Specifies which Wake-Up pin to enable.
mbed_official 573:ad23fe03a082 340 * This parameter can be one of the following legacy values, which sets the default polarity:
mbed_official 573:ad23fe03a082 341 * detection on high level (rising edge):
mbed_official 573:ad23fe03a082 342 * @arg PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, PWR_WAKEUP_PIN5, PWR_WAKEUP_PIN6
mbed_official 573:ad23fe03a082 343 * or one of the following value where the user can explicitly states the enabled pin and
mbed_official 573:ad23fe03a082 344 * the chosen polarity
mbed_official 573:ad23fe03a082 345 * @arg PWR_WAKEUP_PIN1_HIGH or PWR_WAKEUP_PIN1_LOW
mbed_official 573:ad23fe03a082 346 * @arg PWR_WAKEUP_PIN2_HIGH or PWR_WAKEUP_PIN2_LOW
mbed_official 573:ad23fe03a082 347 * @arg PWR_WAKEUP_PIN3_HIGH or PWR_WAKEUP_PIN3_LOW
mbed_official 573:ad23fe03a082 348 * @arg PWR_WAKEUP_PIN4_HIGH or PWR_WAKEUP_PIN4_LOW
mbed_official 573:ad23fe03a082 349 * @arg PWR_WAKEUP_PIN5_HIGH or PWR_WAKEUP_PIN5_LOW
mbed_official 573:ad23fe03a082 350 * @arg PWR_WAKEUP_PIN6_HIGH or PWR_WAKEUP_PIN6_LOW
mbed_official 573:ad23fe03a082 351 * @note PWR_WAKEUP_PINx and PWR_WAKEUP_PINx_HIGH are equivalent.
mbed_official 573:ad23fe03a082 352 * @retval None
mbed_official 573:ad23fe03a082 353 */
mbed_official 573:ad23fe03a082 354 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity)
mbed_official 573:ad23fe03a082 355 {
mbed_official 573:ad23fe03a082 356 assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinPolarity));
mbed_official 573:ad23fe03a082 357
mbed_official 573:ad23fe03a082 358 /* Enable wake-up pin */
mbed_official 573:ad23fe03a082 359 SET_BIT(PWR->CSR2, (PWR_EWUP_MASK & WakeUpPinPolarity));
mbed_official 573:ad23fe03a082 360
mbed_official 573:ad23fe03a082 361 /* Specifies the Wake-Up pin polarity for the event detection
mbed_official 573:ad23fe03a082 362 (rising or falling edge) */
mbed_official 573:ad23fe03a082 363 MODIFY_REG(PWR->CR2, (PWR_EWUP_MASK & WakeUpPinPolarity), (WakeUpPinPolarity >> 0x06));
mbed_official 573:ad23fe03a082 364 }
mbed_official 573:ad23fe03a082 365
mbed_official 573:ad23fe03a082 366 /**
mbed_official 573:ad23fe03a082 367 * @brief Disables the WakeUp PINx functionality.
mbed_official 573:ad23fe03a082 368 * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable.
mbed_official 573:ad23fe03a082 369 * This parameter can be one of the following values:
mbed_official 573:ad23fe03a082 370 * @arg PWR_WAKEUP_PIN1
mbed_official 573:ad23fe03a082 371 * @arg PWR_WAKEUP_PIN2
mbed_official 573:ad23fe03a082 372 * @arg PWR_WAKEUP_PIN3
mbed_official 573:ad23fe03a082 373 * @arg PWR_WAKEUP_PIN4
mbed_official 573:ad23fe03a082 374 * @arg PWR_WAKEUP_PIN5
mbed_official 573:ad23fe03a082 375 * @arg PWR_WAKEUP_PIN6
mbed_official 573:ad23fe03a082 376 * @retval None
mbed_official 573:ad23fe03a082 377 */
mbed_official 573:ad23fe03a082 378 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx)
mbed_official 573:ad23fe03a082 379 {
mbed_official 573:ad23fe03a082 380 assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx));
mbed_official 573:ad23fe03a082 381
mbed_official 573:ad23fe03a082 382 CLEAR_BIT(PWR->CSR2, WakeUpPinx);
mbed_official 573:ad23fe03a082 383 }
mbed_official 573:ad23fe03a082 384
mbed_official 573:ad23fe03a082 385 /**
mbed_official 573:ad23fe03a082 386 * @brief Enters Sleep mode.
mbed_official 573:ad23fe03a082 387 *
mbed_official 573:ad23fe03a082 388 * @note In Sleep mode, all I/O pins keep the same state as in Run mode.
mbed_official 573:ad23fe03a082 389 *
mbed_official 573:ad23fe03a082 390 * @note In Sleep mode, the systick is stopped to avoid exit from this mode with
mbed_official 573:ad23fe03a082 391 * systick interrupt when used as time base for Timeout
mbed_official 573:ad23fe03a082 392 *
mbed_official 573:ad23fe03a082 393 * @param Regulator: Specifies the regulator state in SLEEP mode.
mbed_official 573:ad23fe03a082 394 * This parameter can be one of the following values:
mbed_official 573:ad23fe03a082 395 * @arg PWR_MAINREGULATOR_ON: SLEEP mode with regulator ON
mbed_official 573:ad23fe03a082 396 * @arg PWR_LOWPOWERREGULATOR_ON: SLEEP mode with low power regulator ON
mbed_official 573:ad23fe03a082 397 * @note This parameter is not used for the STM32F7 family and is kept as parameter
mbed_official 573:ad23fe03a082 398 * just to maintain compatibility with the lower power families.
mbed_official 573:ad23fe03a082 399 * @param SLEEPEntry: Specifies if SLEEP mode in entered with WFI or WFE instruction.
mbed_official 573:ad23fe03a082 400 * This parameter can be one of the following values:
mbed_official 573:ad23fe03a082 401 * @arg PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction
mbed_official 573:ad23fe03a082 402 * @arg PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction
mbed_official 573:ad23fe03a082 403 * @retval None
mbed_official 573:ad23fe03a082 404 */
mbed_official 573:ad23fe03a082 405 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry)
mbed_official 573:ad23fe03a082 406 {
mbed_official 573:ad23fe03a082 407 /* Check the parameters */
mbed_official 573:ad23fe03a082 408 assert_param(IS_PWR_REGULATOR(Regulator));
mbed_official 573:ad23fe03a082 409 assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry));
mbed_official 573:ad23fe03a082 410
mbed_official 573:ad23fe03a082 411 /* Clear SLEEPDEEP bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 412 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
mbed_official 573:ad23fe03a082 413
mbed_official 573:ad23fe03a082 414 /* Select SLEEP mode entry -------------------------------------------------*/
mbed_official 573:ad23fe03a082 415 if(SLEEPEntry == PWR_SLEEPENTRY_WFI)
mbed_official 573:ad23fe03a082 416 {
mbed_official 573:ad23fe03a082 417 /* Request Wait For Interrupt */
mbed_official 573:ad23fe03a082 418 __WFI();
mbed_official 573:ad23fe03a082 419 }
mbed_official 573:ad23fe03a082 420 else
mbed_official 573:ad23fe03a082 421 {
mbed_official 573:ad23fe03a082 422 /* Request Wait For Event */
mbed_official 573:ad23fe03a082 423 __SEV();
mbed_official 573:ad23fe03a082 424 __WFE();
mbed_official 573:ad23fe03a082 425 __WFE();
mbed_official 573:ad23fe03a082 426 }
mbed_official 573:ad23fe03a082 427 }
mbed_official 573:ad23fe03a082 428
mbed_official 573:ad23fe03a082 429 /**
mbed_official 573:ad23fe03a082 430 * @brief Enters Stop mode.
mbed_official 573:ad23fe03a082 431 * @note In Stop mode, all I/O pins keep the same state as in Run mode.
mbed_official 573:ad23fe03a082 432 * @note When exiting Stop mode by issuing an interrupt or a wakeup event,
mbed_official 573:ad23fe03a082 433 * the HSI RC oscillator is selected as system clock.
mbed_official 573:ad23fe03a082 434 * @note When the voltage regulator operates in low power mode, an additional
mbed_official 573:ad23fe03a082 435 * startup delay is incurred when waking up from Stop mode.
mbed_official 573:ad23fe03a082 436 * By keeping the internal regulator ON during Stop mode, the consumption
mbed_official 573:ad23fe03a082 437 * is higher although the startup time is reduced.
mbed_official 573:ad23fe03a082 438 * @param Regulator: Specifies the regulator state in Stop mode.
mbed_official 573:ad23fe03a082 439 * This parameter can be one of the following values:
mbed_official 573:ad23fe03a082 440 * @arg PWR_MAINREGULATOR_ON: Stop mode with regulator ON
mbed_official 573:ad23fe03a082 441 * @arg PWR_LOWPOWERREGULATOR_ON: Stop mode with low power regulator ON
mbed_official 573:ad23fe03a082 442 * @param STOPEntry: Specifies if Stop mode in entered with WFI or WFE instruction.
mbed_official 573:ad23fe03a082 443 * This parameter can be one of the following values:
mbed_official 573:ad23fe03a082 444 * @arg PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction
mbed_official 573:ad23fe03a082 445 * @arg PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction
mbed_official 573:ad23fe03a082 446 * @retval None
mbed_official 573:ad23fe03a082 447 */
mbed_official 573:ad23fe03a082 448 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
mbed_official 573:ad23fe03a082 449 {
mbed_official 573:ad23fe03a082 450 uint32_t tmpreg = 0;
mbed_official 573:ad23fe03a082 451
mbed_official 573:ad23fe03a082 452 /* Check the parameters */
mbed_official 573:ad23fe03a082 453 assert_param(IS_PWR_REGULATOR(Regulator));
mbed_official 573:ad23fe03a082 454 assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
mbed_official 573:ad23fe03a082 455
mbed_official 573:ad23fe03a082 456 /* Select the regulator state in Stop mode ---------------------------------*/
mbed_official 573:ad23fe03a082 457 tmpreg = PWR->CR1;
mbed_official 573:ad23fe03a082 458 /* Clear PDDS and LPDS bits */
mbed_official 573:ad23fe03a082 459 tmpreg &= (uint32_t)~(PWR_CR1_PDDS | PWR_CR1_LPDS);
mbed_official 573:ad23fe03a082 460
mbed_official 573:ad23fe03a082 461 /* Set LPDS, MRLVDS and LPLVDS bits according to Regulator value */
mbed_official 573:ad23fe03a082 462 tmpreg |= Regulator;
mbed_official 573:ad23fe03a082 463
mbed_official 573:ad23fe03a082 464 /* Store the new value */
mbed_official 573:ad23fe03a082 465 PWR->CR1 = tmpreg;
mbed_official 573:ad23fe03a082 466
mbed_official 573:ad23fe03a082 467 /* Set SLEEPDEEP bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 468 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
mbed_official 573:ad23fe03a082 469
mbed_official 573:ad23fe03a082 470 /* Select Stop mode entry --------------------------------------------------*/
mbed_official 573:ad23fe03a082 471 if(STOPEntry == PWR_STOPENTRY_WFI)
mbed_official 573:ad23fe03a082 472 {
mbed_official 573:ad23fe03a082 473 /* Request Wait For Interrupt */
mbed_official 573:ad23fe03a082 474 __WFI();
mbed_official 573:ad23fe03a082 475 }
mbed_official 573:ad23fe03a082 476 else
mbed_official 573:ad23fe03a082 477 {
mbed_official 573:ad23fe03a082 478 /* Request Wait For Event */
mbed_official 573:ad23fe03a082 479 __SEV();
mbed_official 573:ad23fe03a082 480 __WFE();
mbed_official 573:ad23fe03a082 481 __WFE();
mbed_official 573:ad23fe03a082 482 }
mbed_official 573:ad23fe03a082 483 /* Reset SLEEPDEEP bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 484 SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk);
mbed_official 573:ad23fe03a082 485 }
mbed_official 573:ad23fe03a082 486
mbed_official 573:ad23fe03a082 487 /**
mbed_official 573:ad23fe03a082 488 * @brief Enters Standby mode.
mbed_official 573:ad23fe03a082 489 * @note In Standby mode, all I/O pins are high impedance except for:
mbed_official 573:ad23fe03a082 490 * - Reset pad (still available)
mbed_official 573:ad23fe03a082 491 * - RTC_AF1 pin (PC13) if configured for tamper, time-stamp, RTC
mbed_official 573:ad23fe03a082 492 * Alarm out, or RTC clock calibration out.
mbed_official 573:ad23fe03a082 493 * - RTC_AF2 pin (PI8) if configured for tamper or time-stamp.
mbed_official 573:ad23fe03a082 494 * - WKUP pins if enabled.
mbed_official 573:ad23fe03a082 495 * @retval None
mbed_official 573:ad23fe03a082 496 */
mbed_official 573:ad23fe03a082 497 void HAL_PWR_EnterSTANDBYMode(void)
mbed_official 573:ad23fe03a082 498 {
mbed_official 573:ad23fe03a082 499 /* Select Standby mode */
mbed_official 573:ad23fe03a082 500 PWR->CR1 |= PWR_CR1_PDDS;
mbed_official 573:ad23fe03a082 501
mbed_official 573:ad23fe03a082 502 /* Set SLEEPDEEP bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 503 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
mbed_official 573:ad23fe03a082 504
mbed_official 573:ad23fe03a082 505 /* This option is used to ensure that store operations are completed */
mbed_official 573:ad23fe03a082 506 #if defined ( __CC_ARM)
mbed_official 573:ad23fe03a082 507 __force_stores();
mbed_official 573:ad23fe03a082 508 #endif
mbed_official 573:ad23fe03a082 509 /* Request Wait For Interrupt */
mbed_official 573:ad23fe03a082 510 __WFI();
mbed_official 573:ad23fe03a082 511 }
mbed_official 573:ad23fe03a082 512
mbed_official 573:ad23fe03a082 513 /**
mbed_official 573:ad23fe03a082 514 * @brief This function handles the PWR PVD interrupt request.
mbed_official 573:ad23fe03a082 515 * @note This API should be called under the PVD_IRQHandler().
mbed_official 573:ad23fe03a082 516 * @retval None
mbed_official 573:ad23fe03a082 517 */
mbed_official 573:ad23fe03a082 518 void HAL_PWR_PVD_IRQHandler(void)
mbed_official 573:ad23fe03a082 519 {
mbed_official 573:ad23fe03a082 520 /* Check PWR Exti flag */
mbed_official 573:ad23fe03a082 521 if(__HAL_PWR_PVD_EXTI_GET_FLAG() != RESET)
mbed_official 573:ad23fe03a082 522 {
mbed_official 573:ad23fe03a082 523 /* PWR PVD interrupt user callback */
mbed_official 573:ad23fe03a082 524 HAL_PWR_PVDCallback();
mbed_official 573:ad23fe03a082 525
mbed_official 573:ad23fe03a082 526 /* Clear PWR Exti pending bit */
mbed_official 573:ad23fe03a082 527 __HAL_PWR_PVD_EXTI_CLEAR_FLAG();
mbed_official 573:ad23fe03a082 528 }
mbed_official 573:ad23fe03a082 529 }
mbed_official 573:ad23fe03a082 530
mbed_official 573:ad23fe03a082 531 /**
mbed_official 573:ad23fe03a082 532 * @brief PWR PVD interrupt callback
mbed_official 573:ad23fe03a082 533 * @retval None
mbed_official 573:ad23fe03a082 534 */
mbed_official 573:ad23fe03a082 535 __weak void HAL_PWR_PVDCallback(void)
mbed_official 573:ad23fe03a082 536 {
mbed_official 573:ad23fe03a082 537 /* NOTE : This function Should not be modified, when the callback is needed,
mbed_official 573:ad23fe03a082 538 the HAL_PWR_PVDCallback could be implemented in the user file
mbed_official 573:ad23fe03a082 539 */
mbed_official 573:ad23fe03a082 540 }
mbed_official 573:ad23fe03a082 541
mbed_official 573:ad23fe03a082 542 /**
mbed_official 573:ad23fe03a082 543 * @brief Indicates Sleep-On-Exit when returning from Handler mode to Thread mode.
mbed_official 573:ad23fe03a082 544 * @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor
mbed_official 573:ad23fe03a082 545 * re-enters SLEEP mode when an interruption handling is over.
mbed_official 573:ad23fe03a082 546 * Setting this bit is useful when the processor is expected to run only on
mbed_official 573:ad23fe03a082 547 * interruptions handling.
mbed_official 573:ad23fe03a082 548 * @retval None
mbed_official 573:ad23fe03a082 549 */
mbed_official 573:ad23fe03a082 550 void HAL_PWR_EnableSleepOnExit(void)
mbed_official 573:ad23fe03a082 551 {
mbed_official 573:ad23fe03a082 552 /* Set SLEEPONEXIT bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 553 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
mbed_official 573:ad23fe03a082 554 }
mbed_official 573:ad23fe03a082 555
mbed_official 573:ad23fe03a082 556 /**
mbed_official 573:ad23fe03a082 557 * @brief Disables Sleep-On-Exit feature when returning from Handler mode to Thread mode.
mbed_official 573:ad23fe03a082 558 * @note Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor
mbed_official 573:ad23fe03a082 559 * re-enters SLEEP mode when an interruption handling is over.
mbed_official 573:ad23fe03a082 560 * @retval None
mbed_official 573:ad23fe03a082 561 */
mbed_official 573:ad23fe03a082 562 void HAL_PWR_DisableSleepOnExit(void)
mbed_official 573:ad23fe03a082 563 {
mbed_official 573:ad23fe03a082 564 /* Clear SLEEPONEXIT bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 565 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
mbed_official 573:ad23fe03a082 566 }
mbed_official 573:ad23fe03a082 567
mbed_official 573:ad23fe03a082 568 /**
mbed_official 573:ad23fe03a082 569 * @brief Enables CORTEX M4 SEVONPEND bit.
mbed_official 573:ad23fe03a082 570 * @note Sets SEVONPEND bit of SCR register. When this bit is set, this causes
mbed_official 573:ad23fe03a082 571 * WFE to wake up when an interrupt moves from inactive to pended.
mbed_official 573:ad23fe03a082 572 * @retval None
mbed_official 573:ad23fe03a082 573 */
mbed_official 573:ad23fe03a082 574 void HAL_PWR_EnableSEVOnPend(void)
mbed_official 573:ad23fe03a082 575 {
mbed_official 573:ad23fe03a082 576 /* Set SEVONPEND bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 577 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
mbed_official 573:ad23fe03a082 578 }
mbed_official 573:ad23fe03a082 579
mbed_official 573:ad23fe03a082 580 /**
mbed_official 573:ad23fe03a082 581 * @brief Disables CORTEX M4 SEVONPEND bit.
mbed_official 573:ad23fe03a082 582 * @note Clears SEVONPEND bit of SCR register. When this bit is set, this causes
mbed_official 573:ad23fe03a082 583 * WFE to wake up when an interrupt moves from inactive to pended.
mbed_official 573:ad23fe03a082 584 * @retval None
mbed_official 573:ad23fe03a082 585 */
mbed_official 573:ad23fe03a082 586 void HAL_PWR_DisableSEVOnPend(void)
mbed_official 573:ad23fe03a082 587 {
mbed_official 573:ad23fe03a082 588 /* Clear SEVONPEND bit of Cortex System Control Register */
mbed_official 573:ad23fe03a082 589 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
mbed_official 573:ad23fe03a082 590 }
mbed_official 573:ad23fe03a082 591
mbed_official 573:ad23fe03a082 592 /**
mbed_official 573:ad23fe03a082 593 * @}
mbed_official 573:ad23fe03a082 594 */
mbed_official 573:ad23fe03a082 595
mbed_official 573:ad23fe03a082 596 /**
mbed_official 573:ad23fe03a082 597 * @}
mbed_official 573:ad23fe03a082 598 */
mbed_official 573:ad23fe03a082 599
mbed_official 573:ad23fe03a082 600 #endif /* HAL_PWR_MODULE_ENABLED */
mbed_official 573:ad23fe03a082 601 /**
mbed_official 573:ad23fe03a082 602 * @}
mbed_official 573:ad23fe03a082 603 */
mbed_official 573:ad23fe03a082 604
mbed_official 573:ad23fe03a082 605 /**
mbed_official 573:ad23fe03a082 606 * @}
mbed_official 573:ad23fe03a082 607 */
mbed_official 573:ad23fe03a082 608
mbed_official 573:ad23fe03a082 609 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/