ch32v30x_pwr.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : ch32v30x_pwr.h
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2021/06/06
  6. * Description : This file contains all the functions prototypes for the PWR
  7. * firmware library.
  8. *********************************************************************************
  9. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  10. * Attention: This software (modified or not) and binary are used for
  11. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
  12. *******************************************************************************/
  13. #ifndef __CH32V30x_PWR_H
  14. #define __CH32V30x_PWR_H
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "ch32v30x.h"
  19. /* PVD_detection_level */
  20. #define PWR_PVDLevel_MODE0 ((uint32_t)0x00000000)
  21. #define PWR_PVDLevel_MODE1 ((uint32_t)0x00000020)
  22. #define PWR_PVDLevel_MODE2 ((uint32_t)0x00000040)
  23. #define PWR_PVDLevel_MODE3 ((uint32_t)0x00000060)
  24. #define PWR_PVDLevel_MODE4 ((uint32_t)0x00000080)
  25. #define PWR_PVDLevel_MODE5 ((uint32_t)0x000000A0)
  26. #define PWR_PVDLevel_MODE6 ((uint32_t)0x000000C0)
  27. #define PWR_PVDLevel_MODE7 ((uint32_t)0x000000E0)
  28. #define PWR_PVDLevel_2V2 PWR_PVDLevel_MODE0
  29. #define PWR_PVDLevel_2V3 PWR_PVDLevel_MODE1
  30. #define PWR_PVDLevel_2V4 PWR_PVDLevel_MODE2
  31. #define PWR_PVDLevel_2V5 PWR_PVDLevel_MODE3
  32. #define PWR_PVDLevel_2V6 PWR_PVDLevel_MODE4
  33. #define PWR_PVDLevel_2V7 PWR_PVDLevel_MODE5
  34. #define PWR_PVDLevel_2V8 PWR_PVDLevel_MODE6
  35. #define PWR_PVDLevel_2V9 PWR_PVDLevel_MODE7
  36. /* Regulator_state_is_STOP_mode */
  37. #define PWR_Regulator_ON ((uint32_t)0x00000000)
  38. #define PWR_Regulator_LowPower ((uint32_t)0x00000001)
  39. /* STOP_mode_entry */
  40. #define PWR_STOPEntry_WFI ((uint8_t)0x01)
  41. #define PWR_STOPEntry_WFE ((uint8_t)0x02)
  42. /* PWR_Flag */
  43. #define PWR_FLAG_WU ((uint32_t)0x00000001)
  44. #define PWR_FLAG_SB ((uint32_t)0x00000002)
  45. #define PWR_FLAG_PVDO ((uint32_t)0x00000004)
  46. void PWR_DeInit(void);
  47. void PWR_BackupAccessCmd(FunctionalState NewState);
  48. void PWR_PVDCmd(FunctionalState NewState);
  49. void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
  50. void PWR_WakeUpPinCmd(FunctionalState NewState);
  51. void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
  52. void PWR_EnterSTANDBYMode(void);
  53. FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
  54. void PWR_ClearFlag(uint32_t PWR_FLAG);
  55. void PWR_EnterSTANDBYMode_RAM(void);
  56. void PWR_EnterSTANDBYMode_RAM_LV(void);
  57. void PWR_EnterSTANDBYMode_RAM_VBAT_EN(void);
  58. void PWR_EnterSTANDBYMode_RAM_LV_VBAT_EN(void);
  59. void PWR_EnterSTOPMode_RAM_LV(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif