MG32F157 Standard Peripherals Firmware Library
mg32f157_pwr.h
Go to the documentation of this file.
1 
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32F157_PWR_H
12 #define __MG32F157_PWR_H
13 
14 #ifdef __cplusplus
15  extern "C" {
16 #endif
17 
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f157.h"
20 
29 /* Exported types -------------------------------------------------------------*/
30 /* Exported constants --------------------------------------------------------*/
31 
39 #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000)
40 #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020)
41 #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040)
42 #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060)
43 #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080)
44 #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0)
45 #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0)
46 #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0)
47 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \
48  ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \
49  ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
50  ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9))
51 
59 #define PWR_Regulator_ON ((uint32_t)0x00000000)
60 #define PWR_Regulator_LowPower ((uint32_t)0x00000001)
61 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
62  ((REGULATOR) == PWR_Regulator_LowPower))
63 
71 #define PWR_STOPEntry_WFI ((uint8_t)0x01)
72 #define PWR_STOPEntry_WFE ((uint8_t)0x02)
73 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
74 
82 #define PWR_FLAG_WU ((uint32_t)0x00000001)
83 #define PWR_FLAG_SB ((uint32_t)0x00000002)
84 #define PWR_FLAG_PVDO ((uint32_t)0x00000004)
85 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
86  ((FLAG) == PWR_FLAG_PVDO))
87 
88 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
89 
97 /* Exported macro ------------------------------------------------------------*/
98 /* Exported functions --------------------------------------------------------*/
99 
100 void PWR_DeInit(void);
101 void PWR_BackupAccessCmd(FunctionalState NewState);
102 void PWR_PVDCmd(FunctionalState NewState);
103 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
104 void PWR_WakeUpPinCmd(FunctionalState NewState);
105 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
106 void PWR_EnterSTANDBYMode(void);
107 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
108 void PWR_ClearFlag(uint32_t PWR_FLAG);
109 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* __MG32F157_PWR_H */
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG)
Checks whether the specified PWR flag is set or not.
Definition: mg32f157_pwr.c:223
void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry)
Enters STOP mode.
Definition: mg32f157_pwr.c:159
void PWR_BackupAccessCmd(FunctionalState NewState)
Enables or disables access to the RTC and backup registers.
Definition: mg32f157_pwr.c:86
void PWR_PVDCmd(FunctionalState NewState)
Enables or disables the Power Voltage Detector(PVD).
Definition: mg32f157_pwr.c:99
void PWR_EnterSTANDBYMode(void)
Enters STANDBY mode.
Definition: mg32f157_pwr.c:198
void PWR_DeInit(void)
Deinitializes the PWR peripheral registers to their default reset values.
Definition: mg32f157_pwr.c:74
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel)
Configures the voltage threshold detected by the Power Voltage Detector(PVD).
Definition: mg32f157_pwr.c:120
void PWR_WakeUpPinCmd(FunctionalState NewState)
Enables or disables the WakeUp Pin functionality.
Definition: mg32f157_pwr.c:140
void PWR_ClearFlag(uint32_t PWR_FLAG)
Clears the PWR's pending flags.
Definition: mg32f157_pwr.c:249