apm32f10x_pmu.h 2.9 KB
Newer Older
A
abbcc 已提交
1
/*!
2
 * @file        apm32f10x_pmu.h
A
abbcc 已提交
3
 *
4
 * @brief       This file contains all the functions prototypes for the PMU firmware library.
A
abbcc 已提交
5
 *
6
 * @version     V1.0.2
A
abbcc 已提交
7
 *
8
 * @date        2022-01-05
A
abbcc 已提交
9
 *
10 11 12 13 14 15 16 17 18 19 20 21 22 23
 * @attention
 *
 *  Copyright (C) 2020-2022 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be usefull and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
A
abbcc 已提交
24 25 26 27 28 29
 */

#ifndef __APM32F10X_PMU_H
#define __APM32F10X_PMU_H

#ifdef __cplusplus
30
  extern "C" {
A
abbcc 已提交
31 32
#endif

33 34
#include "apm32f10x.h"

A
abbcc 已提交
35 36 37 38 39 40 41 42 43 44 45 46
/** @addtogroup Peripherals_Library Standard Peripheral Library
  @{
*/

/** @addtogroup PMU_Driver PMU Driver
  @{
*/

/** @addtogroup PMU_Enumerations Enumerations
  @{
*/

47 48 49
/**
 * @brief PMU PVD detection level
 */
A
abbcc 已提交
50 51 52 53 54 55 56 57 58 59 60 61
typedef enum
{
    PMU_PVD_LEVEL_2V2    = 0x00,    //!< PVD detection level set to 2.2V
    PMU_PVD_LEVEL_2V3    = 0x01,    //!< PVD detection level set to 2.3V
    PMU_PVD_LEVEL_2V4    = 0x02,    //!< PVD detection level set to 2.4V
    PMU_PVD_LEVEL_2V5    = 0x03,    //!< PVD detection level set to 2.5V
    PMU_PVD_LEVEL_2V6    = 0x04,    //!< PVD detection level set to 2.6V
    PMU_PVD_LEVEL_2V7    = 0x05,    //!< PVD detection level set to 2.7V
    PMU_PVD_LEVEL_2V8    = 0x06,    //!< PVD detection level set to 2.8V
    PMU_PVD_LEVEL_2V9    = 0x07,    //!< PVD detection level set to 2.9V
} PMU_PVD_LEVEL_T;

62 63 64
/**
 * @brief PMU Regulator state in STOP mode
 */
A
abbcc 已提交
65 66 67 68 69 70
typedef enum
{
    PMU_REGULATOR_ON       = 0x00,
    PMU_REGULATOR_LOWPOWER = 0x01
} PMU_REGULATOR_T;

71 72 73
/**
 * @brief PMU STOP mode entry
 */
A
abbcc 已提交
74 75 76 77 78 79
typedef enum
{
    PMU_STOP_ENTRY_WFI     = 0x01,
    PMU_STOP_ENTRY_WFE     = 0x02
} PMU_STOP_ENTRY_T;

80 81 82
/**
 * @brief PMU Flag
 */
A
abbcc 已提交
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
typedef enum
{
    PMU_FLAG_WUE,
    PMU_FLAG_SB,
    PMU_FLAG_PVDO
} PMU_FLAG_T;

/**@} end of group PMU_Enumerations*/


/** @addtogroup PMU_Fuctions Fuctions
  @{
*/

/** PMU Reset */
void PMU_Reset(void);

/** Configuration and Operation modes */
void PMU_EnableBackupAccess(void);
void PMU_DisableBackupAccess(void);
void PMU_EnablePVD(void);
void PMU_DisablePVD(void);
void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level);
void PMU_EnableWakeUpPin(void);
void PMU_DisableWakeUpPin(void);
void PMU_EnterSTOPMode(PMU_REGULATOR_T regulator, PMU_STOP_ENTRY_T entry);
void PMU_EnterSTANDBYMode(void);

/** flags */
uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag);
void PMU_ClearStatusFlag(PMU_FLAG_T flag);

/**@} end of group PMU_Fuctions*/
116
/**@} end of group PMU_Driver*/
A
abbcc 已提交
117 118 119 120 121 122 123
/**@} end of group Peripherals_Library*/

#ifdef __cplusplus
}
#endif

#endif /* __APM32F10X_PMU_H */