1 /** 2 ****************************************************************************** 3 * @file HAL_pwr.h 4 * @author IC Applications Department 5 * @version V0.8 6 * @date 2019_08_02 7 * @brief This file contains all the functions prototypes for the PWR firmware 8 * library. 9 ****************************************************************************** 10 * @copy 11 * 12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 * TIME. AS A RESULT, HOLOCENE SHALL NOT BE HELD LIABLE FOR ANY 15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 * 19 * <h2><center>© COPYRIGHT 2016 HOLOCENE</center></h2> 20 */ 21 22 /* Define to prevent recursive inclusion -------------------------------------*/ 23 #ifndef __HAL_PWR_H 24 #define __HAL_PWR_H 25 26 /* Includes ------------------------------------------------------------------*/ 27 #include "HAL_device.h" 28 29 /** @addtogroup StdPeriph_Driver 30 * @{ 31 */ 32 33 /** @addtogroup PWR 34 * @{ 35 */ 36 37 /** @defgroup PWR_Exported_Types 38 * @{ 39 */ 40 41 /** 42 * @} 43 */ 44 45 /** @defgroup PWR_Exported_Constants 46 * @{ 47 */ 48 49 /** @defgroup PVD_detection_level 50 * @{ 51 */ 52 53 #define PWR_PVDLevel_2V6 ((uint32_t)0x00000000) 54 #define PWR_PVDLevel_2V8 ((uint32_t)0x00000200) 55 #define PWR_PVDLevel_3V0 ((uint32_t)0x00000400) 56 #define PWR_PVDLevel_3V2 ((uint32_t)0x00000600) 57 #define PWR_PVDLevel_3V4 ((uint32_t)0x00000800) 58 #define PWR_PVDLevel_3V6 ((uint32_t)0x00000A00) 59 #define PWR_PVDLevel_3V8 ((uint32_t)0x00000C00) 60 #define PWR_PVDLevel_4V0 ((uint32_t)0x00000E00) 61 #define PWR_PVDLevel_4V2 ((uint32_t)0x00001000) 62 #define PWR_PVDLevel_4V4 ((uint32_t)0x00001200) 63 #define PWR_PVDLevel_4V6 ((uint32_t)0x00001400) 64 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V8)|| \ 65 ((LEVEL) == PWR_PVDLevel_3V0) || ((LEVEL) == PWR_PVDLevel_3V2)|| \ 66 ((LEVEL) == PWR_PVDLevel_3V4) || ((LEVEL) == PWR_PVDLevel_3V6)|| \ 67 ((LEVEL) == PWR_PVDLevel_3V8) || ((LEVEL) == PWR_PVDLevel_4V0)|| \ 68 ((LEVEL) == PWR_PVDLevel_4V2) || ((LEVEL) == PWR_PVDLevel_4V4)|| \ 69 ((LEVEL) == PWR_PVDLevel_4V6)) 70 /** 71 * @} 72 */ 73 74 /** @defgroup Regulator_state_is_STOP_mode 75 * @{ 76 */ 77 78 #define PWR_Regulator_ON ((uint32_t)0x00000000) 79 #define PWR_Regulator_LowPower ((uint32_t)0x00000002) 80 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 81 ((REGULATOR) == PWR_Regulator_LowPower)) 82 /** 83 * @} 84 */ 85 86 /** @defgroup STOP_mode_entry 87 * @{ 88 */ 89 90 #define PWR_STOPEntry_WFI ((uint8_t)0x01) 91 #define PWR_STOPEntry_WFE ((uint8_t)0x02) 92 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 93 94 /** 95 * @} 96 */ 97 98 /** @defgroup PWR_Flag 99 * @{ 100 */ 101 102 #define PWR_FLAG_WU ((uint32_t)0x00000001) 103 #define PWR_FLAG_SB ((uint32_t)0x00000002) 104 #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 105 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 106 ((FLAG) == PWR_FLAG_PVDO)) 107 108 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 109 /** 110 * @} 111 */ 112 113 /** 114 * @} 115 */ 116 117 /** @defgroup PWR_Exported_Macros 118 * @{ 119 */ 120 121 /** 122 * @} 123 */ 124 125 /** @defgroup PWR_Exported_Functions 126 * @{ 127 */ 128 129 void PWR_DeInit(void); 130 void PWR_BackupAccessCmd(FunctionalState NewState); 131 void PWR_PVDCmd(FunctionalState NewState); 132 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 133 void PWR_WakeUpPinCmd(FunctionalState NewState); 134 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 135 void PWR_EnterSTANDBYMode(void); 136 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 137 void PWR_ClearFlag(uint32_t PWR_FLAG); 138 139 #endif /* __HAL_PWR_H */ 140 /** 141 * @} 142 */ 143 144 /** 145 * @} 146 */ 147 148 /** 149 * @} 150 */ 151 152 /*-------------------------(C) COPYRIGHT 2016 HOLOCENE ----------------------*/ 153