apm32f10x_pmu.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.2
  7. *
  8. * @date 2022-01-05
  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 usefull 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. #ifndef __APM32F10X_PMU_H
  26. #define __APM32F10X_PMU_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "apm32f10x.h"
  31. /** @addtogroup Peripherals_Library Standard Peripheral Library
  32. @{
  33. */
  34. /** @addtogroup PMU_Driver PMU Driver
  35. @{
  36. */
  37. /** @addtogroup PMU_Enumerations Enumerations
  38. @{
  39. */
  40. /**
  41. * @brief PMU PVD detection level
  42. */
  43. typedef enum
  44. {
  45. PMU_PVD_LEVEL_2V2 = 0x00, //!< PVD detection level set to 2.2V
  46. PMU_PVD_LEVEL_2V3 = 0x01, //!< PVD detection level set to 2.3V
  47. PMU_PVD_LEVEL_2V4 = 0x02, //!< PVD detection level set to 2.4V
  48. PMU_PVD_LEVEL_2V5 = 0x03, //!< PVD detection level set to 2.5V
  49. PMU_PVD_LEVEL_2V6 = 0x04, //!< PVD detection level set to 2.6V
  50. PMU_PVD_LEVEL_2V7 = 0x05, //!< PVD detection level set to 2.7V
  51. PMU_PVD_LEVEL_2V8 = 0x06, //!< PVD detection level set to 2.8V
  52. PMU_PVD_LEVEL_2V9 = 0x07, //!< PVD detection level set to 2.9V
  53. } PMU_PVD_LEVEL_T;
  54. /**
  55. * @brief PMU Regulator state in STOP mode
  56. */
  57. typedef enum
  58. {
  59. PMU_REGULATOR_ON = 0x00,
  60. PMU_REGULATOR_LOWPOWER = 0x01
  61. } PMU_REGULATOR_T;
  62. /**
  63. * @brief PMU STOP mode entry
  64. */
  65. typedef enum
  66. {
  67. PMU_STOP_ENTRY_WFI = 0x01,
  68. PMU_STOP_ENTRY_WFE = 0x02
  69. } PMU_STOP_ENTRY_T;
  70. /**
  71. * @brief PMU Flag
  72. */
  73. typedef enum
  74. {
  75. PMU_FLAG_WUE,
  76. PMU_FLAG_SB,
  77. PMU_FLAG_PVDO
  78. } PMU_FLAG_T;
  79. /**@} end of group PMU_Enumerations*/
  80. /** @addtogroup PMU_Fuctions Fuctions
  81. @{
  82. */
  83. /** PMU Reset */
  84. void PMU_Reset(void);
  85. /** Configuration and Operation modes */
  86. void PMU_EnableBackupAccess(void);
  87. void PMU_DisableBackupAccess(void);
  88. void PMU_EnablePVD(void);
  89. void PMU_DisablePVD(void);
  90. void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level);
  91. void PMU_EnableWakeUpPin(void);
  92. void PMU_DisableWakeUpPin(void);
  93. void PMU_EnterSTOPMode(PMU_REGULATOR_T regulator, PMU_STOP_ENTRY_T entry);
  94. void PMU_EnterSTANDBYMode(void);
  95. /** flags */
  96. uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag);
  97. void PMU_ClearStatusFlag(PMU_FLAG_T flag);
  98. /**@} end of group PMU_Fuctions*/
  99. /**@} end of group PMU_Driver*/
  100. /**@} end of group Peripherals_Library*/
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* __APM32F10X_PMU_H */