2 ******************************************************************************
\r
3 * @file stm32l1xx_pwr.h
\r
4 * @author MCD Application Team
\r
7 * @brief This file contains all the functions prototypes for the PWR firmware
\r
9 ******************************************************************************
\r
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
19 * <h2><center>© COPYRIGHT 2010 STMicroelectronics</center></h2>
\r
22 /* Define to prevent recursive inclusion -------------------------------------*/
\r
23 #ifndef __STM32L1xx_PWR_H
\r
24 #define __STM32L1xx_PWR_H
\r
30 /* Includes ------------------------------------------------------------------*/
\r
31 #include "stm32l1xx.h"
\r
33 /** @addtogroup STM32L1xx_StdPeriph_Driver
\r
41 /** @defgroup PWR_Exported_Types
\r
49 /** @defgroup PWR_Exported_Constants
\r
53 /** @defgroup PVD_detection_level
\r
57 #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
\r
58 #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
\r
59 #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
\r
60 #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
\r
61 #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
\r
62 #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
\r
63 #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
\r
64 #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7 /* External input analog voltage
\r
65 (Compare internally to VREFINT) */
\r
66 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
\r
67 ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
\r
68 ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
\r
69 ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
\r
74 /** @defgroup WakeUp_Pins
\r
78 #define PWR_WakeUpPin_1 ((uint32_t)0x00000000)
\r
79 #define PWR_WakeUpPin_2 ((uint32_t)0x00000004)
\r
80 #define PWR_WakeUpPin_3 ((uint32_t)0x00000008)
\r
81 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUpPin_1) || \
\r
82 ((PIN) == PWR_WakeUpPin_2) || \
\r
83 ((PIN) == PWR_WakeUpPin_3))
\r
89 /** @defgroup Voltage_Scaling_Ranges
\r
93 #define PWR_VoltageScaling_Range1 PWR_CR_VOS_0
\r
94 #define PWR_VoltageScaling_Range2 PWR_CR_VOS_1
\r
95 #define PWR_VoltageScaling_Range3 PWR_CR_VOS
\r
97 #define IS_PWR_VOLTAGE_SCALING_RANGE(RANGE) (((RANGE) == PWR_VoltageScaling_Range1) || \
\r
98 ((RANGE) == PWR_VoltageScaling_Range2) || \
\r
99 ((RANGE) == PWR_VoltageScaling_Range3))
\r
104 /** @defgroup Regulator_state_is_Sleep_STOP_mode
\r
108 #define PWR_Regulator_ON ((uint32_t)0x00000000)
\r
109 #define PWR_Regulator_LowPower PWR_CR_LPSDSR
\r
110 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
\r
111 ((REGULATOR) == PWR_Regulator_LowPower))
\r
116 /** @defgroup SLEEP_mode_entry
\r
120 #define PWR_SLEEPEntry_WFI ((uint8_t)0x01)
\r
121 #define PWR_SLEEPEntry_WFE ((uint8_t)0x02)
\r
122 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE))
\r
128 /** @defgroup STOP_mode_entry
\r
132 #define PWR_STOPEntry_WFI ((uint8_t)0x01)
\r
133 #define PWR_STOPEntry_WFE ((uint8_t)0x02)
\r
134 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
\r
140 /** @defgroup PWR_Flag
\r
144 #define PWR_FLAG_WU PWR_CSR_WUF
\r
145 #define PWR_FLAG_SB PWR_CSR_SBF
\r
146 #define PWR_FLAG_PVDO PWR_CSR_PVDO
\r
147 #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
\r
148 #define PWR_FLAG_VOS PWR_CSR_VOSF
\r
149 #define PWR_FLAG_REGLP PWR_CSR_REGLPF
\r
151 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
\r
152 ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_VREFINTRDY) || \
\r
153 ((FLAG) == PWR_FLAG_VOS) || ((FLAG) == PWR_FLAG_REGLP))
\r
155 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
\r
164 /** @defgroup PWR_Exported_Macros
\r
172 /** @defgroup PWR_Exported_Functions
\r
176 void PWR_DeInit(void);
\r
177 void PWR_RTCAccessCmd(FunctionalState NewState);
\r
178 void PWR_PVDCmd(FunctionalState NewState);
\r
179 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
\r
180 void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState);
\r
181 void PWR_FastWakeUpCmd(FunctionalState NewState);
\r
182 void PWR_UltraLowPowerCmd(FunctionalState NewState);
\r
183 void PWR_VoltageScalingConfig(uint32_t PWR_VoltageScaling);
\r
184 void PWR_EnterLowPowerRunMode(FunctionalState NewState);
\r
185 void PWR_EnterSleepMode(uint32_t PWR_Regulator, uint8_t PWR_SLEEPEntry);
\r
186 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
\r
187 void PWR_EnterSTANDBYMode(void);
\r
188 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
\r
189 void PWR_ClearFlag(uint32_t PWR_FLAG);
\r
195 #endif /* __STM32L1xx_PWR_H */
\r
208 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
\r