HAL_pwr.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /**
  2. ******************************************************************************
  3. * @file HAL_pwr.h
  4. * @author AE Team
  5. * @version V1.1.0
  6. * @date 28/08/2019
  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, MindMotion 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>&copy; COPYRIGHT 2019 MindMotion</center></h2>
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __HAL_PWR_H
  23. #define __HAL_PWR_H
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "HAL_device.h"
  26. /** @addtogroup StdPeriph_Driver
  27. * @{
  28. */
  29. /** @addtogroup PWR
  30. * @{
  31. */
  32. /** @defgroup PWR_Exported_Types
  33. * @{
  34. */
  35. /**
  36. * @}
  37. */
  38. /** @defgroup PWR_Exported_Constants
  39. * @{
  40. */
  41. /** @defgroup PVD_detection_level
  42. * @{
  43. */
  44. #define PWR_PVDLevel_1V8 ((uint32_t)0x00000000)
  45. #define PWR_PVDLevel_2V1 ((uint32_t)0x00000200)
  46. #define PWR_PVDLevel_2V4 ((uint32_t)0x00000400)
  47. #define PWR_PVDLevel_2V7 ((uint32_t)0x00000600)
  48. #define PWR_PVDLevel_3V0 ((uint32_t)0x00000800)
  49. #define PWR_PVDLevel_3V3 ((uint32_t)0x00000A00)
  50. #define PWR_PVDLevel_3V6 ((uint32_t)0x00000C00)
  51. #define PWR_PVDLevel_3V9 ((uint32_t)0x00000E00)
  52. #define PWR_PVDLevel_4V2 ((uint32_t)0x00001000)
  53. #define PWR_PVDLevel_4V5 ((uint32_t)0x00001200)
  54. #define PWR_PVDLevel_4V8 ((uint32_t)0x00001400)
  55. #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_1V8) || ((LEVEL) == PWR_PVDLevel_2V1)|| \
  56. ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
  57. ((LEVEL) == PWR_PVDLevel_3V0) || ((LEVEL) == PWR_PVDLevel_3V3)|| \
  58. ((LEVEL) == PWR_PVDLevel_3V6) || ((LEVEL) == PWR_PVDLevel_3V9)|| \
  59. ((LEVEL) == PWR_PVDLevel_4V2) || ((LEVEL) == PWR_PVDLevel_4V5)|| \
  60. ((LEVEL) == PWR_PVDLevel_4V8))
  61. /**
  62. * @}
  63. */
  64. /** @defgroup Regulator_state_is_STOP_mode
  65. * @{
  66. */
  67. #define PWR_Regulator_ON ((uint32_t)0x00000000)
  68. #define PWR_Regulator_LowPower ((uint32_t)0x00000002)
  69. #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
  70. ((REGULATOR) == PWR_Regulator_LowPower))
  71. /**
  72. * @}
  73. */
  74. /** @defgroup STOP_mode_entry
  75. * @{
  76. */
  77. #define PWR_STOPEntry_WFI ((uint8_t)0x01)
  78. #define PWR_STOPEntry_WFE ((uint8_t)0x02)
  79. #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
  80. /**
  81. * @}
  82. */
  83. /** @defgroup PWR_Flag
  84. * @{
  85. */
  86. #define PWR_FLAG_WU ((uint32_t)0x00000001)
  87. #define PWR_FLAG_SB ((uint32_t)0x00000002)
  88. #define PWR_FLAG_PVDO ((uint32_t)0x00000004)
  89. #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
  90. ((FLAG) == PWR_FLAG_PVDO))
  91. #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
  92. /**
  93. * @}
  94. */
  95. /**
  96. * @}
  97. */
  98. /** @defgroup PWR_Exported_Macros
  99. * @{
  100. */
  101. /**
  102. * @}
  103. */
  104. /** @defgroup PWR_Exported_Functions
  105. * @{
  106. */
  107. void PWR_DeInit(void);
  108. void PWR_BackupAccessCmd(FunctionalState NewState);
  109. void PWR_PVDCmd(FunctionalState NewState);
  110. void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
  111. void PWR_WakeUpPinCmd(FunctionalState NewState);
  112. void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
  113. void PWR_EnterSTANDBYMode(void);
  114. FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
  115. void PWR_ClearFlag(uint32_t PWR_FLAG);
  116. #endif /* __HAL_PWR_H */
  117. /**
  118. * @}
  119. */
  120. /**
  121. * @}
  122. */
  123. /**
  124. * @}
  125. */
  126. /*-------------------------(C) COPYRIGHT 2019 MindMotion ----------------------*/