apm32f4xx_pmu.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*!
  2. * @file apm32f4xx_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-06-23
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2021-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. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F4XX_PMU_H
  27. #define __APM32F4XX_PMU_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32f4xx.h"
  33. /** @addtogroup APM32F4xx_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup PMU_Driver
  37. @{
  38. */
  39. /** @defgroup PMU_Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief PMU PVD detection level
  44. */
  45. typedef enum
  46. {
  47. PMU_PVD_LEVEL_2V0 = 0x00, /*!< PVD detection level set to 2.0V */
  48. PMU_PVD_LEVEL_2V1 = 0x01, /*!< PVD detection level set to 2.1V */
  49. PMU_PVD_LEVEL_2V3 = 0x02, /*!< PVD detection level set to 2.3V */
  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, /*!< STOP mode with regulator ON */
  62. PMU_REGULATOR_LOWPOWER = 0x01 /*!< STOP mode with regulator in low power mode */
  63. } PMU_REGULATOR_T;
  64. /**
  65. * @brief PMU STOP mode entry
  66. */
  67. typedef enum
  68. {
  69. PMU_STOP_ENTRY_WFI = 0x01, /*!< Enter STOP mode with WFI instruction */
  70. PMU_STOP_ENTRY_WFE = 0x02 /*!< Enter STOP mode with WFE instruction */
  71. } PMU_STOP_ENTRY_T;
  72. /**
  73. * @brief PMU Regulator Voltage Scale
  74. */
  75. typedef enum
  76. {
  77. PMU_REGULATOR_VOLTAGE_SCALE1 = 0x03, /*!< Select regulator voltage scale 1 */
  78. PMU_REGULATOR_VOLTAGE_SCALE2 = 0x02, /*!< Select regulator voltage scale 2 */
  79. PMU_REGULATOR_VOLTAGE_SCALE3 = 0x01, /*!< Select regulator voltage scale 3 */
  80. } PMU_REGULATOR_VOLTAGE_SCALE_T;
  81. /**
  82. * @brief PMU Flag
  83. */
  84. typedef enum
  85. {
  86. PMU_FLAG_WUE, /*!< Wake Up flag */
  87. PMU_FLAG_SB, /*!< StandBy flag */
  88. PMU_FLAG_PVDO, /*!< PVD Output */
  89. PMU_FLAG_BKPR, /*!< Backup regulator ready flag */
  90. PMU_FLAG_VOSR /*!< This flag indicates that the Regulator voltage
  91. scaling output selection is ready */
  92. } PMU_FLAG_T;
  93. /**@} end of group PMU_Enumerations*/
  94. /** @defgroup PMU_Functions
  95. @{
  96. */
  97. /* PMU Reset */
  98. void PMU_Reset(void);
  99. /* Configuration and Operation modes */
  100. void PMU_EnableBackupAccess(void);
  101. void PMU_DisableBackupAccess(void);
  102. void PMU_EnablePVD(void);
  103. void PMU_DisablePVD(void);
  104. void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level);
  105. void PMU_EnableWakeUpPin(void);
  106. void PMU_DisableWakeUpPin(void);
  107. void PMU_EnableBackupRegulator(void);
  108. void PMU_DisableBackupRegulator(void);
  109. void PMU_ConfigMainRegulatorMode(PMU_REGULATOR_VOLTAGE_SCALE_T scale);
  110. void PMU_EnableFlashPowerDown(void);
  111. void PMU_DisableFlashPowerDown(void);
  112. void PMU_EnterSTOPMode(PMU_REGULATOR_T regulator, PMU_STOP_ENTRY_T entry);
  113. void PMU_EnterSTANDBYMode(void);
  114. /* flags */
  115. uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag);
  116. void PMU_ClearStatusFlag(PMU_FLAG_T flag);
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif /* __APM32F4XX_PMU_H */
  121. /**@} end of group PMU_Enumerations */
  122. /**@} end of group PMU_Driver */
  123. /**@} end of group APM32F4xx_StdPeriphDriver */