stm8l15x_pwr.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_pwr.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the PWR firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_PWR_H
  30. #define __STM8L15x_PWR_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup PWR
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup PWR_Exported_Types
  41. * @{
  42. */
  43. /** @defgroup PVD_detection_level
  44. * @{
  45. */
  46. typedef enum {
  47. PWR_PVDLevel_1V85 = (uint8_t)0x00, /*!< PVD threshold = 1.85 V */
  48. PWR_PVDLevel_2V05 = (uint8_t)0x02, /*!< PVD threshold = 2.05 V */
  49. PWR_PVDLevel_2V26 = (uint8_t)0x04, /*!< PVD threshold = 2.26 V */
  50. PWR_PVDLevel_2V45 = (uint8_t)0x06, /*!< PVD threshold = 2.45 V */
  51. PWR_PVDLevel_2V65 = (uint8_t)0x08, /*!< PVD threshold = 2.65 V */
  52. PWR_PVDLevel_2V85 = (uint8_t)0x0A, /*!< PVD threshold = 2.85 V */
  53. PWR_PVDLevel_3V05 = (uint8_t)0x0C, /*!< PVD threshold = 3.05 V */
  54. PWR_PVDLevel_PVDIn = (uint8_t)0x0E /*!< PVD threshold = PVD_IN input pin */
  55. } PWR_PVDLevel_TypeDef;
  56. #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_1V85) || \
  57. ((LEVEL) == PWR_PVDLevel_2V05) || \
  58. ((LEVEL) == PWR_PVDLevel_2V26) || \
  59. ((LEVEL) == PWR_PVDLevel_2V45) || \
  60. ((LEVEL) == PWR_PVDLevel_2V65) || \
  61. ((LEVEL) == PWR_PVDLevel_2V85) || \
  62. ((LEVEL) == PWR_PVDLevel_3V05) || \
  63. ((LEVEL) == PWR_PVDLevel_PVDIn))
  64. /**
  65. * @}
  66. */
  67. /** @defgroup PWR_Flag
  68. * @{
  69. */
  70. typedef enum {
  71. PWR_FLAG_PVDOF = (uint8_t)0x40,/*!< PVD output flag */
  72. PWR_FLAG_PVDIF = (uint8_t)0x20, /*!< PVD Interrupt flag */
  73. PWR_FLAG_VREFINTF = (uint8_t)0x01 /*!< Internal reference voltage status flag */
  74. } PWR_FLAG_TypeDef;
  75. #define IS_PWR_FLAG(FLAG) (((FLAG) == PWR_FLAG_PVDOF) || \
  76. ((FLAG) == PWR_FLAG_PVDIF) || \
  77. ((FLAG) == PWR_FLAG_VREFINTF))
  78. /**
  79. * @}
  80. */
  81. /**
  82. * @}
  83. */
  84. /* Exported constants --------------------------------------------------------*/
  85. /* Exported macros -----------------------------------------------------------*/
  86. /* Exported functions ------------------------------------------------------- */
  87. /* Function used to set the PWR configuration to the default reset state ******/
  88. void PWR_DeInit(void);
  89. /* PVD configuration functions ************************************************/
  90. void PWR_PVDLevelConfig(PWR_PVDLevel_TypeDef PWR_PVDLevel);
  91. void PWR_PVDCmd(FunctionalState NewState);
  92. /* Ultra Low Power mode configuration functions *******************************/
  93. void PWR_FastWakeUpCmd(FunctionalState NewState);
  94. void PWR_UltraLowPowerCmd(FunctionalState NewState);
  95. /* Interrupts and flags management functions **********************************/
  96. void PWR_PVDITConfig(FunctionalState NewState);
  97. ITStatus PWR_PVDGetITStatus(void);
  98. FlagStatus PWR_GetFlagStatus(PWR_FLAG_TypeDef PWR_FLAG);
  99. void PWR_PVDClearFlag(void);
  100. void PWR_PVDClearITPendingBit(void);
  101. #endif /* __STM8L15x_PWR_H */
  102. /**
  103. * @}
  104. */
  105. /**
  106. * @}
  107. */
  108. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/