annotate l476rg/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 32a3b1785697
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
2 ******************************************************************************
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
3 * @file stm32l4xx_hal_pwr_ex.c
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
4 * @author MCD Application Team
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
5 * @version V1.6.0
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
6 * @date 28-October-2016
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
7 * @brief Extended PWR HAL module driver.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
8 * This file provides firmware functions to manage the following
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
9 * functionalities of the Power Controller (PWR) peripheral:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
10 * + Extended Initialization and de-initialization functions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
11 * + Extended Peripheral Control functions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
12 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
13 ******************************************************************************
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
14 * @attention
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
15 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
16 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
17 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
18 * Redistribution and use in source and binary forms, with or without modification,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
19 * are permitted provided that the following conditions are met:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
20 * 1. Redistributions of source code must retain the above copyright notice,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
21 * this list of conditions and the following disclaimer.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
22 * 2. Redistributions in binary form must reproduce the above copyright notice,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
23 * this list of conditions and the following disclaimer in the documentation
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
24 * and/or other materials provided with the distribution.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
25 * 3. Neither the name of STMicroelectronics nor the names of its contributors
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
26 * may be used to endorse or promote products derived from this software
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
27 * without specific prior written permission.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
28 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
32 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
36 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
37 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
39 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
40 ******************************************************************************
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
41 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
42
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
43 /* Includes ------------------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
44 #include "stm32l4xx_hal.h"
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
45
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
46 /** @addtogroup STM32L4xx_HAL_Driver
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
47 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
48 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
49
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
50 /** @defgroup PWREx PWREx
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
51 * @brief PWR Extended HAL module driver
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
52 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
53 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
54
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
55 #ifdef HAL_PWR_MODULE_ENABLED
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
56
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
57 /* Private typedef -----------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
58 /* Private define ------------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
59
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
60 #if defined (STM32L431xx) || defined (STM32L432xx) || defined (STM32L433xx) || defined (STM32L442xx) || defined (STM32L443xx)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
61 #define PWR_PORTH_AVAILABLE_PINS ((uint32_t)0x0000000B) /* PH0/PH1/PH3 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
62 #elif defined (STM32L451xx) || defined (STM32L452xx) || defined (STM32L462xx)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
63 #define PWR_PORTH_AVAILABLE_PINS ((uint32_t)0x0000000B) /* PH0/PH1/PH3 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
64 #elif defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
65 #define PWR_PORTH_AVAILABLE_PINS ((uint32_t)0x00000003) /* PH0/PH1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
66 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
67
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
68 /** @defgroup PWR_Extended_Private_Defines PWR Extended Private Defines
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
69 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
70 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
71
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
72 /** @defgroup PWREx_PVM_Mode_Mask PWR PVM Mode Mask
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
73 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
74 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
75 #define PVM_MODE_IT ((uint32_t)0x00010000) /*!< Mask for interruption yielded by PVM threshold crossing */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
76 #define PVM_MODE_EVT ((uint32_t)0x00020000) /*!< Mask for event yielded by PVM threshold crossing */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
77 #define PVM_RISING_EDGE ((uint32_t)0x00000001) /*!< Mask for rising edge set as PVM trigger */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
78 #define PVM_FALLING_EDGE ((uint32_t)0x00000002) /*!< Mask for falling edge set as PVM trigger */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
79 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
80 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
81 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
82
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
83 /** @defgroup PWREx_TimeOut_Value PWR Extended Flag Setting Time Out Value
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
84 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
85 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
86 #define PWR_FLAG_SETTING_DELAY_US 50 /*!< Time out value for REGLPF and VOSF flags setting */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
87 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
88 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
89 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
90
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
91
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
92
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
93 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
94 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
95 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
96
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
97
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
98
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
99 /* Private macro -------------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
100 /* Private variables ---------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
101 /* Private function prototypes -----------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
102 /* Exported functions --------------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
103
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
104 /** @defgroup PWREx_Exported_Functions PWR Extended Exported Functions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
105 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
106 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
107
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
108 /** @defgroup PWREx_Exported_Functions_Group1 Extended Peripheral Control functions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
109 * @brief Extended Peripheral Control functions
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
110 *
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
111 @verbatim
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
112 ===============================================================================
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
113 ##### Extended Peripheral Initialization and de-initialization functions #####
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
114 ===============================================================================
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
115 [..]
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
116
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
117 @endverbatim
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
118 * @{
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
119 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
120
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
121
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
122 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
123 * @brief Return Voltage Scaling Range.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
124 * @retval VOS bit field (PWR_REGULATOR_VOLTAGE_RANGE1 or PWR_REGULATOR_VOLTAGE_RANGE2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
125 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
126 uint32_t HAL_PWREx_GetVoltageRange(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
127 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
128 return (PWR->CR1 & PWR_CR1_VOS);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
129 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
130
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
131
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
132
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
133 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
134 * @brief Configure the main internal regulator output voltage.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
135 * @param VoltageScaling: specifies the regulator output voltage to achieve
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
136 * a tradeoff between performance and power consumption.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
137 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
138 * @arg @ref PWR_REGULATOR_VOLTAGE_SCALE1 Regulator voltage output range 1 mode,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
139 * typical output voltage at 1.2 V,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
140 * system frequency up to 80 MHz.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
141 * @arg @ref PWR_REGULATOR_VOLTAGE_SCALE2 Regulator voltage output range 2 mode,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
142 * typical output voltage at 1.0 V,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
143 * system frequency up to 26 MHz.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
144 * @note When moving from Range 1 to Range 2, the system frequency must be decreased to
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
145 * a value below 26 MHz before calling HAL_PWREx_ControlVoltageScaling() API.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
146 * When moving from Range 2 to Range 1, the system frequency can be increased to
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
147 * a value up to 80 MHz after calling HAL_PWREx_ControlVoltageScaling() API.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
148 * @note When moving from Range 2 to Range 1, the API waits for VOSF flag to be
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
149 * cleared before returning the status. If the flag is not cleared within
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
150 * 50 microseconds, HAL_TIMEOUT status is reported.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
151 * @retval HAL Status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
152 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
153 HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
154 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
155 uint32_t wait_loop_index = 0;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
156
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
157 assert_param(IS_PWR_VOLTAGE_SCALING_RANGE(VoltageScaling));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
158
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
159 /* If Set Range 1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
160 if (VoltageScaling == PWR_REGULATOR_VOLTAGE_SCALE1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
161 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
162 if (READ_BIT(PWR->CR1, PWR_CR1_VOS) != PWR_REGULATOR_VOLTAGE_SCALE1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
163 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
164 /* Set Range 1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
165 MODIFY_REG(PWR->CR1, PWR_CR1_VOS, PWR_REGULATOR_VOLTAGE_SCALE1);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
166
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
167 /* Wait until VOSF is cleared */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
168 wait_loop_index = (PWR_FLAG_SETTING_DELAY_US * (SystemCoreClock / 1000000));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
169 while ((wait_loop_index != 0) && (HAL_IS_BIT_SET(PWR->SR2, PWR_SR2_VOSF)))
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
170 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
171 wait_loop_index--;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
172 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
173 if (HAL_IS_BIT_SET(PWR->SR2, PWR_SR2_VOSF))
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
174 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
175 return HAL_TIMEOUT;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
176 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
177 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
178 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
179 else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
180 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
181 if (READ_BIT(PWR->CR1, PWR_CR1_VOS) != PWR_REGULATOR_VOLTAGE_SCALE2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
182 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
183 /* Set Range 2 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
184 MODIFY_REG(PWR->CR1, PWR_CR1_VOS, PWR_REGULATOR_VOLTAGE_SCALE2);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
185 /* No need to wait for VOSF to be cleared for this transition */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
186 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
187 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
188
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
189 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
190 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
191
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
192
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
193 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
194 * @brief Enable battery charging.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
195 * When VDD is present, charge the external battery on VBAT thru an internal resistor.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
196 * @param ResistorSelection: specifies the resistor impedance.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
197 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
198 * @arg @ref PWR_BATTERY_CHARGING_RESISTOR_5 5 kOhms resistor
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
199 * @arg @ref PWR_BATTERY_CHARGING_RESISTOR_1_5 1.5 kOhms resistor
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
200 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
201 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
202 void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorSelection)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
203 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
204 assert_param(IS_PWR_BATTERY_RESISTOR_SELECT(ResistorSelection));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
205
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
206 /* Specify resistor selection */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
207 MODIFY_REG(PWR->CR4, PWR_CR4_VBRS, ResistorSelection);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
208
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
209 /* Enable battery charging */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
210 SET_BIT(PWR->CR4, PWR_CR4_VBE);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
211 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
212
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
213
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
214 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
215 * @brief Disable battery charging.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
216 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
217 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
218 void HAL_PWREx_DisableBatteryCharging(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
219 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
220 CLEAR_BIT(PWR->CR4, PWR_CR4_VBE);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
221 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
222
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
223
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
224 #if defined(PWR_CR2_USV)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
225 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
226 * @brief Enable VDDUSB supply.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
227 * @note Remove VDDUSB electrical and logical isolation, once VDDUSB supply is present.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
228 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
229 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
230 void HAL_PWREx_EnableVddUSB(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
231 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
232 SET_BIT(PWR->CR2, PWR_CR2_USV);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
233 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
234
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
235
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
236 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
237 * @brief Disable VDDUSB supply.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
238 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
239 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
240 void HAL_PWREx_DisableVddUSB(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
241 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
242 CLEAR_BIT(PWR->CR2, PWR_CR2_USV);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
243 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
244 #endif /* PWR_CR2_USV */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
245
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
246 #if defined(PWR_CR2_IOSV)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
247 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
248 * @brief Enable VDDIO2 supply.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
249 * @note Remove VDDIO2 electrical and logical isolation, once VDDIO2 supply is present.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
250 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
251 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
252 void HAL_PWREx_EnableVddIO2(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
253 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
254 SET_BIT(PWR->CR2, PWR_CR2_IOSV);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
255 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
256
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
257
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
258 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
259 * @brief Disable VDDIO2 supply.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
260 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
261 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
262 void HAL_PWREx_DisableVddIO2(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
263 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
264 CLEAR_BIT(PWR->CR2, PWR_CR2_IOSV);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
265 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
266 #endif /* PWR_CR2_IOSV */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
267
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
268
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
269 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
270 * @brief Enable Internal Wake-up Line.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
271 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
272 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
273 void HAL_PWREx_EnableInternalWakeUpLine(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
274 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
275 SET_BIT(PWR->CR3, PWR_CR3_EIWF);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
276 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
277
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
278
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
279 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
280 * @brief Disable Internal Wake-up Line.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
281 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
282 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
283 void HAL_PWREx_DisableInternalWakeUpLine(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
284 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
285 CLEAR_BIT(PWR->CR3, PWR_CR3_EIWF);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
286 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
287
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
288
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
289
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
290 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
291 * @brief Enable GPIO pull-up state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
292 * @note Set the relevant PUy bits of PWR_PUCRx register to configure the I/O in
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
293 * pull-up state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
294 * @note This state is effective in Standby and Shutdown modes only if APC bit
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
295 * is set through HAL_PWREx_EnablePullUpPullDownConfig() API.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
296 * @note The configuration is lost when exiting the Shutdown mode due to the
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
297 * power-on reset, maintained when exiting the Standby mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
298 * @note To avoid any conflict at Standby and Shutdown modes exits, the corresponding
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
299 * PDy bit of PWR_PDCRx register is cleared unless it is reserved.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
300 * @note Even if a PUy bit to set is reserved, the other PUy bits entered as input
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
301 * parameter at the same time are set.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
302 * @param GPIO: Specify the IO port. This parameter can be PWR_GPIO_A, ..., PWR_GPIO_H
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
303 * (or PWR_GPIO_I depending on the devices) to select the GPIO peripheral.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
304 * @param GPIONumber: Specify the I/O pins numbers.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
305 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
306 * PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for the port where less
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
307 * I/O pins are available) or the logical OR of several of them to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
308 * several bits for a given port in a single API call.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
309 * @retval HAL Status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
310 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
311 HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
312 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
313 assert_param(IS_PWR_GPIO(GPIO));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
314 assert_param(IS_PWR_GPIO_BIT_NUMBER(GPIONumber));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
315
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
316 switch (GPIO)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
317 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
318 case PWR_GPIO_A:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
319 SET_BIT(PWR->PUCRA, (GPIONumber & (~(PWR_GPIO_BIT_14))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
320 CLEAR_BIT(PWR->PDCRA, (GPIONumber & (~(PWR_GPIO_BIT_13|PWR_GPIO_BIT_15))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
321 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
322 case PWR_GPIO_B:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
323 SET_BIT(PWR->PUCRB, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
324 CLEAR_BIT(PWR->PDCRB, (GPIONumber & (~(PWR_GPIO_BIT_4))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
325 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
326 case PWR_GPIO_C:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
327 SET_BIT(PWR->PUCRC, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
328 CLEAR_BIT(PWR->PDCRC, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
329 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
330 #if defined(GPIOD)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
331 case PWR_GPIO_D:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
332 SET_BIT(PWR->PUCRD, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
333 CLEAR_BIT(PWR->PDCRD, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
334 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
335 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
336 #if defined(GPIOE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
337 case PWR_GPIO_E:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
338 SET_BIT(PWR->PUCRE, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
339 CLEAR_BIT(PWR->PDCRE, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
340 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
341 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
342 #if defined(GPIOF)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
343 case PWR_GPIO_F:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
344 SET_BIT(PWR->PUCRF, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
345 CLEAR_BIT(PWR->PDCRF, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
346 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
347 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
348 #if defined(GPIOG)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
349 case PWR_GPIO_G:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
350 SET_BIT(PWR->PUCRG, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
351 CLEAR_BIT(PWR->PDCRG, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
352 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
353 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
354 case PWR_GPIO_H:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
355 SET_BIT(PWR->PUCRH, (GPIONumber & PWR_PORTH_AVAILABLE_PINS));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
356 CLEAR_BIT(PWR->PDCRH, (GPIONumber & PWR_PORTH_AVAILABLE_PINS));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
357 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
358 default:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
359 return HAL_ERROR;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
360 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
361
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
362 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
363 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
364
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
365
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
366 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
367 * @brief Disable GPIO pull-up state in Standby mode and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
368 * @note Reset the relevant PUy bits of PWR_PUCRx register used to configure the I/O
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
369 * in pull-up state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
370 * @note Even if a PUy bit to reset is reserved, the other PUy bits entered as input
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
371 * parameter at the same time are reset.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
372 * @param GPIO: Specifies the IO port. This parameter can be PWR_GPIO_A, ..., PWR_GPIO_H
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
373 * (or PWR_GPIO_I depending on the devices) to select the GPIO peripheral.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
374 * @param GPIONumber: Specify the I/O pins numbers.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
375 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
376 * PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for the port where less
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
377 * I/O pins are available) or the logical OR of several of them to reset
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
378 * several bits for a given port in a single API call.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
379 * @retval HAL Status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
380 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
381 HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullUp(uint32_t GPIO, uint32_t GPIONumber)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
382 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
383 assert_param(IS_PWR_GPIO(GPIO));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
384 assert_param(IS_PWR_GPIO_BIT_NUMBER(GPIONumber));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
385
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
386 switch (GPIO)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
387 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
388 case PWR_GPIO_A:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
389 CLEAR_BIT(PWR->PUCRA, (GPIONumber & (~(PWR_GPIO_BIT_14))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
390 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
391 case PWR_GPIO_B:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
392 CLEAR_BIT(PWR->PUCRB, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
393 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
394 case PWR_GPIO_C:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
395 CLEAR_BIT(PWR->PUCRC, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
396 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
397 #if defined(GPIOD)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
398 case PWR_GPIO_D:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
399 CLEAR_BIT(PWR->PUCRD, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
400 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
401 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
402 #if defined(GPIOE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
403 case PWR_GPIO_E:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
404 CLEAR_BIT(PWR->PUCRE, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
405 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
406 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
407 #if defined(GPIOF)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
408 case PWR_GPIO_F:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
409 CLEAR_BIT(PWR->PUCRF, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
410 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
411 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
412 #if defined(GPIOG)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
413 case PWR_GPIO_G:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
414 CLEAR_BIT(PWR->PUCRG, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
415 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
416 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
417 case PWR_GPIO_H:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
418 CLEAR_BIT(PWR->PUCRH, (GPIONumber & PWR_PORTH_AVAILABLE_PINS));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
419 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
420 default:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
421 return HAL_ERROR;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
422 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
423
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
424 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
425 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
426
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
427
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
428
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
429 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
430 * @brief Enable GPIO pull-down state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
431 * @note Set the relevant PDy bits of PWR_PDCRx register to configure the I/O in
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
432 * pull-down state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
433 * @note This state is effective in Standby and Shutdown modes only if APC bit
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
434 * is set through HAL_PWREx_EnablePullUpPullDownConfig() API.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
435 * @note The configuration is lost when exiting the Shutdown mode due to the
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
436 * power-on reset, maintained when exiting the Standby mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
437 * @note To avoid any conflict at Standby and Shutdown modes exits, the corresponding
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
438 * PUy bit of PWR_PUCRx register is cleared unless it is reserved.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
439 * @note Even if a PDy bit to set is reserved, the other PDy bits entered as input
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
440 * parameter at the same time are set.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
441 * @param GPIO: Specify the IO port. This parameter can be PWR_GPIO_A..PWR_GPIO_H
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
442 * (or PWR_GPIO_I depending on the devices) to select the GPIO peripheral.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
443 * @param GPIONumber: Specify the I/O pins numbers.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
444 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
445 * PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for the port where less
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
446 * I/O pins are available) or the logical OR of several of them to set
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
447 * several bits for a given port in a single API call.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
448 * @retval HAL Status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
449 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
450 HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
451 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
452 assert_param(IS_PWR_GPIO(GPIO));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
453 assert_param(IS_PWR_GPIO_BIT_NUMBER(GPIONumber));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
454
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
455 switch (GPIO)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
456 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
457 case PWR_GPIO_A:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
458 SET_BIT(PWR->PDCRA, (GPIONumber & (~(PWR_GPIO_BIT_13|PWR_GPIO_BIT_15))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
459 CLEAR_BIT(PWR->PUCRA, (GPIONumber & (~(PWR_GPIO_BIT_14))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
460 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
461 case PWR_GPIO_B:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
462 SET_BIT(PWR->PDCRB, (GPIONumber & (~(PWR_GPIO_BIT_4))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
463 CLEAR_BIT(PWR->PUCRB, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
464 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
465 case PWR_GPIO_C:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
466 SET_BIT(PWR->PDCRC, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
467 CLEAR_BIT(PWR->PUCRC, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
468 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
469 #if defined(GPIOD)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
470 case PWR_GPIO_D:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
471 SET_BIT(PWR->PDCRD, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
472 CLEAR_BIT(PWR->PUCRD, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
473 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
474 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
475 #if defined(GPIOE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
476 case PWR_GPIO_E:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
477 SET_BIT(PWR->PDCRE, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
478 CLEAR_BIT(PWR->PUCRE, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
479 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
480 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
481 #if defined(GPIOF)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
482 case PWR_GPIO_F:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
483 SET_BIT(PWR->PDCRF, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
484 CLEAR_BIT(PWR->PUCRF, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
485 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
486 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
487 #if defined(GPIOG)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
488 case PWR_GPIO_G:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
489 SET_BIT(PWR->PDCRG, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
490 CLEAR_BIT(PWR->PUCRG, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
491 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
492 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
493 case PWR_GPIO_H:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
494 SET_BIT(PWR->PDCRH, (GPIONumber & PWR_PORTH_AVAILABLE_PINS));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
495 CLEAR_BIT(PWR->PUCRH, (GPIONumber & PWR_PORTH_AVAILABLE_PINS));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
496 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
497 default:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
498 return HAL_ERROR;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
499 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
500
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
501 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
502 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
503
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
504
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
505 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
506 * @brief Disable GPIO pull-down state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
507 * @note Reset the relevant PDy bits of PWR_PDCRx register used to configure the I/O
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
508 * in pull-down state in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
509 * @note Even if a PDy bit to reset is reserved, the other PDy bits entered as input
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
510 * parameter at the same time are reset.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
511 * @param GPIO: Specifies the IO port. This parameter can be PWR_GPIO_A..PWR_GPIO_H
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
512 * (or PWR_GPIO_I depending on the devices) to select the GPIO peripheral.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
513 * @param GPIONumber: Specify the I/O pins numbers.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
514 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
515 * PWR_GPIO_BIT_0, ..., PWR_GPIO_BIT_15 (except for the port where less
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
516 * I/O pins are available) or the logical OR of several of them to reset
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
517 * several bits for a given port in a single API call.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
518 * @retval HAL Status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
519 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
520 HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
521 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
522 assert_param(IS_PWR_GPIO(GPIO));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
523 assert_param(IS_PWR_GPIO_BIT_NUMBER(GPIONumber));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
524
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
525 switch (GPIO)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
526 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
527 case PWR_GPIO_A:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
528 CLEAR_BIT(PWR->PDCRA, (GPIONumber & (~(PWR_GPIO_BIT_13|PWR_GPIO_BIT_15))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
529 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
530 case PWR_GPIO_B:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
531 CLEAR_BIT(PWR->PDCRB, (GPIONumber & (~(PWR_GPIO_BIT_4))));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
532 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
533 case PWR_GPIO_C:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
534 CLEAR_BIT(PWR->PDCRC, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
535 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
536 #if defined(GPIOD)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
537 case PWR_GPIO_D:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
538 CLEAR_BIT(PWR->PDCRD, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
539 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
540 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
541 #if defined(GPIOE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
542 case PWR_GPIO_E:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
543 CLEAR_BIT(PWR->PDCRE, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
544 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
545 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
546 #if defined(GPIOF)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
547 case PWR_GPIO_F:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
548 CLEAR_BIT(PWR->PDCRF, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
549 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
550 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
551 #if defined(GPIOG)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
552 case PWR_GPIO_G:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
553 CLEAR_BIT(PWR->PDCRG, GPIONumber);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
554 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
555 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
556 case PWR_GPIO_H:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
557 CLEAR_BIT(PWR->PDCRH, (GPIONumber & PWR_PORTH_AVAILABLE_PINS));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
558 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
559 default:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
560 return HAL_ERROR;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
561 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
562
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
563 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
564 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
565
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
566
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
567
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
568 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
569 * @brief Enable pull-up and pull-down configuration.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
570 * @note When APC bit is set, the I/O pull-up and pull-down configurations defined in
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
571 * PWR_PUCRx and PWR_PDCRx registers are applied in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
572 * @note Pull-up set by PUy bit of PWR_PUCRx register is not activated if the corresponding
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
573 * PDy bit of PWR_PDCRx register is also set (pull-down configuration priority is higher).
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
574 * HAL_PWREx_EnableGPIOPullUp() and HAL_PWREx_EnableGPIOPullDown() API's ensure there
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
575 * is no conflict when setting PUy or PDy bit.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
576 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
577 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
578 void HAL_PWREx_EnablePullUpPullDownConfig(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
579 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
580 SET_BIT(PWR->CR3, PWR_CR3_APC);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
581 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
582
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
583
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
584 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
585 * @brief Disable pull-up and pull-down configuration.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
586 * @note When APC bit is cleared, the I/O pull-up and pull-down configurations defined in
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
587 * PWR_PUCRx and PWR_PDCRx registers are not applied in Standby and Shutdown modes.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
588 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
589 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
590 void HAL_PWREx_DisablePullUpPullDownConfig(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
591 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
592 CLEAR_BIT(PWR->CR3, PWR_CR3_APC);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
593 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
594
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
595
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
596
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
597 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
598 * @brief Enable SRAM2 content retention in Standby mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
599 * @note When RRS bit is set, SRAM2 is powered by the low-power regulator in
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
600 * Standby mode and its content is kept.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
601 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
602 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
603 void HAL_PWREx_EnableSRAM2ContentRetention(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
604 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
605 SET_BIT(PWR->CR3, PWR_CR3_RRS);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
606 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
607
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
608
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
609 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
610 * @brief Disable SRAM2 content retention in Standby mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
611 * @note When RRS bit is reset, SRAM2 is powered off in Standby mode
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
612 * and its content is lost.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
613 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
614 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
615 void HAL_PWREx_DisableSRAM2ContentRetention(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
616 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
617 CLEAR_BIT(PWR->CR3, PWR_CR3_RRS);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
618 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
619
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
620
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
621
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
622
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
623 #if defined(PWR_CR2_PVME1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
624 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
625 * @brief Enable the Power Voltage Monitoring 1: VDDUSB versus 1.2V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
626 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
627 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
628 void HAL_PWREx_EnablePVM1(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
629 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
630 SET_BIT(PWR->CR2, PWR_PVM_1);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
631 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
632
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
633 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
634 * @brief Disable the Power Voltage Monitoring 1: VDDUSB versus 1.2V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
635 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
636 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
637 void HAL_PWREx_DisablePVM1(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
638 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
639 CLEAR_BIT(PWR->CR2, PWR_PVM_1);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
640 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
641 #endif /* PWR_CR2_PVME1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
642
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
643
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
644 #if defined(PWR_CR2_PVME2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
645 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
646 * @brief Enable the Power Voltage Monitoring 2: VDDIO2 versus 0.9V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
647 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
648 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
649 void HAL_PWREx_EnablePVM2(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
650 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
651 SET_BIT(PWR->CR2, PWR_PVM_2);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
652 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
653
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
654 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
655 * @brief Disable the Power Voltage Monitoring 2: VDDIO2 versus 0.9V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
656 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
657 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
658 void HAL_PWREx_DisablePVM2(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
659 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
660 CLEAR_BIT(PWR->CR2, PWR_PVM_2);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
661 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
662 #endif /* PWR_CR2_PVME2 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
663
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
664
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
665 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
666 * @brief Enable the Power Voltage Monitoring 3: VDDA versus 1.62V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
667 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
668 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
669 void HAL_PWREx_EnablePVM3(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
670 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
671 SET_BIT(PWR->CR2, PWR_PVM_3);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
672 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
673
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
674 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
675 * @brief Disable the Power Voltage Monitoring 3: VDDA versus 1.62V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
676 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
677 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
678 void HAL_PWREx_DisablePVM3(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
679 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
680 CLEAR_BIT(PWR->CR2, PWR_PVM_3);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
681 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
682
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
683
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
684 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
685 * @brief Enable the Power Voltage Monitoring 4: VDDA versus 2.2V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
686 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
687 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
688 void HAL_PWREx_EnablePVM4(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
689 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
690 SET_BIT(PWR->CR2, PWR_PVM_4);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
691 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
692
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
693 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
694 * @brief Disable the Power Voltage Monitoring 4: VDDA versus 2.2V.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
695 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
696 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
697 void HAL_PWREx_DisablePVM4(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
698 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
699 CLEAR_BIT(PWR->CR2, PWR_PVM_4);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
700 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
701
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
702
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
703
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
704
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
705 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
706 * @brief Configure the Peripheral Voltage Monitoring (PVM).
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
707 * @param sConfigPVM: pointer to a PWR_PVMTypeDef structure that contains the
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
708 * PVM configuration information.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
709 * @note The API configures a single PVM according to the information contained
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
710 * in the input structure. To configure several PVMs, the API must be singly
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
711 * called for each PVM used.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
712 * @note Refer to the electrical characteristics of your device datasheet for
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
713 * more details about the voltage thresholds corresponding to each
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
714 * detection level and to each monitored supply.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
715 * @retval HAL status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
716 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
717 HAL_StatusTypeDef HAL_PWREx_ConfigPVM(PWR_PVMTypeDef *sConfigPVM)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
718 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
719 /* Check the parameters */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
720 assert_param(IS_PWR_PVM_TYPE(sConfigPVM->PVMType));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
721 assert_param(IS_PWR_PVM_MODE(sConfigPVM->Mode));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
722
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
723
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
724 /* Configure EXTI 35 to 38 interrupts if so required:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
725 scan thru PVMType to detect which PVMx is set and
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
726 configure the corresponding EXTI line accordingly. */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
727 switch (sConfigPVM->PVMType)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
728 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
729 #if defined(PWR_CR2_PVME1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
730 case PWR_PVM_1:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
731 /* Clear any previous config. Keep it clear if no event or IT mode is selected */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
732 __HAL_PWR_PVM1_EXTI_DISABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
733 __HAL_PWR_PVM1_EXTI_DISABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
734 __HAL_PWR_PVM1_EXTI_DISABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
735 __HAL_PWR_PVM1_EXTI_DISABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
736
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
737 /* Configure interrupt mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
738 if((sConfigPVM->Mode & PVM_MODE_IT) == PVM_MODE_IT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
739 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
740 __HAL_PWR_PVM1_EXTI_ENABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
741 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
742
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
743 /* Configure event mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
744 if((sConfigPVM->Mode & PVM_MODE_EVT) == PVM_MODE_EVT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
745 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
746 __HAL_PWR_PVM1_EXTI_ENABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
747 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
748
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
749 /* Configure the edge */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
750 if((sConfigPVM->Mode & PVM_RISING_EDGE) == PVM_RISING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
751 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
752 __HAL_PWR_PVM1_EXTI_ENABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
753 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
754
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
755 if((sConfigPVM->Mode & PVM_FALLING_EDGE) == PVM_FALLING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
756 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
757 __HAL_PWR_PVM1_EXTI_ENABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
758 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
759 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
760 #endif /* PWR_CR2_PVME1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
761
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
762 #if defined(PWR_CR2_PVME2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
763 case PWR_PVM_2:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
764 /* Clear any previous config. Keep it clear if no event or IT mode is selected */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
765 __HAL_PWR_PVM2_EXTI_DISABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
766 __HAL_PWR_PVM2_EXTI_DISABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
767 __HAL_PWR_PVM2_EXTI_DISABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
768 __HAL_PWR_PVM2_EXTI_DISABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
769
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
770 /* Configure interrupt mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
771 if((sConfigPVM->Mode & PVM_MODE_IT) == PVM_MODE_IT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
772 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
773 __HAL_PWR_PVM2_EXTI_ENABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
774 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
775
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
776 /* Configure event mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
777 if((sConfigPVM->Mode & PVM_MODE_EVT) == PVM_MODE_EVT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
778 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
779 __HAL_PWR_PVM2_EXTI_ENABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
780 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
781
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
782 /* Configure the edge */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
783 if((sConfigPVM->Mode & PVM_RISING_EDGE) == PVM_RISING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
784 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
785 __HAL_PWR_PVM2_EXTI_ENABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
786 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
787
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
788 if((sConfigPVM->Mode & PVM_FALLING_EDGE) == PVM_FALLING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
789 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
790 __HAL_PWR_PVM2_EXTI_ENABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
791 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
792 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
793 #endif /* PWR_CR2_PVME2 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
794
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
795 case PWR_PVM_3:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
796 /* Clear any previous config. Keep it clear if no event or IT mode is selected */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
797 __HAL_PWR_PVM3_EXTI_DISABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
798 __HAL_PWR_PVM3_EXTI_DISABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
799 __HAL_PWR_PVM3_EXTI_DISABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
800 __HAL_PWR_PVM3_EXTI_DISABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
801
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
802 /* Configure interrupt mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
803 if((sConfigPVM->Mode & PVM_MODE_IT) == PVM_MODE_IT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
804 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
805 __HAL_PWR_PVM3_EXTI_ENABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
806 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
807
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
808 /* Configure event mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
809 if((sConfigPVM->Mode & PVM_MODE_EVT) == PVM_MODE_EVT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
810 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
811 __HAL_PWR_PVM3_EXTI_ENABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
812 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
813
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
814 /* Configure the edge */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
815 if((sConfigPVM->Mode & PVM_RISING_EDGE) == PVM_RISING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
816 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
817 __HAL_PWR_PVM3_EXTI_ENABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
818 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
819
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
820 if((sConfigPVM->Mode & PVM_FALLING_EDGE) == PVM_FALLING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
821 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
822 __HAL_PWR_PVM3_EXTI_ENABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
823 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
824 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
825
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
826 case PWR_PVM_4:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
827 /* Clear any previous config. Keep it clear if no event or IT mode is selected */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
828 __HAL_PWR_PVM4_EXTI_DISABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
829 __HAL_PWR_PVM4_EXTI_DISABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
830 __HAL_PWR_PVM4_EXTI_DISABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
831 __HAL_PWR_PVM4_EXTI_DISABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
832
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
833 /* Configure interrupt mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
834 if((sConfigPVM->Mode & PVM_MODE_IT) == PVM_MODE_IT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
835 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
836 __HAL_PWR_PVM4_EXTI_ENABLE_IT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
837 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
838
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
839 /* Configure event mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
840 if((sConfigPVM->Mode & PVM_MODE_EVT) == PVM_MODE_EVT)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
841 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
842 __HAL_PWR_PVM4_EXTI_ENABLE_EVENT();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
843 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
844
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
845 /* Configure the edge */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
846 if((sConfigPVM->Mode & PVM_RISING_EDGE) == PVM_RISING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
847 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
848 __HAL_PWR_PVM4_EXTI_ENABLE_RISING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
849 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
850
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
851 if((sConfigPVM->Mode & PVM_FALLING_EDGE) == PVM_FALLING_EDGE)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
852 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
853 __HAL_PWR_PVM4_EXTI_ENABLE_FALLING_EDGE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
854 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
855 break;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
856
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
857 default:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
858 return HAL_ERROR;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
859
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
860 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
861
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
862
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
863 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
864 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
865
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
866
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
867
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
868 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
869 * @brief Enter Low-power Run mode
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
870 * @note In Low-power Run mode, all I/O pins keep the same state as in Run mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
871 * @note When Regulator is set to PWR_LOWPOWERREGULATOR_ON, the user can optionally configure the
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
872 * Flash in power-down monde in setting the RUN_PD bit in FLASH_ACR register.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
873 * Additionally, the clock frequency must be reduced below 2 MHz.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
874 * Setting RUN_PD in FLASH_ACR then appropriately reducing the clock frequency must
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
875 * be done before calling HAL_PWREx_EnableLowPowerRunMode() API.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
876 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
877 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
878 void HAL_PWREx_EnableLowPowerRunMode(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
879 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
880 /* Set Regulator parameter */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
881 SET_BIT(PWR->CR1, PWR_CR1_LPR);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
882 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
883
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
884
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
885 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
886 * @brief Exit Low-power Run mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
887 * @note Before HAL_PWREx_DisableLowPowerRunMode() completion, the function checks that
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
888 * REGLPF has been properly reset (otherwise, HAL_PWREx_DisableLowPowerRunMode
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
889 * returns HAL_TIMEOUT status). The system clock frequency can then be
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
890 * increased above 2 MHz.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
891 * @retval HAL Status
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
892 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
893 HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
894 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
895 uint32_t wait_loop_index = 0;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
896
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
897 /* Clear LPR bit */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
898 CLEAR_BIT(PWR->CR1, PWR_CR1_LPR);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
899
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
900 /* Wait until REGLPF is reset */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
901 wait_loop_index = (PWR_FLAG_SETTING_DELAY_US * (SystemCoreClock / 1000000));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
902 while ((wait_loop_index != 0) && (HAL_IS_BIT_SET(PWR->SR2, PWR_SR2_REGLPF)))
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
903 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
904 wait_loop_index--;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
905 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
906 if (HAL_IS_BIT_SET(PWR->SR2, PWR_SR2_REGLPF))
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
907 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
908 return HAL_TIMEOUT;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
909 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
910
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
911 return HAL_OK;
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
912 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
913
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
914
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
915 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
916 * @brief Enter Stop 0 mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
917 * @note In Stop 0 mode, main and low voltage regulators are ON.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
918 * @note In Stop 0 mode, all I/O pins keep the same state as in Run mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
919 * @note All clocks in the VCORE domain are stopped; the PLL, the MSI,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
920 * the HSI and the HSE oscillators are disabled. Some peripherals with the wakeup capability
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
921 * (I2Cx, USARTx and LPUART) can switch on the HSI to receive a frame, and switch off the HSI
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
922 * after receiving the frame if it is not a wakeup frame. In this case, the HSI clock is propagated
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
923 * only to the peripheral requesting it.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
924 * SRAM1, SRAM2 and register contents are preserved.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
925 * The BOR is available.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
926 * @note When exiting Stop 0 mode by issuing an interrupt or a wakeup event,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
927 * the HSI RC oscillator is selected as system clock if STOPWUCK bit in RCC_CFGR register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
928 * is set; the MSI oscillator is selected if STOPWUCK is cleared.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
929 * @note By keeping the internal regulator ON during Stop 0 mode, the consumption
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
930 * is higher although the startup time is reduced.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
931 * @param STOPEntry specifies if Stop mode in entered with WFI or WFE instruction.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
932 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
933 * @arg @ref PWR_STOPENTRY_WFI Enter Stop mode with WFI instruction
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
934 * @arg @ref PWR_STOPENTRY_WFE Enter Stop mode with WFE instruction
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
935 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
936 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
937 void HAL_PWREx_EnterSTOP0Mode(uint8_t STOPEntry)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
938 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
939 /* Check the parameters */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
940 assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
941
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
942 /* Stop 0 mode with Main Regulator */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
943 MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_CR1_LPMS_STOP0);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
944
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
945 /* Set SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
946 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
947
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
948 /* Select Stop mode entry --------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
949 if(STOPEntry == PWR_STOPENTRY_WFI)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
950 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
951 /* Request Wait For Interrupt */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
952 __WFI();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
953 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
954 else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
955 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
956 /* Request Wait For Event */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
957 __SEV();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
958 __WFE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
959 __WFE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
960 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
961
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
962 /* Reset SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
963 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
964 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
965
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
966
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
967 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
968 * @brief Enter Stop 1 mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
969 * @note In Stop 1 mode, only low power voltage regulator is ON.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
970 * @note In Stop 1 mode, all I/O pins keep the same state as in Run mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
971 * @note All clocks in the VCORE domain are stopped; the PLL, the MSI,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
972 * the HSI and the HSE oscillators are disabled. Some peripherals with the wakeup capability
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
973 * (I2Cx, USARTx and LPUART) can switch on the HSI to receive a frame, and switch off the HSI
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
974 * after receiving the frame if it is not a wakeup frame. In this case, the HSI clock is propagated
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
975 * only to the peripheral requesting it.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
976 * SRAM1, SRAM2 and register contents are preserved.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
977 * The BOR is available.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
978 * @note When exiting Stop 1 mode by issuing an interrupt or a wakeup event,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
979 * the HSI RC oscillator is selected as system clock if STOPWUCK bit in RCC_CFGR register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
980 * is set; the MSI oscillator is selected if STOPWUCK is cleared.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
981 * @note Due to low power mode, an additional startup delay is incurred when waking up from Stop 1 mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
982 * @param STOPEntry specifies if Stop mode in entered with WFI or WFE instruction.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
983 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
984 * @arg @ref PWR_STOPENTRY_WFI Enter Stop mode with WFI instruction
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
985 * @arg @ref PWR_STOPENTRY_WFE Enter Stop mode with WFE instruction
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
986 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
987 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
988 void HAL_PWREx_EnterSTOP1Mode(uint8_t STOPEntry)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
989 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
990 /* Check the parameters */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
991 assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
992
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
993 /* Stop 1 mode with Low-Power Regulator */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
994 MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_CR1_LPMS_STOP1);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
995
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
996 /* Set SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
997 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
998
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
999 /* Select Stop mode entry --------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1000 if(STOPEntry == PWR_STOPENTRY_WFI)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1001 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1002 /* Request Wait For Interrupt */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1003 __WFI();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1004 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1005 else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1006 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1007 /* Request Wait For Event */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1008 __SEV();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1009 __WFE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1010 __WFE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1011 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1012
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1013 /* Reset SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1014 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1015 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1016
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1017
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1018 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1019 * @brief Enter Stop 2 mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1020 * @note In Stop 2 mode, only low power voltage regulator is ON.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1021 * @note In Stop 2 mode, all I/O pins keep the same state as in Run mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1022 * @note All clocks in the VCORE domain are stopped, the PLL, the MSI,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1023 * the HSI and the HSE oscillators are disabled. Some peripherals with wakeup capability
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1024 * (LCD, LPTIM1, I2C3 and LPUART) can switch on the HSI to receive a frame, and switch off the HSI after
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1025 * receiving the frame if it is not a wakeup frame. In this case the HSI clock is propagated only
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1026 * to the peripheral requesting it.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1027 * SRAM1, SRAM2 and register contents are preserved.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1028 * The BOR is available.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1029 * The voltage regulator is set in low-power mode but LPR bit must be cleared to enter stop 2 mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1030 * Otherwise, Stop 1 mode is entered.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1031 * @note When exiting Stop 2 mode by issuing an interrupt or a wakeup event,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1032 * the HSI RC oscillator is selected as system clock if STOPWUCK bit in RCC_CFGR register
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1033 * is set; the MSI oscillator is selected if STOPWUCK is cleared.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1034 * @param STOPEntry specifies if Stop mode in entered with WFI or WFE instruction.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1035 * This parameter can be one of the following values:
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1036 * @arg @ref PWR_STOPENTRY_WFI Enter Stop mode with WFI instruction
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1037 * @arg @ref PWR_STOPENTRY_WFE Enter Stop mode with WFE instruction
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1038 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1039 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1040 void HAL_PWREx_EnterSTOP2Mode(uint8_t STOPEntry)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1041 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1042 /* Check the parameter */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1043 assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1044
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1045 /* Set Stop mode 2 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1046 MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_CR1_LPMS_STOP2);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1047
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1048 /* Set SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1049 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1050
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1051 /* Select Stop mode entry --------------------------------------------------*/
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1052 if(STOPEntry == PWR_STOPENTRY_WFI)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1053 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1054 /* Request Wait For Interrupt */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1055 __WFI();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1056 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1057 else
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1058 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1059 /* Request Wait For Event */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1060 __SEV();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1061 __WFE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1062 __WFE();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1063 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1064
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1065 /* Reset SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1066 CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1067 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1068
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1069
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1070
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1071
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1072
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1073 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1074 * @brief Enter Shutdown mode.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1075 * @note In Shutdown mode, the PLL, the HSI, the MSI, the LSI and the HSE oscillators are switched
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1076 * off. The voltage regulator is disabled and Vcore domain is powered off.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1077 * SRAM1, SRAM2 and registers contents are lost except for registers in the Backup domain.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1078 * The BOR is not available.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1079 * @note The I/Os can be configured either with a pull-up or pull-down or can be kept in analog state.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1080 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1081 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1082 void HAL_PWREx_EnterSHUTDOWNMode(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1083 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1084
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1085 /* Set Shutdown mode */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1086 MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_CR1_LPMS_SHUTDOWN);
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1087
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1088 /* Set SLEEPDEEP bit of Cortex System Control Register */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1089 SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1090
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1091 /* This option is used to ensure that store operations are completed */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1092 #if defined ( __CC_ARM)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1093 __force_stores();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1094 #endif
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1095 /* Request Wait For Interrupt */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1096 __WFI();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1097 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1098
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1099
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1100
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1101
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1102 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1103 * @brief This function handles the PWR PVD/PVMx interrupt request.
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1104 * @note This API should be called under the PVD_PVM_IRQHandler().
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1105 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1106 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1107 void HAL_PWREx_PVD_PVM_IRQHandler(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1108 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1109 /* Check PWR exti flag */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1110 if(__HAL_PWR_PVD_EXTI_GET_FLAG() != RESET)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1111 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1112 /* PWR PVD interrupt user callback */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1113 HAL_PWR_PVDCallback();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1114
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1115 /* Clear PVD exti pending bit */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1116 __HAL_PWR_PVD_EXTI_CLEAR_FLAG();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1117 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1118 /* Next, successively check PVMx exti flags */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1119 #if defined(PWR_CR2_PVME1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1120 if(__HAL_PWR_PVM1_EXTI_GET_FLAG() != RESET)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1121 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1122 /* PWR PVM1 interrupt user callback */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1123 HAL_PWREx_PVM1Callback();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1124
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1125 /* Clear PVM1 exti pending bit */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1126 __HAL_PWR_PVM1_EXTI_CLEAR_FLAG();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1127 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1128 #endif /* PWR_CR2_PVME1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1129 #if defined(PWR_CR2_PVME2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1130 if(__HAL_PWR_PVM2_EXTI_GET_FLAG() != RESET)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1131 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1132 /* PWR PVM2 interrupt user callback */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1133 HAL_PWREx_PVM2Callback();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1134
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1135 /* Clear PVM2 exti pending bit */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1136 __HAL_PWR_PVM2_EXTI_CLEAR_FLAG();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1137 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1138 #endif /* PWR_CR2_PVME2 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1139 if(__HAL_PWR_PVM3_EXTI_GET_FLAG() != RESET)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1140 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1141 /* PWR PVM3 interrupt user callback */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1142 HAL_PWREx_PVM3Callback();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1143
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1144 /* Clear PVM3 exti pending bit */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1145 __HAL_PWR_PVM3_EXTI_CLEAR_FLAG();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1146 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1147 if(__HAL_PWR_PVM4_EXTI_GET_FLAG() != RESET)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1148 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1149 /* PWR PVM4 interrupt user callback */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1150 HAL_PWREx_PVM4Callback();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1151
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1152 /* Clear PVM4 exti pending bit */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1153 __HAL_PWR_PVM4_EXTI_CLEAR_FLAG();
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1154 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1155 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1156
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1157
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1158 #if defined(PWR_CR2_PVME1)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1159 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1160 * @brief PWR PVM1 interrupt callback
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1161 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1162 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1163 __weak void HAL_PWREx_PVM1Callback(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1164 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1165 /* NOTE : This function should not be modified; when the callback is needed,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1166 HAL_PWREx_PVM1Callback() API can be implemented in the user file
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1167 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1168 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1169 #endif /* PWR_CR2_PVME1 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1170
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1171 #if defined(PWR_CR2_PVME2)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1172 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1173 * @brief PWR PVM2 interrupt callback
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1174 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1175 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1176 __weak void HAL_PWREx_PVM2Callback(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1177 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1178 /* NOTE : This function should not be modified; when the callback is needed,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1179 HAL_PWREx_PVM2Callback() API can be implemented in the user file
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1180 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1181 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1182 #endif /* PWR_CR2_PVME2 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1183
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1184 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1185 * @brief PWR PVM3 interrupt callback
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1186 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1187 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1188 __weak void HAL_PWREx_PVM3Callback(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1189 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1190 /* NOTE : This function should not be modified; when the callback is needed,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1191 HAL_PWREx_PVM3Callback() API can be implemented in the user file
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1192 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1193 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1194
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1195 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1196 * @brief PWR PVM4 interrupt callback
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1197 * @retval None
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1198 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1199 __weak void HAL_PWREx_PVM4Callback(void)
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1200 {
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1201 /* NOTE : This function should not be modified; when the callback is needed,
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1202 HAL_PWREx_PVM4Callback() API can be implemented in the user file
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1203 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1204 }
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1205
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1206
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1207 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1208 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1209 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1210
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1211 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1212 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1213 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1214
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1215 #endif /* HAL_PWR_MODULE_ENABLED */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1216 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1217 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1218 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1219
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1220 /**
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1221 * @}
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1222 */
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1223
32a3b1785697 a rough draft of Hardware Abstraction Layer for C++
cin
parents:
diff changeset
1224 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/