Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F3xx_HAL_Driver / Inc / stm32f3xx_hal_pwr.h
blob91c10a3c0b53bc01cae0ebcf2b595117cef15483
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_hal_pwr.h
4 * @author MCD Application Team
5 * @brief Header file of PWR HAL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ******************************************************************************
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F3xx_HAL_PWR_H
38 #define __STM32F3xx_HAL_PWR_H
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /* Includes ------------------------------------------------------------------*/
45 #include "stm32f3xx_hal_def.h"
47 /** @addtogroup STM32F3xx_HAL_Driver
48 * @{
51 /** @addtogroup PWR PWR
52 * @{
53 */
55 /* Exported types ------------------------------------------------------------*/
56 /* Exported constants --------------------------------------------------------*/
57 /** @defgroup PWR_Exported_Constants PWR Exported Constants
58 * @{
59 */
61 /** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins
62 * @{
65 #define PWR_WAKEUP_PIN1 ((uint32_t)PWR_CSR_EWUP1) /*!< Wakeup pin 1U */
66 #define PWR_WAKEUP_PIN2 ((uint32_t)PWR_CSR_EWUP2) /*!< Wakeup pin 2U */
67 #define PWR_WAKEUP_PIN3 ((uint32_t)PWR_CSR_EWUP3) /*!< Wakeup pin 3U */
68 /**
69 * @}
72 /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode
73 * @{
75 #define PWR_MAINREGULATOR_ON (0x00000000U) /*!< Voltage regulator on during STOP mode */
76 #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS /*!< Voltage regulator in low-power mode during STOP mode */
77 /**
78 * @}
81 /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
82 * @{
84 #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01U) /*!< Wait For Interruption instruction to enter SLEEP mode */
85 #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02U) /*!< Wait For Event instruction to enter SLEEP mode */
86 /**
87 * @}
90 /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
91 * @{
93 #define PWR_STOPENTRY_WFI ((uint8_t)0x01U) /*!< Wait For Interruption instruction to enter STOP mode */
94 #define PWR_STOPENTRY_WFE ((uint8_t)0x02U) /*!< Wait For Event instruction to enter STOP mode */
95 /**
96 * @}
99 /** @defgroup PWR_Flag PWR Flag
100 * @{
102 #define PWR_FLAG_WU PWR_CSR_WUF /*!< Wakeup event from wakeup pin or RTC alarm */
103 #define PWR_FLAG_SB PWR_CSR_SBF /*!< Standby flag */
104 #define PWR_FLAG_PVDO PWR_CSR_PVDO /*!< Power Voltage Detector output flag */
105 #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF /*!< VREFINT reference voltage ready */
107 * @}
111 * @}
114 /* Exported macro ------------------------------------------------------------*/
115 /** @defgroup PWR_Exported_Macro PWR Exported Macro
116 * @{
119 /** @brief Check PWR flag is set or not.
120 * @param __FLAG__ specifies the flag to check.
121 * This parameter can be one of the following values:
122 * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
123 * was received from the WKUP pin or from the RTC alarm (Alarm A
124 * or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
125 * An additional wakeup event is detected if the WKUP pin is enabled
126 * (by setting the EWUP bit) when the WKUP pin level is already high.
127 * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
128 * resumed from StandBy mode.
129 * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
130 * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode
131 * For this reason, this bit is equal to 0 after Standby or reset
132 * until the PVDE bit is set.
133 * @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference
134 * voltage VREFINT is ready.
135 * @retval The new state of __FLAG__ (TRUE or FALSE).
137 #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
139 /** @brief Clear the PWR's pending flags.
140 * @param __FLAG__ specifies the flag to clear.
141 * This parameter can be one of the following values:
142 * @arg PWR_FLAG_WU: Wake Up flag
143 * @arg PWR_FLAG_SB: StandBy flag
145 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2U)
148 * @}
151 /* Private macros --------------------------------------------------------*/
152 /** @addtogroup PWR_Private_Macros PWR Private Macros
153 * @{
156 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
157 ((PIN) == PWR_WAKEUP_PIN2) || \
158 ((PIN) == PWR_WAKEUP_PIN3))
160 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
161 ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
163 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
165 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
168 * @}
171 /* Include PWR HAL Extended module */
172 #include "stm32f3xx_hal_pwr_ex.h"
174 /* Exported functions --------------------------------------------------------*/
176 /** @addtogroup PWR_Exported_Functions PWR Exported Functions
177 * @{
180 /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
181 * @{
184 /* Initialization and de-initialization functions *****************************/
185 void HAL_PWR_DeInit(void);
188 * @}
191 /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
192 * @{
195 /* Peripheral Control functions **********************************************/
196 void HAL_PWR_EnableBkUpAccess(void);
197 void HAL_PWR_DisableBkUpAccess(void);
199 /* WakeUp pins configuration functions ****************************************/
200 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
201 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
203 /* Low Power modes configuration functions ************************************/
204 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
205 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
206 void HAL_PWR_EnterSTANDBYMode(void);
208 void HAL_PWR_EnableSleepOnExit(void);
209 void HAL_PWR_DisableSleepOnExit(void);
210 void HAL_PWR_EnableSEVOnPend(void);
211 void HAL_PWR_DisableSEVOnPend(void);
213 * @}
217 * @}
221 * @}
225 * @}
228 #ifdef __cplusplus
230 #endif
233 #endif /* __STM32F3xx_HAL_PWR_H */
235 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/