Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 ******************************************************************************
lypinator 0:bb348c97df44 3 * @file stm32f4xx_hal_pwr_ex.h
lypinator 0:bb348c97df44 4 * @author MCD Application Team
lypinator 0:bb348c97df44 5 * @brief Header file of PWR HAL Extension module.
lypinator 0:bb348c97df44 6 ******************************************************************************
lypinator 0:bb348c97df44 7 * @attention
lypinator 0:bb348c97df44 8 *
lypinator 0:bb348c97df44 9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
lypinator 0:bb348c97df44 10 *
lypinator 0:bb348c97df44 11 * Redistribution and use in source and binary forms, with or without modification,
lypinator 0:bb348c97df44 12 * are permitted provided that the following conditions are met:
lypinator 0:bb348c97df44 13 * 1. Redistributions of source code must retain the above copyright notice,
lypinator 0:bb348c97df44 14 * this list of conditions and the following disclaimer.
lypinator 0:bb348c97df44 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
lypinator 0:bb348c97df44 16 * this list of conditions and the following disclaimer in the documentation
lypinator 0:bb348c97df44 17 * and/or other materials provided with the distribution.
lypinator 0:bb348c97df44 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
lypinator 0:bb348c97df44 19 * may be used to endorse or promote products derived from this software
lypinator 0:bb348c97df44 20 * without specific prior written permission.
lypinator 0:bb348c97df44 21 *
lypinator 0:bb348c97df44 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
lypinator 0:bb348c97df44 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
lypinator 0:bb348c97df44 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
lypinator 0:bb348c97df44 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
lypinator 0:bb348c97df44 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
lypinator 0:bb348c97df44 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
lypinator 0:bb348c97df44 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
lypinator 0:bb348c97df44 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
lypinator 0:bb348c97df44 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
lypinator 0:bb348c97df44 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lypinator 0:bb348c97df44 32 *
lypinator 0:bb348c97df44 33 ******************************************************************************
lypinator 0:bb348c97df44 34 */
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 /* Define to prevent recursive inclusion -------------------------------------*/
lypinator 0:bb348c97df44 37 #ifndef __STM32F4xx_HAL_PWR_EX_H
lypinator 0:bb348c97df44 38 #define __STM32F4xx_HAL_PWR_EX_H
lypinator 0:bb348c97df44 39
lypinator 0:bb348c97df44 40 #ifdef __cplusplus
lypinator 0:bb348c97df44 41 extern "C" {
lypinator 0:bb348c97df44 42 #endif
lypinator 0:bb348c97df44 43
lypinator 0:bb348c97df44 44 /* Includes ------------------------------------------------------------------*/
lypinator 0:bb348c97df44 45 #include "stm32f4xx_hal_def.h"
lypinator 0:bb348c97df44 46
lypinator 0:bb348c97df44 47 /** @addtogroup STM32F4xx_HAL_Driver
lypinator 0:bb348c97df44 48 * @{
lypinator 0:bb348c97df44 49 */
lypinator 0:bb348c97df44 50
lypinator 0:bb348c97df44 51 /** @addtogroup PWREx
lypinator 0:bb348c97df44 52 * @{
lypinator 0:bb348c97df44 53 */
lypinator 0:bb348c97df44 54
lypinator 0:bb348c97df44 55 /* Exported types ------------------------------------------------------------*/
lypinator 0:bb348c97df44 56 /* Exported constants --------------------------------------------------------*/
lypinator 0:bb348c97df44 57 /** @defgroup PWREx_Exported_Constants PWREx Exported Constants
lypinator 0:bb348c97df44 58 * @{
lypinator 0:bb348c97df44 59 */
lypinator 0:bb348c97df44 60 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
lypinator 0:bb348c97df44 61 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
lypinator 0:bb348c97df44 62
lypinator 0:bb348c97df44 63 /** @defgroup PWREx_Regulator_state_in_UnderDrive_mode PWREx Regulator state in UnderDrive mode
lypinator 0:bb348c97df44 64 * @{
lypinator 0:bb348c97df44 65 */
lypinator 0:bb348c97df44 66 #define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
lypinator 0:bb348c97df44 67 #define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
lypinator 0:bb348c97df44 68 /**
lypinator 0:bb348c97df44 69 * @}
lypinator 0:bb348c97df44 70 */
lypinator 0:bb348c97df44 71
lypinator 0:bb348c97df44 72 /** @defgroup PWREx_Over_Under_Drive_Flag PWREx Over Under Drive Flag
lypinator 0:bb348c97df44 73 * @{
lypinator 0:bb348c97df44 74 */
lypinator 0:bb348c97df44 75 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
lypinator 0:bb348c97df44 76 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
lypinator 0:bb348c97df44 77 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
lypinator 0:bb348c97df44 78 /**
lypinator 0:bb348c97df44 79 * @}
lypinator 0:bb348c97df44 80 */
lypinator 0:bb348c97df44 81 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
lypinator 0:bb348c97df44 82
lypinator 0:bb348c97df44 83 /** @defgroup PWREx_Regulator_Voltage_Scale PWREx Regulator Voltage Scale
lypinator 0:bb348c97df44 84 * @{
lypinator 0:bb348c97df44 85 */
lypinator 0:bb348c97df44 86 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
lypinator 0:bb348c97df44 87 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK = 168 MHz. */
lypinator 0:bb348c97df44 88 #define PWR_REGULATOR_VOLTAGE_SCALE2 0x00000000U /* Scale 2 mode: the maximum value of fHCLK = 144 MHz. */
lypinator 0:bb348c97df44 89 #else
lypinator 0:bb348c97df44 90 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK is 168 MHz. It can be extended to
lypinator 0:bb348c97df44 91 180 MHz by activating the over-drive mode. */
lypinator 0:bb348c97df44 92 #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1 /* Scale 2 mode: the maximum value of fHCLK is 144 MHz. It can be extended to
lypinator 0:bb348c97df44 93 168 MHz by activating the over-drive mode. */
lypinator 0:bb348c97df44 94 #define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS_0 /* Scale 3 mode: the maximum value of fHCLK is 120 MHz. */
lypinator 0:bb348c97df44 95 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
lypinator 0:bb348c97df44 96 /**
lypinator 0:bb348c97df44 97 * @}
lypinator 0:bb348c97df44 98 */
lypinator 0:bb348c97df44 99 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
lypinator 0:bb348c97df44 100 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 101 /** @defgroup PWREx_WakeUp_Pins PWREx WakeUp Pins
lypinator 0:bb348c97df44 102 * @{
lypinator 0:bb348c97df44 103 */
lypinator 0:bb348c97df44 104 #define PWR_WAKEUP_PIN2 0x00000080U
lypinator 0:bb348c97df44 105 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
lypinator 0:bb348c97df44 106 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 107 #define PWR_WAKEUP_PIN3 0x00000040U
lypinator 0:bb348c97df44 108 #endif /* STM32F410xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Zx || STM32F412Vx || \
lypinator 0:bb348c97df44 109 STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
lypinator 0:bb348c97df44 110 /**
lypinator 0:bb348c97df44 111 * @}
lypinator 0:bb348c97df44 112 */
lypinator 0:bb348c97df44 113 #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx ||
lypinator 0:bb348c97df44 114 STM32F413xx || STM32F423xx */
lypinator 0:bb348c97df44 115
lypinator 0:bb348c97df44 116 /**
lypinator 0:bb348c97df44 117 * @}
lypinator 0:bb348c97df44 118 */
lypinator 0:bb348c97df44 119
lypinator 0:bb348c97df44 120 /* Exported macro ------------------------------------------------------------*/
lypinator 0:bb348c97df44 121 /** @defgroup PWREx_Exported_Constants PWREx Exported Constants
lypinator 0:bb348c97df44 122 * @{
lypinator 0:bb348c97df44 123 */
lypinator 0:bb348c97df44 124
lypinator 0:bb348c97df44 125 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
lypinator 0:bb348c97df44 126 /** @brief macros configure the main internal regulator output voltage.
lypinator 0:bb348c97df44 127 * @param __REGULATOR__ specifies the regulator output voltage to achieve
lypinator 0:bb348c97df44 128 * a tradeoff between performance and power consumption when the device does
lypinator 0:bb348c97df44 129 * not operate at the maximum frequency (refer to the datasheets for more details).
lypinator 0:bb348c97df44 130 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 131 * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode
lypinator 0:bb348c97df44 132 * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode
lypinator 0:bb348c97df44 133 * @retval None
lypinator 0:bb348c97df44 134 */
lypinator 0:bb348c97df44 135 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
lypinator 0:bb348c97df44 136 __IO uint32_t tmpreg = 0x00U; \
lypinator 0:bb348c97df44 137 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
lypinator 0:bb348c97df44 138 /* Delay after an RCC peripheral clock enabling */ \
lypinator 0:bb348c97df44 139 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
lypinator 0:bb348c97df44 140 UNUSED(tmpreg); \
lypinator 0:bb348c97df44 141 } while(0U)
lypinator 0:bb348c97df44 142 #else
lypinator 0:bb348c97df44 143 /** @brief macros configure the main internal regulator output voltage.
lypinator 0:bb348c97df44 144 * @param __REGULATOR__ specifies the regulator output voltage to achieve
lypinator 0:bb348c97df44 145 * a tradeoff between performance and power consumption when the device does
lypinator 0:bb348c97df44 146 * not operate at the maximum frequency (refer to the datasheets for more details).
lypinator 0:bb348c97df44 147 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 148 * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode
lypinator 0:bb348c97df44 149 * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode
lypinator 0:bb348c97df44 150 * @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output Scale 3 mode
lypinator 0:bb348c97df44 151 * @retval None
lypinator 0:bb348c97df44 152 */
lypinator 0:bb348c97df44 153 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
lypinator 0:bb348c97df44 154 __IO uint32_t tmpreg = 0x00U; \
lypinator 0:bb348c97df44 155 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
lypinator 0:bb348c97df44 156 /* Delay after an RCC peripheral clock enabling */ \
lypinator 0:bb348c97df44 157 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
lypinator 0:bb348c97df44 158 UNUSED(tmpreg); \
lypinator 0:bb348c97df44 159 } while(0U)
lypinator 0:bb348c97df44 160 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
lypinator 0:bb348c97df44 161
lypinator 0:bb348c97df44 162 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
lypinator 0:bb348c97df44 163 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
lypinator 0:bb348c97df44 164 /** @brief Macros to enable or disable the Over drive mode.
lypinator 0:bb348c97df44 165 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
lypinator 0:bb348c97df44 166 */
lypinator 0:bb348c97df44 167 #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
lypinator 0:bb348c97df44 168 #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
lypinator 0:bb348c97df44 169
lypinator 0:bb348c97df44 170 /** @brief Macros to enable or disable the Over drive switching.
lypinator 0:bb348c97df44 171 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
lypinator 0:bb348c97df44 172 */
lypinator 0:bb348c97df44 173 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
lypinator 0:bb348c97df44 174 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
lypinator 0:bb348c97df44 175
lypinator 0:bb348c97df44 176 /** @brief Macros to enable or disable the Under drive mode.
lypinator 0:bb348c97df44 177 * @note This mode is enabled only with STOP low power mode.
lypinator 0:bb348c97df44 178 * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
lypinator 0:bb348c97df44 179 * mode is only available when the main regulator or the low power regulator
lypinator 0:bb348c97df44 180 * is in low voltage mode.
lypinator 0:bb348c97df44 181 * @note If the Under-drive mode was enabled, it is automatically disabled after
lypinator 0:bb348c97df44 182 * exiting Stop mode.
lypinator 0:bb348c97df44 183 * When the voltage regulator operates in Under-drive mode, an additional
lypinator 0:bb348c97df44 184 * startup delay is induced when waking up from Stop mode.
lypinator 0:bb348c97df44 185 */
lypinator 0:bb348c97df44 186 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
lypinator 0:bb348c97df44 187 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
lypinator 0:bb348c97df44 188
lypinator 0:bb348c97df44 189 /** @brief Check PWR flag is set or not.
lypinator 0:bb348c97df44 190 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
lypinator 0:bb348c97df44 191 * @param __FLAG__ specifies the flag to check.
lypinator 0:bb348c97df44 192 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 193 * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode
lypinator 0:bb348c97df44 194 * is ready
lypinator 0:bb348c97df44 195 * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode
lypinator 0:bb348c97df44 196 * switching is ready
lypinator 0:bb348c97df44 197 * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode
lypinator 0:bb348c97df44 198 * is enabled in Stop mode
lypinator 0:bb348c97df44 199 * @retval The new state of __FLAG__ (TRUE or FALSE).
lypinator 0:bb348c97df44 200 */
lypinator 0:bb348c97df44 201 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
lypinator 0:bb348c97df44 202
lypinator 0:bb348c97df44 203 /** @brief Clear the Under-Drive Ready flag.
lypinator 0:bb348c97df44 204 * @note These macros can be used only for STM32F42xx/STM3243xx devices.
lypinator 0:bb348c97df44 205 */
lypinator 0:bb348c97df44 206 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
lypinator 0:bb348c97df44 207
lypinator 0:bb348c97df44 208 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
lypinator 0:bb348c97df44 209 /**
lypinator 0:bb348c97df44 210 * @}
lypinator 0:bb348c97df44 211 */
lypinator 0:bb348c97df44 212
lypinator 0:bb348c97df44 213 /* Exported functions --------------------------------------------------------*/
lypinator 0:bb348c97df44 214 /** @addtogroup PWREx_Exported_Functions PWREx Exported Functions
lypinator 0:bb348c97df44 215 * @{
lypinator 0:bb348c97df44 216 */
lypinator 0:bb348c97df44 217
lypinator 0:bb348c97df44 218 /** @addtogroup PWREx_Exported_Functions_Group1
lypinator 0:bb348c97df44 219 * @{
lypinator 0:bb348c97df44 220 */
lypinator 0:bb348c97df44 221 void HAL_PWREx_EnableFlashPowerDown(void);
lypinator 0:bb348c97df44 222 void HAL_PWREx_DisableFlashPowerDown(void);
lypinator 0:bb348c97df44 223 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
lypinator 0:bb348c97df44 224 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
lypinator 0:bb348c97df44 225 uint32_t HAL_PWREx_GetVoltageRange(void);
lypinator 0:bb348c97df44 226 HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling);
lypinator 0:bb348c97df44 227
lypinator 0:bb348c97df44 228 #if defined(STM32F469xx) || defined(STM32F479xx)
lypinator 0:bb348c97df44 229 void HAL_PWREx_EnableWakeUpPinPolarityRisingEdge(void);
lypinator 0:bb348c97df44 230 void HAL_PWREx_EnableWakeUpPinPolarityFallingEdge(void);
lypinator 0:bb348c97df44 231 #endif /* STM32F469xx || STM32F479xx */
lypinator 0:bb348c97df44 232
lypinator 0:bb348c97df44 233 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
lypinator 0:bb348c97df44 234 defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
lypinator 0:bb348c97df44 235 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
lypinator 0:bb348c97df44 236 void HAL_PWREx_EnableMainRegulatorLowVoltage(void);
lypinator 0:bb348c97df44 237 void HAL_PWREx_DisableMainRegulatorLowVoltage(void);
lypinator 0:bb348c97df44 238 void HAL_PWREx_EnableLowRegulatorLowVoltage(void);
lypinator 0:bb348c97df44 239 void HAL_PWREx_DisableLowRegulatorLowVoltage(void);
lypinator 0:bb348c97df44 240 #endif /* STM32F410xx || STM32F401xC || STM32F401xE || STM32F411xE || STM32F412Zx || STM32F412Vx ||\
lypinator 0:bb348c97df44 241 STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
lypinator 0:bb348c97df44 242
lypinator 0:bb348c97df44 243 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
lypinator 0:bb348c97df44 244 defined(STM32F469xx) || defined(STM32F479xx)
lypinator 0:bb348c97df44 245 HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void);
lypinator 0:bb348c97df44 246 HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void);
lypinator 0:bb348c97df44 247 HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
lypinator 0:bb348c97df44 248 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
lypinator 0:bb348c97df44 249
lypinator 0:bb348c97df44 250 /**
lypinator 0:bb348c97df44 251 * @}
lypinator 0:bb348c97df44 252 */
lypinator 0:bb348c97df44 253
lypinator 0:bb348c97df44 254 /**
lypinator 0:bb348c97df44 255 * @}
lypinator 0:bb348c97df44 256 */
lypinator 0:bb348c97df44 257 /* Private types -------------------------------------------------------------*/
lypinator 0:bb348c97df44 258 /* Private variables ---------------------------------------------------------*/
lypinator 0:bb348c97df44 259 /* Private constants ---------------------------------------------------------*/
lypinator 0:bb348c97df44 260 /** @defgroup PWREx_Private_Constants PWREx Private Constants
lypinator 0:bb348c97df44 261 * @{
lypinator 0:bb348c97df44 262 */
lypinator 0:bb348c97df44 263
lypinator 0:bb348c97df44 264 /** @defgroup PWREx_register_alias_address PWREx Register alias address
lypinator 0:bb348c97df44 265 * @{
lypinator 0:bb348c97df44 266 */
lypinator 0:bb348c97df44 267 /* ------------- PWR registers bit address in the alias region ---------------*/
lypinator 0:bb348c97df44 268 /* --- CR Register ---*/
lypinator 0:bb348c97df44 269 /* Alias word address of FPDS bit */
lypinator 0:bb348c97df44 270 #define FPDS_BIT_NUMBER PWR_CR_FPDS_Pos
lypinator 0:bb348c97df44 271 #define CR_FPDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (FPDS_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 272
lypinator 0:bb348c97df44 273 /* Alias word address of ODEN bit */
lypinator 0:bb348c97df44 274 #define ODEN_BIT_NUMBER PWR_CR_ODEN_Pos
lypinator 0:bb348c97df44 275 #define CR_ODEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODEN_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 276
lypinator 0:bb348c97df44 277 /* Alias word address of ODSWEN bit */
lypinator 0:bb348c97df44 278 #define ODSWEN_BIT_NUMBER PWR_CR_ODSWEN_Pos
lypinator 0:bb348c97df44 279 #define CR_ODSWEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODSWEN_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 280
lypinator 0:bb348c97df44 281 /* Alias word address of MRLVDS bit */
lypinator 0:bb348c97df44 282 #define MRLVDS_BIT_NUMBER PWR_CR_MRLVDS_Pos
lypinator 0:bb348c97df44 283 #define CR_MRLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (MRLVDS_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 284
lypinator 0:bb348c97df44 285 /* Alias word address of LPLVDS bit */
lypinator 0:bb348c97df44 286 #define LPLVDS_BIT_NUMBER PWR_CR_LPLVDS_Pos
lypinator 0:bb348c97df44 287 #define CR_LPLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPLVDS_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 288
lypinator 0:bb348c97df44 289 /**
lypinator 0:bb348c97df44 290 * @}
lypinator 0:bb348c97df44 291 */
lypinator 0:bb348c97df44 292
lypinator 0:bb348c97df44 293 /** @defgroup PWREx_CSR_register_alias PWRx CSR Register alias address
lypinator 0:bb348c97df44 294 * @{
lypinator 0:bb348c97df44 295 */
lypinator 0:bb348c97df44 296 /* --- CSR Register ---*/
lypinator 0:bb348c97df44 297 /* Alias word address of BRE bit */
lypinator 0:bb348c97df44 298 #define BRE_BIT_NUMBER PWR_CSR_BRE_Pos
lypinator 0:bb348c97df44 299 #define CSR_BRE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (BRE_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 300
lypinator 0:bb348c97df44 301 #if defined(STM32F469xx) || defined(STM32F479xx)
lypinator 0:bb348c97df44 302 /* Alias word address of WUPP bit */
lypinator 0:bb348c97df44 303 #define WUPP_BIT_NUMBER PWR_CSR_WUPP_Pos
lypinator 0:bb348c97df44 304 #define CSR_WUPP_BB (PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (WUPP_BIT_NUMBER * 4U))
lypinator 0:bb348c97df44 305 #endif /* STM32F469xx || STM32F479xx */
lypinator 0:bb348c97df44 306 /**
lypinator 0:bb348c97df44 307 * @}
lypinator 0:bb348c97df44 308 */
lypinator 0:bb348c97df44 309
lypinator 0:bb348c97df44 310 /**
lypinator 0:bb348c97df44 311 * @}
lypinator 0:bb348c97df44 312 */
lypinator 0:bb348c97df44 313
lypinator 0:bb348c97df44 314 /* Private macros ------------------------------------------------------------*/
lypinator 0:bb348c97df44 315 /** @defgroup PWREx_Private_Macros PWREx Private Macros
lypinator 0:bb348c97df44 316 * @{
lypinator 0:bb348c97df44 317 */
lypinator 0:bb348c97df44 318
lypinator 0:bb348c97df44 319 /** @defgroup PWREx_IS_PWR_Definitions PWREx Private macros to check input parameters
lypinator 0:bb348c97df44 320 * @{
lypinator 0:bb348c97df44 321 */
lypinator 0:bb348c97df44 322 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
lypinator 0:bb348c97df44 323 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
lypinator 0:bb348c97df44 324 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
lypinator 0:bb348c97df44 325 ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
lypinator 0:bb348c97df44 326 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
lypinator 0:bb348c97df44 327
lypinator 0:bb348c97df44 328 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
lypinator 0:bb348c97df44 329 #define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
lypinator 0:bb348c97df44 330 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
lypinator 0:bb348c97df44 331 #else
lypinator 0:bb348c97df44 332 #define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
lypinator 0:bb348c97df44 333 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
lypinator 0:bb348c97df44 334 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
lypinator 0:bb348c97df44 335 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
lypinator 0:bb348c97df44 336
lypinator 0:bb348c97df44 337 #if defined(STM32F446xx)
lypinator 0:bb348c97df44 338 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2))
lypinator 0:bb348c97df44 339 #elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\
lypinator 0:bb348c97df44 340 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
lypinator 0:bb348c97df44 341 defined(STM32F423xx)
lypinator 0:bb348c97df44 342 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \
lypinator 0:bb348c97df44 343 ((PIN) == PWR_WAKEUP_PIN3))
lypinator 0:bb348c97df44 344 #else
lypinator 0:bb348c97df44 345 #define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1)
lypinator 0:bb348c97df44 346 #endif /* STM32F446xx */
lypinator 0:bb348c97df44 347 /**
lypinator 0:bb348c97df44 348 * @}
lypinator 0:bb348c97df44 349 */
lypinator 0:bb348c97df44 350
lypinator 0:bb348c97df44 351 /**
lypinator 0:bb348c97df44 352 * @}
lypinator 0:bb348c97df44 353 */
lypinator 0:bb348c97df44 354
lypinator 0:bb348c97df44 355 /**
lypinator 0:bb348c97df44 356 * @}
lypinator 0:bb348c97df44 357 */
lypinator 0:bb348c97df44 358
lypinator 0:bb348c97df44 359 /**
lypinator 0:bb348c97df44 360 * @}
lypinator 0:bb348c97df44 361 */
lypinator 0:bb348c97df44 362
lypinator 0:bb348c97df44 363 #ifdef __cplusplus
lypinator 0:bb348c97df44 364 }
lypinator 0:bb348c97df44 365 #endif
lypinator 0:bb348c97df44 366
lypinator 0:bb348c97df44 367
lypinator 0:bb348c97df44 368 #endif /* __STM32F4xx_HAL_PWR_EX_H */
lypinator 0:bb348c97df44 369
lypinator 0:bb348c97df44 370 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/