mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
610:813dcc80987e
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

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