Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
Release 107  of the mbed library

Changes:
- new platforms - DISCO_F746NG, DISCO_L476VG, NUCLEO_L476RG
- KL43Z - bugfix RTC init function
- K20 - SPI mode fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 107:4f6c30876dfa 1 /**
Kojto 107:4f6c30876dfa 2 ******************************************************************************
Kojto 107:4f6c30876dfa 3 * @file stm32l4xx_hal_pwr.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.0
Kojto 107:4f6c30876dfa 6 * @date 26-June-2015
Kojto 107:4f6c30876dfa 7 * @brief Header file of PWR HAL module.
Kojto 107:4f6c30876dfa 8 ******************************************************************************
Kojto 107:4f6c30876dfa 9 * @attention
Kojto 107:4f6c30876dfa 10 *
Kojto 107:4f6c30876dfa 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 107:4f6c30876dfa 12 *
Kojto 107:4f6c30876dfa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 107:4f6c30876dfa 14 * are permitted provided that the following conditions are met:
Kojto 107:4f6c30876dfa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 107:4f6c30876dfa 16 * this list of conditions and the following disclaimer.
Kojto 107:4f6c30876dfa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 107:4f6c30876dfa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 107:4f6c30876dfa 19 * and/or other materials provided with the distribution.
Kojto 107:4f6c30876dfa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 107:4f6c30876dfa 21 * may be used to endorse or promote products derived from this software
Kojto 107:4f6c30876dfa 22 * without specific prior written permission.
Kojto 107:4f6c30876dfa 23 *
Kojto 107:4f6c30876dfa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 107:4f6c30876dfa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 107:4f6c30876dfa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 107:4f6c30876dfa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 107:4f6c30876dfa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 107:4f6c30876dfa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 107:4f6c30876dfa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 107:4f6c30876dfa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 107:4f6c30876dfa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 107:4f6c30876dfa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 107:4f6c30876dfa 34 *
Kojto 107:4f6c30876dfa 35 ******************************************************************************
Kojto 107:4f6c30876dfa 36 */
Kojto 107:4f6c30876dfa 37
Kojto 107:4f6c30876dfa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 107:4f6c30876dfa 39 #ifndef __STM32L4xx_HAL_PWR_H
Kojto 107:4f6c30876dfa 40 #define __STM32L4xx_HAL_PWR_H
Kojto 107:4f6c30876dfa 41
Kojto 107:4f6c30876dfa 42 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 43 extern "C" {
Kojto 107:4f6c30876dfa 44 #endif
Kojto 107:4f6c30876dfa 45
Kojto 107:4f6c30876dfa 46 /* Includes ------------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 47 #include "stm32l4xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32L4xx_HAL_Driver
Kojto 107:4f6c30876dfa 50 * @{
Kojto 107:4f6c30876dfa 51 */
Kojto 107:4f6c30876dfa 52
Kojto 107:4f6c30876dfa 53 /** @addtogroup PWR
Kojto 107:4f6c30876dfa 54 * @{
Kojto 107:4f6c30876dfa 55 */
Kojto 107:4f6c30876dfa 56
Kojto 107:4f6c30876dfa 57 /* Exported types ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 58
Kojto 107:4f6c30876dfa 59 /** @defgroup PWR_Exported_Types PWR Exported Types
Kojto 107:4f6c30876dfa 60 * @{
Kojto 107:4f6c30876dfa 61 */
Kojto 107:4f6c30876dfa 62
Kojto 107:4f6c30876dfa 63 /**
Kojto 107:4f6c30876dfa 64 * @brief PWR PVD configuration structure definition
Kojto 107:4f6c30876dfa 65 */
Kojto 107:4f6c30876dfa 66 typedef struct
Kojto 107:4f6c30876dfa 67 {
Kojto 107:4f6c30876dfa 68 uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level.
Kojto 107:4f6c30876dfa 69 This parameter can be a value of @ref PWR_PVD_detection_level. */
Kojto 107:4f6c30876dfa 70
Kojto 107:4f6c30876dfa 71 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins.
Kojto 107:4f6c30876dfa 72 This parameter can be a value of @ref PWR_PVD_Mode. */
Kojto 107:4f6c30876dfa 73 }PWR_PVDTypeDef;
Kojto 107:4f6c30876dfa 74
Kojto 107:4f6c30876dfa 75
Kojto 107:4f6c30876dfa 76 /**
Kojto 107:4f6c30876dfa 77 * @}
Kojto 107:4f6c30876dfa 78 */
Kojto 107:4f6c30876dfa 79
Kojto 107:4f6c30876dfa 80 /* Exported constants --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 81
Kojto 107:4f6c30876dfa 82 /** @defgroup PWR_Exported_Constants PWR Exported Constants
Kojto 107:4f6c30876dfa 83 * @{
Kojto 107:4f6c30876dfa 84 */
Kojto 107:4f6c30876dfa 85
Kojto 107:4f6c30876dfa 86
Kojto 107:4f6c30876dfa 87 /** @defgroup PWR_PVD_detection_level Programmable Voltage Detection levels
Kojto 107:4f6c30876dfa 88 * @{
Kojto 107:4f6c30876dfa 89 */
Kojto 107:4f6c30876dfa 90 #define PWR_PVDLEVEL_0 PWR_CR2_PLS_LEV0 /*!< PVD threshold around 2.0 V */
Kojto 107:4f6c30876dfa 91 #define PWR_PVDLEVEL_1 PWR_CR2_PLS_LEV1 /*!< PVD threshold around 2.2 V */
Kojto 107:4f6c30876dfa 92 #define PWR_PVDLEVEL_2 PWR_CR2_PLS_LEV2 /*!< PVD threshold around 2.4 V */
Kojto 107:4f6c30876dfa 93 #define PWR_PVDLEVEL_3 PWR_CR2_PLS_LEV3 /*!< PVD threshold around 2.5 V */
Kojto 107:4f6c30876dfa 94 #define PWR_PVDLEVEL_4 PWR_CR2_PLS_LEV4 /*!< PVD threshold around 2.6 V */
Kojto 107:4f6c30876dfa 95 #define PWR_PVDLEVEL_5 PWR_CR2_PLS_LEV5 /*!< PVD threshold around 2.8 V */
Kojto 107:4f6c30876dfa 96 #define PWR_PVDLEVEL_6 PWR_CR2_PLS_LEV6 /*!< PVD threshold around 2.9 V */
Kojto 107:4f6c30876dfa 97 #define PWR_PVDLEVEL_7 PWR_CR2_PLS_LEV7 /*!< External input analog voltage (compared internally to VREFINT) */
Kojto 107:4f6c30876dfa 98 /**
Kojto 107:4f6c30876dfa 99 * @}
Kojto 107:4f6c30876dfa 100 */
Kojto 107:4f6c30876dfa 101
Kojto 107:4f6c30876dfa 102 /** @defgroup PWR_PVD_Mode PWR PVD interrupt and event mode
Kojto 107:4f6c30876dfa 103 * @{
Kojto 107:4f6c30876dfa 104 */
Kojto 107:4f6c30876dfa 105 #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000) /*!< basic mode is used */
Kojto 107:4f6c30876dfa 106 #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001) /*!< External Interrupt Mode with Rising edge trigger detection */
Kojto 107:4f6c30876dfa 107 #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002) /*!< External Interrupt Mode with Falling edge trigger detection */
Kojto 107:4f6c30876dfa 108 #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
Kojto 107:4f6c30876dfa 109 #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001) /*!< Event Mode with Rising edge trigger detection */
Kojto 107:4f6c30876dfa 110 #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002) /*!< Event Mode with Falling edge trigger detection */
Kojto 107:4f6c30876dfa 111 #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003) /*!< Event Mode with Rising/Falling edge trigger detection */
Kojto 107:4f6c30876dfa 112 /**
Kojto 107:4f6c30876dfa 113 * @}
Kojto 107:4f6c30876dfa 114 */
Kojto 107:4f6c30876dfa 115
Kojto 107:4f6c30876dfa 116
Kojto 107:4f6c30876dfa 117
Kojto 107:4f6c30876dfa 118
Kojto 107:4f6c30876dfa 119 /** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode PWR regulator mode
Kojto 107:4f6c30876dfa 120 * @{
Kojto 107:4f6c30876dfa 121 */
Kojto 107:4f6c30876dfa 122 #define PWR_MAINREGULATOR_ON ((uint32_t)0x00000000) /*!< Regulator in main mode */
Kojto 107:4f6c30876dfa 123 #define PWR_LOWPOWERREGULATOR_ON PWR_CR1_LPR /*!< Regulator in low-power mode */
Kojto 107:4f6c30876dfa 124 /**
Kojto 107:4f6c30876dfa 125 * @}
Kojto 107:4f6c30876dfa 126 */
Kojto 107:4f6c30876dfa 127
Kojto 107:4f6c30876dfa 128 /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
Kojto 107:4f6c30876dfa 129 * @{
Kojto 107:4f6c30876dfa 130 */
Kojto 107:4f6c30876dfa 131 #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01) /*!< Wait For Interruption instruction to enter Sleep mode */
Kojto 107:4f6c30876dfa 132 #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02) /*!< Wait For Event instruction to enter Sleep mode */
Kojto 107:4f6c30876dfa 133 /**
Kojto 107:4f6c30876dfa 134 * @}
Kojto 107:4f6c30876dfa 135 */
Kojto 107:4f6c30876dfa 136
Kojto 107:4f6c30876dfa 137 /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
Kojto 107:4f6c30876dfa 138 * @{
Kojto 107:4f6c30876dfa 139 */
Kojto 107:4f6c30876dfa 140 #define PWR_STOPENTRY_WFI ((uint8_t)0x01) /*!< Wait For Interruption instruction to enter Stop mode */
Kojto 107:4f6c30876dfa 141 #define PWR_STOPENTRY_WFE ((uint8_t)0x02) /*!< Wait For Event instruction to enter Stop mode */
Kojto 107:4f6c30876dfa 142 /**
Kojto 107:4f6c30876dfa 143 * @}
Kojto 107:4f6c30876dfa 144 */
Kojto 107:4f6c30876dfa 145
Kojto 107:4f6c30876dfa 146
Kojto 107:4f6c30876dfa 147 /** @defgroup PWR_PVD_EXTI_LINE PWR PVD external interrupt line
Kojto 107:4f6c30876dfa 148 * @{
Kojto 107:4f6c30876dfa 149 */
Kojto 107:4f6c30876dfa 150 #define PWR_EXTI_LINE_PVD ((uint32_t)0x00010000) /*!< External interrupt line 16 Connected to the PVD EXTI Line */
Kojto 107:4f6c30876dfa 151 /**
Kojto 107:4f6c30876dfa 152 * @}
Kojto 107:4f6c30876dfa 153 */
Kojto 107:4f6c30876dfa 154
Kojto 107:4f6c30876dfa 155 /** @defgroup PWR_PVD_EVENT_LINE PWR PVD event line
Kojto 107:4f6c30876dfa 156 * @{
Kojto 107:4f6c30876dfa 157 */
Kojto 107:4f6c30876dfa 158 #define PWR_EVENT_LINE_PVD ((uint32_t)0x00010000) /*!< Event line 16 Connected to the PVD Event Line */
Kojto 107:4f6c30876dfa 159 /**
Kojto 107:4f6c30876dfa 160 * @}
Kojto 107:4f6c30876dfa 161 */
Kojto 107:4f6c30876dfa 162
Kojto 107:4f6c30876dfa 163 /**
Kojto 107:4f6c30876dfa 164 * @}
Kojto 107:4f6c30876dfa 165 */
Kojto 107:4f6c30876dfa 166
Kojto 107:4f6c30876dfa 167 /* Exported macros -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 168 /** @defgroup PWR_Exported_Macros PWR Exported Macros
Kojto 107:4f6c30876dfa 169 * @{
Kojto 107:4f6c30876dfa 170 */
Kojto 107:4f6c30876dfa 171
Kojto 107:4f6c30876dfa 172 /** @brief Check whether or not a specific PWR flag is set.
Kojto 107:4f6c30876dfa 173 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 174 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 175 * @arg PWR_FLAG_WUF1: Wake Up Flag 1. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 176 * was received from the WKUP pin 1.
Kojto 107:4f6c30876dfa 177 * @arg PWR_FLAG_WUF2: Wake Up Flag 2. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 178 * was received from the WKUP pin 2.
Kojto 107:4f6c30876dfa 179 * @arg PWR_FLAG_WUF3: Wake Up Flag 3. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 180 * was received from the WKUP pin 3.
Kojto 107:4f6c30876dfa 181 * @arg PWR_FLAG_WUF4: Wake Up Flag 4. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 182 * was received from the WKUP pin 4.
Kojto 107:4f6c30876dfa 183 * @arg PWR_FLAG_WUF5: Wake Up Flag 5. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 184 * was received from the WKUP pin 5.
Kojto 107:4f6c30876dfa 185 * @arg PWR_FLAG_SB: StandBy Flag. Indicates that the system
Kojto 107:4f6c30876dfa 186 * entered StandBy mode.
Kojto 107:4f6c30876dfa 187 * @arg PWR_FLAG_WUFI: Wake-Up Flag Internal. Set when a wakeup is detected on
Kojto 107:4f6c30876dfa 188 * the internal wakeup line.
Kojto 107:4f6c30876dfa 189 * @arg PWR_FLAG_REGLPS: Low Power Regulator Started. Indicates whether or not the
Kojto 107:4f6c30876dfa 190 * low-power regulator is ready.
Kojto 107:4f6c30876dfa 191 * @arg PWR_FLAG_REGLPF: Low Power Regulator Flag. Indicates whether the
Kojto 107:4f6c30876dfa 192 * regulator is ready in main mode or is in low-power mode.
Kojto 107:4f6c30876dfa 193 * @arg PWR_FLAG_VOSF: Voltage Scaling Flag. Indicates whether the regulator is ready
Kojto 107:4f6c30876dfa 194 * in the selected voltage range or is still changing to the required voltage level.
Kojto 107:4f6c30876dfa 195 * @arg PWR_FLAG_PVDO: Power Voltage Detector Output. Indicates whether VDD voltage is
Kojto 107:4f6c30876dfa 196 * below or above the selected PVD threshold.
Kojto 107:4f6c30876dfa 197 * @arg PWR_FLAG_PVMO1: Peripheral Voltage Monitoring Output 1. Indicates whether VDDUSB voltage is
Kojto 107:4f6c30876dfa 198 * is below or above PVM1 threshold (applicable when USB feature is supported).
Kojto 107:4f6c30876dfa 199 * @arg PWR_FLAG_PVMO2: Peripheral Voltage Monitoring Output 2. Indicates whether VDDIO2 voltage is
Kojto 107:4f6c30876dfa 200 * is below or above PVM2 threshold (applicable when VDDIO2 is present on device).
Kojto 107:4f6c30876dfa 201 * @arg PWR_FLAG_PVMO3: Peripheral Voltage Monitoring Output 3. Indicates whether VDDA voltage is
Kojto 107:4f6c30876dfa 202 * is below or above PVM3 threshold.
Kojto 107:4f6c30876dfa 203 * @arg PWR_FLAG_PVMO4: Peripheral Voltage Monitoring Output 4. Indicates whether VDDA voltage is
Kojto 107:4f6c30876dfa 204 * is below or above PVM4 threshold.
Kojto 107:4f6c30876dfa 205 *
Kojto 107:4f6c30876dfa 206 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 207 */
Kojto 107:4f6c30876dfa 208 #define __HAL_PWR_GET_FLAG(__FLAG__) ( ((((uint8_t)(__FLAG__)) >> 5U) == 1) ?\
Kojto 107:4f6c30876dfa 209 (PWR->SR1 & (1U << ((__FLAG__) & 31U))) :\
Kojto 107:4f6c30876dfa 210 (PWR->SR2 & (1U << ((__FLAG__) & 31U))) )
Kojto 107:4f6c30876dfa 211
Kojto 107:4f6c30876dfa 212 /** @brief Clear a specific PWR flag.
Kojto 107:4f6c30876dfa 213 * @param __FLAG__: specifies the flag to clear.
Kojto 107:4f6c30876dfa 214 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 215 * @arg PWR_FLAG_WUF1: Wake Up Flag 1. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 216 * was received from the WKUP pin 1.
Kojto 107:4f6c30876dfa 217 * @arg PWR_FLAG_WUF2: Wake Up Flag 2. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 218 * was received from the WKUP pin 2.
Kojto 107:4f6c30876dfa 219 * @arg PWR_FLAG_WUF3: Wake Up Flag 3. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 220 * was received from the WKUP pin 3.
Kojto 107:4f6c30876dfa 221 * @arg PWR_FLAG_WUF4: Wake Up Flag 4. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 222 * was received from the WKUP pin 4.
Kojto 107:4f6c30876dfa 223 * @arg PWR_FLAG_WUF5: Wake Up Flag 5. Indicates that a wakeup event
Kojto 107:4f6c30876dfa 224 * was received from the WKUP pin 5.
Kojto 107:4f6c30876dfa 225 * @arg PWR_FLAG_WU: Encompasses all five Wake Up Flags.
Kojto 107:4f6c30876dfa 226 * @arg PWR_FLAG_SB: Standby Flag. Indicates that the system
Kojto 107:4f6c30876dfa 227 * entered Standby mode.
Kojto 107:4f6c30876dfa 228 * @retval None
Kojto 107:4f6c30876dfa 229 */
Kojto 107:4f6c30876dfa 230 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) ( (((uint8_t)(__FLAG__)) == PWR_FLAG_WU) ?\
Kojto 107:4f6c30876dfa 231 (PWR->SCR = (__FLAG__)) :\
Kojto 107:4f6c30876dfa 232 (PWR->SCR = (1U << ((__FLAG__) & 31U))) )
Kojto 107:4f6c30876dfa 233 /**
Kojto 107:4f6c30876dfa 234 * @brief Enable the PVD Extended Interrupt Line.
Kojto 107:4f6c30876dfa 235 * @retval None
Kojto 107:4f6c30876dfa 236 */
Kojto 107:4f6c30876dfa 237 #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 238
Kojto 107:4f6c30876dfa 239 /**
Kojto 107:4f6c30876dfa 240 * @brief Disable the PVD Extended Interrupt Line.
Kojto 107:4f6c30876dfa 241 * @retval None
Kojto 107:4f6c30876dfa 242 */
Kojto 107:4f6c30876dfa 243 #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 244
Kojto 107:4f6c30876dfa 245 /**
Kojto 107:4f6c30876dfa 246 * @brief Enable the PVD Event Line.
Kojto 107:4f6c30876dfa 247 * @retval None
Kojto 107:4f6c30876dfa 248 */
Kojto 107:4f6c30876dfa 249 #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EVENT_LINE_PVD)
Kojto 107:4f6c30876dfa 250
Kojto 107:4f6c30876dfa 251 /**
Kojto 107:4f6c30876dfa 252 * @brief Disable the PVD Event Line.
Kojto 107:4f6c30876dfa 253 * @retval None
Kojto 107:4f6c30876dfa 254 */
Kojto 107:4f6c30876dfa 255 #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EVENT_LINE_PVD)
Kojto 107:4f6c30876dfa 256
Kojto 107:4f6c30876dfa 257 /**
Kojto 107:4f6c30876dfa 258 * @brief Enable the PVD Extended Interrupt Rising Trigger.
Kojto 107:4f6c30876dfa 259 * @retval None
Kojto 107:4f6c30876dfa 260 */
Kojto 107:4f6c30876dfa 261 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 262
Kojto 107:4f6c30876dfa 263 /**
Kojto 107:4f6c30876dfa 264 * @brief Disable the PVD Extended Interrupt Rising Trigger.
Kojto 107:4f6c30876dfa 265 * @retval None
Kojto 107:4f6c30876dfa 266 */
Kojto 107:4f6c30876dfa 267 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 268
Kojto 107:4f6c30876dfa 269 /**
Kojto 107:4f6c30876dfa 270 * @brief Enable the PVD Extended Interrupt Falling Trigger.
Kojto 107:4f6c30876dfa 271 * @retval None
Kojto 107:4f6c30876dfa 272 */
Kojto 107:4f6c30876dfa 273 #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 274
Kojto 107:4f6c30876dfa 275
Kojto 107:4f6c30876dfa 276 /**
Kojto 107:4f6c30876dfa 277 * @brief Disable the PVD Extended Interrupt Falling Trigger.
Kojto 107:4f6c30876dfa 278 * @retval None
Kojto 107:4f6c30876dfa 279 */
Kojto 107:4f6c30876dfa 280 #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 281
Kojto 107:4f6c30876dfa 282
Kojto 107:4f6c30876dfa 283 /**
Kojto 107:4f6c30876dfa 284 * @brief Enable the PVD Extended Interrupt Rising & Falling Trigger.
Kojto 107:4f6c30876dfa 285 * @retval None
Kojto 107:4f6c30876dfa 286 */
Kojto 107:4f6c30876dfa 287 #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() \
Kojto 107:4f6c30876dfa 288 do { \
Kojto 107:4f6c30876dfa 289 __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE(); \
Kojto 107:4f6c30876dfa 290 __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); \
Kojto 107:4f6c30876dfa 291 } while(0)
Kojto 107:4f6c30876dfa 292
Kojto 107:4f6c30876dfa 293 /**
Kojto 107:4f6c30876dfa 294 * @brief Disable the PVD Extended Interrupt Rising & Falling Trigger.
Kojto 107:4f6c30876dfa 295 * @retval None
Kojto 107:4f6c30876dfa 296 */
Kojto 107:4f6c30876dfa 297 #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() \
Kojto 107:4f6c30876dfa 298 do { \
Kojto 107:4f6c30876dfa 299 __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE(); \
Kojto 107:4f6c30876dfa 300 __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); \
Kojto 107:4f6c30876dfa 301 } while(0)
Kojto 107:4f6c30876dfa 302
Kojto 107:4f6c30876dfa 303 /**
Kojto 107:4f6c30876dfa 304 * @brief Generate a Software interrupt on selected EXTI line.
Kojto 107:4f6c30876dfa 305 * @retval None
Kojto 107:4f6c30876dfa 306 */
Kojto 107:4f6c30876dfa 307 #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 308
Kojto 107:4f6c30876dfa 309 /**
Kojto 107:4f6c30876dfa 310 * @brief Check whether or not the PVD EXTI interrupt flag is set.
Kojto 107:4f6c30876dfa 311 * @retval EXTI PVD Line Status.
Kojto 107:4f6c30876dfa 312 */
Kojto 107:4f6c30876dfa 313 #define __HAL_PWR_PVD_EXTI_GET_FLAG() (EXTI->PR1 & PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 314
Kojto 107:4f6c30876dfa 315 /**
Kojto 107:4f6c30876dfa 316 * @brief Clear the PVD EXTI interrupt flag.
Kojto 107:4f6c30876dfa 317 * @retval None
Kojto 107:4f6c30876dfa 318 */
Kojto 107:4f6c30876dfa 319 #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, PWR_EXTI_LINE_PVD)
Kojto 107:4f6c30876dfa 320
Kojto 107:4f6c30876dfa 321 /**
Kojto 107:4f6c30876dfa 322 * @}
Kojto 107:4f6c30876dfa 323 */
Kojto 107:4f6c30876dfa 324
Kojto 107:4f6c30876dfa 325
Kojto 107:4f6c30876dfa 326 /* Private macros --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 327 /** @addtogroup PWR_Private_Macros PWR Private Macros
Kojto 107:4f6c30876dfa 328 * @{
Kojto 107:4f6c30876dfa 329 */
Kojto 107:4f6c30876dfa 330
Kojto 107:4f6c30876dfa 331 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) || ((LEVEL) == PWR_PVDLEVEL_1)|| \
Kojto 107:4f6c30876dfa 332 ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \
Kojto 107:4f6c30876dfa 333 ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \
Kojto 107:4f6c30876dfa 334 ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7))
Kojto 107:4f6c30876dfa 335
Kojto 107:4f6c30876dfa 336 #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_NORMAL) ||\
Kojto 107:4f6c30876dfa 337 ((MODE) == PWR_PVD_MODE_IT_RISING) ||\
Kojto 107:4f6c30876dfa 338 ((MODE) == PWR_PVD_MODE_IT_FALLING) ||\
Kojto 107:4f6c30876dfa 339 ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) ||\
Kojto 107:4f6c30876dfa 340 ((MODE) == PWR_PVD_MODE_EVENT_RISING) ||\
Kojto 107:4f6c30876dfa 341 ((MODE) == PWR_PVD_MODE_EVENT_FALLING) ||\
Kojto 107:4f6c30876dfa 342 ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING))
Kojto 107:4f6c30876dfa 343
Kojto 107:4f6c30876dfa 344 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
Kojto 107:4f6c30876dfa 345 ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
Kojto 107:4f6c30876dfa 346
Kojto 107:4f6c30876dfa 347 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
Kojto 107:4f6c30876dfa 348
Kojto 107:4f6c30876dfa 349 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE) )
Kojto 107:4f6c30876dfa 350
Kojto 107:4f6c30876dfa 351 /**
Kojto 107:4f6c30876dfa 352 * @}
Kojto 107:4f6c30876dfa 353 */
Kojto 107:4f6c30876dfa 354
Kojto 107:4f6c30876dfa 355 /* Include PWR HAL Extended module */
Kojto 107:4f6c30876dfa 356 #include "stm32l4xx_hal_pwr_ex.h"
Kojto 107:4f6c30876dfa 357
Kojto 107:4f6c30876dfa 358 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 359
Kojto 107:4f6c30876dfa 360 /** @addtogroup PWR_Exported_Functions PWR Exported Functions
Kojto 107:4f6c30876dfa 361 * @{
Kojto 107:4f6c30876dfa 362 */
Kojto 107:4f6c30876dfa 363
Kojto 107:4f6c30876dfa 364 /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 107:4f6c30876dfa 365 * @{
Kojto 107:4f6c30876dfa 366 */
Kojto 107:4f6c30876dfa 367
Kojto 107:4f6c30876dfa 368 /* Initialization and de-initialization functions *******************************/
Kojto 107:4f6c30876dfa 369 void HAL_PWR_DeInit(void);
Kojto 107:4f6c30876dfa 370 void HAL_PWR_EnableBkUpAccess(void);
Kojto 107:4f6c30876dfa 371 void HAL_PWR_DisableBkUpAccess(void);
Kojto 107:4f6c30876dfa 372
Kojto 107:4f6c30876dfa 373 /**
Kojto 107:4f6c30876dfa 374 * @}
Kojto 107:4f6c30876dfa 375 */
Kojto 107:4f6c30876dfa 376
Kojto 107:4f6c30876dfa 377 /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
Kojto 107:4f6c30876dfa 378 * @{
Kojto 107:4f6c30876dfa 379 */
Kojto 107:4f6c30876dfa 380
Kojto 107:4f6c30876dfa 381 /* Peripheral Control functions ************************************************/
Kojto 107:4f6c30876dfa 382 HAL_StatusTypeDef HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD);
Kojto 107:4f6c30876dfa 383 void HAL_PWR_EnablePVD(void);
Kojto 107:4f6c30876dfa 384 void HAL_PWR_DisablePVD(void);
Kojto 107:4f6c30876dfa 385
Kojto 107:4f6c30876dfa 386
Kojto 107:4f6c30876dfa 387 /* WakeUp pins configuration functions ****************************************/
Kojto 107:4f6c30876dfa 388 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity);
Kojto 107:4f6c30876dfa 389 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
Kojto 107:4f6c30876dfa 390
Kojto 107:4f6c30876dfa 391 /* Low Power modes configuration functions ************************************/
Kojto 107:4f6c30876dfa 392 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
Kojto 107:4f6c30876dfa 393 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
Kojto 107:4f6c30876dfa 394 void HAL_PWR_EnterSTANDBYMode(void);
Kojto 107:4f6c30876dfa 395
Kojto 107:4f6c30876dfa 396 void HAL_PWR_EnableSleepOnExit(void);
Kojto 107:4f6c30876dfa 397 void HAL_PWR_DisableSleepOnExit(void);
Kojto 107:4f6c30876dfa 398 void HAL_PWR_EnableSEVOnPend(void);
Kojto 107:4f6c30876dfa 399 void HAL_PWR_DisableSEVOnPend(void);
Kojto 107:4f6c30876dfa 400
Kojto 107:4f6c30876dfa 401 void HAL_PWR_PVDCallback(void);
Kojto 107:4f6c30876dfa 402
Kojto 107:4f6c30876dfa 403
Kojto 107:4f6c30876dfa 404 /**
Kojto 107:4f6c30876dfa 405 * @}
Kojto 107:4f6c30876dfa 406 */
Kojto 107:4f6c30876dfa 407
Kojto 107:4f6c30876dfa 408 /**
Kojto 107:4f6c30876dfa 409 * @}
Kojto 107:4f6c30876dfa 410 */
Kojto 107:4f6c30876dfa 411
Kojto 107:4f6c30876dfa 412 /**
Kojto 107:4f6c30876dfa 413 * @}
Kojto 107:4f6c30876dfa 414 */
Kojto 107:4f6c30876dfa 415
Kojto 107:4f6c30876dfa 416 /**
Kojto 107:4f6c30876dfa 417 * @}
Kojto 107:4f6c30876dfa 418 */
Kojto 107:4f6c30876dfa 419
Kojto 107:4f6c30876dfa 420 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 421 }
Kojto 107:4f6c30876dfa 422 #endif
Kojto 107:4f6c30876dfa 423
Kojto 107:4f6c30876dfa 424
Kojto 107:4f6c30876dfa 425 #endif /* __STM32L4xx_HAL_PWR_H */
Kojto 107:4f6c30876dfa 426
Kojto 107:4f6c30876dfa 427 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/