annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_pwr.c @ 105:68181cd61f20 kittz

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