STM8L15x Standard Peripherals Drivers
|
stm8l15x_pwr.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm8l15x_pwr.h 00004 * @author MCD Application Team 00005 * @version V1.5.0 00006 * @date 13-May-2011 00007 * @brief This file contains all the functions prototypes for the PWR firmware 00008 * library. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00013 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 00014 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 00015 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 00016 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 00017 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00018 * 00019 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> 00020 ****************************************************************************** 00021 */ 00022 00023 /* Define to prevent recursive inclusion -------------------------------------*/ 00024 #ifndef __STM8L15x_PWR_H 00025 #define __STM8L15x_PWR_H 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm8l15x.h" 00029 00030 /** @addtogroup STM8L15x_StdPeriph_Driver 00031 * @{ 00032 */ 00033 00034 /** @addtogroup PWR 00035 * @{ 00036 */ 00037 00038 /* Exported types ------------------------------------------------------------*/ 00039 00040 /** @defgroup PWR_Exported_Types 00041 * @{ 00042 */ 00043 00044 /** @defgroup PVD_detection_level 00045 * @{ 00046 */ 00047 00048 typedef enum { 00049 PWR_PVDLevel_1V85 = (uint8_t)0x00, /*!< PVD threshold = 1.85 V */ 00050 PWR_PVDLevel_2V05 = (uint8_t)0x02, /*!< PVD threshold = 2.05 V */ 00051 PWR_PVDLevel_2V26 = (uint8_t)0x04, /*!< PVD threshold = 2.26 V */ 00052 PWR_PVDLevel_2V45 = (uint8_t)0x06, /*!< PVD threshold = 2.45 V */ 00053 PWR_PVDLevel_2V65 = (uint8_t)0x08, /*!< PVD threshold = 2.65 V */ 00054 PWR_PVDLevel_2V85 = (uint8_t)0x0A, /*!< PVD threshold = 2.85 V */ 00055 PWR_PVDLevel_3V05 = (uint8_t)0x0C, /*!< PVD threshold = 3.05 V */ 00056 PWR_PVDLevel_PVDIn = (uint8_t)0x0E /*!< PVD threshold = PVD_IN input pin */ 00057 } PWR_PVDLevel_TypeDef; 00058 00059 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_1V85) || \ 00060 ((LEVEL) == PWR_PVDLevel_2V05) || \ 00061 ((LEVEL) == PWR_PVDLevel_2V26) || \ 00062 ((LEVEL) == PWR_PVDLevel_2V45) || \ 00063 ((LEVEL) == PWR_PVDLevel_2V65) || \ 00064 ((LEVEL) == PWR_PVDLevel_2V85) || \ 00065 ((LEVEL) == PWR_PVDLevel_3V05) || \ 00066 ((LEVEL) == PWR_PVDLevel_PVDIn)) 00067 /** 00068 * @} 00069 */ 00070 00071 /** @defgroup PWR_Flag 00072 * @{ 00073 */ 00074 00075 typedef enum { 00076 PWR_FLAG_PVDOF = (uint8_t)0x40,/*!< PVD output flag */ 00077 PWR_FLAG_PVDIF = (uint8_t)0x20, /*!< PVD Interrupt flag */ 00078 PWR_FLAG_VREFINTF = (uint8_t)0x01 /*!< Internal reference voltage status flag */ 00079 } PWR_FLAG_TypeDef; 00080 00081 #define IS_PWR_FLAG(FLAG) (((FLAG) == PWR_FLAG_PVDOF) || \ 00082 ((FLAG) == PWR_FLAG_PVDIF) || \ 00083 ((FLAG) == PWR_FLAG_VREFINTF)) 00084 00085 /** 00086 * @} 00087 */ 00088 00089 /** 00090 * @} 00091 */ 00092 00093 /* Exported constants --------------------------------------------------------*/ 00094 /* Exported macros -----------------------------------------------------------*/ 00095 /* Exported functions ------------------------------------------------------- */ 00096 00097 /* Function used to set the PWR configuration to the default reset state ******/ 00098 void PWR_DeInit(void); 00099 00100 /* PVD configuration functions ************************************************/ 00101 void PWR_PVDLevelConfig(PWR_PVDLevel_TypeDef PWR_PVDLevel); 00102 void PWR_PVDCmd(FunctionalState NewState); 00103 00104 /* Ultra Low Power mode configuration functions *******************************/ 00105 void PWR_FastWakeUpCmd(FunctionalState NewState); 00106 void PWR_UltraLowPowerCmd(FunctionalState NewState); 00107 00108 /* Interrupts and flags management functions **********************************/ 00109 void PWR_PVDITConfig(FunctionalState NewState); 00110 ITStatus PWR_PVDGetITStatus(void); 00111 FlagStatus PWR_GetFlagStatus(PWR_FLAG_TypeDef PWR_FLAG); 00112 void PWR_PVDClearFlag(void); 00113 void PWR_PVDClearITPendingBit(void); 00114 00115 #endif /* __STM8L15x_PWR_H */ 00116 00117 /** 00118 * @} 00119 */ 00120 00121 /** 00122 * @} 00123 */ 00124 00125 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/