apm32f10x_pmu.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*!
  2. * @file apm32f10x_pmu.h
  3. *
  4. * @brief This file contains all the functions prototypes for the PMU firmware library.
  5. *
  6. * @version V1.0.4
  7. *
  8. * @date 2022-12-01
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be useful and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F10X_PMU_H
  27. #define __APM32F10X_PMU_H
  28. /* Includes */
  29. #include "apm32f10x.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /** @addtogroup APM32F10x_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup PMU_Driver PMU Driver
  37. @{
  38. */
  39. /** @defgroup PMU_Enumerations Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief PMU PVD detection level
  44. */
  45. typedef enum
  46. {
  47. PMU_PVD_LEVEL_2V2 = 0x00, /*!< PVD detection level set to 2.2V */
  48. PMU_PVD_LEVEL_2V3 = 0x01, /*!< PVD detection level set to 2.3V */
  49. PMU_PVD_LEVEL_2V4 = 0x02, /*!< PVD detection level set to 2.4V */
  50. PMU_PVD_LEVEL_2V5 = 0x03, /*!< PVD detection level set to 2.5V */
  51. PMU_PVD_LEVEL_2V6 = 0x04, /*!< PVD detection level set to 2.6V */
  52. PMU_PVD_LEVEL_2V7 = 0x05, /*!< PVD detection level set to 2.7V */
  53. PMU_PVD_LEVEL_2V8 = 0x06, /*!< PVD detection level set to 2.8V */
  54. PMU_PVD_LEVEL_2V9 = 0x07, /*!< PVD detection level set to 2.9V */
  55. } PMU_PVD_LEVEL_T;
  56. /**
  57. * @brief PMU Regulator state in STOP mode
  58. */
  59. typedef enum
  60. {
  61. PMU_REGULATOR_ON = 0x00,
  62. PMU_REGULATOR_LOWPOWER = 0x01
  63. } PMU_REGULATOR_T;
  64. /**
  65. * @brief PMU STOP mode entry
  66. */
  67. typedef enum
  68. {
  69. PMU_STOP_ENTRY_WFI = 0x01,
  70. PMU_STOP_ENTRY_WFE = 0x02
  71. } PMU_STOP_ENTRY_T;
  72. /**
  73. * @brief PMU Flag
  74. */
  75. typedef enum
  76. {
  77. PMU_FLAG_WUE,
  78. PMU_FLAG_SB,
  79. PMU_FLAG_PVDO
  80. } PMU_FLAG_T;
  81. /**@} end of group PMU_Enumerations*/
  82. /** @addtogroup PMU_Functions Functions
  83. @{
  84. */
  85. /* PMU Reset */
  86. void PMU_Reset(void);
  87. /* Configuration and Operation modes */
  88. void PMU_EnableBackupAccess(void);
  89. void PMU_DisableBackupAccess(void);
  90. void PMU_EnablePVD(void);
  91. void PMU_DisablePVD(void);
  92. void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level);
  93. void PMU_EnableWakeUpPin(void);
  94. void PMU_DisableWakeUpPin(void);
  95. void PMU_EnterSTOPMode(PMU_REGULATOR_T regulator, PMU_STOP_ENTRY_T entry);
  96. void PMU_EnterSTANDBYMode(void);
  97. /* flags */
  98. uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag);
  99. void PMU_ClearStatusFlag(PMU_FLAG_T flag);
  100. /**@} end of group PMU_Functions*/
  101. /**@} end of group PMU_Driver */
  102. /**@} end of group APM32F10x_StdPeriphDriver*/
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #endif /* __APM32F10X_PMU_H */