STM32G474xx HAL用户手册
stm32g4xx_hal_pwr.h
转到该文件的文档。
00001 /**
00002   ******************************************************************************
00003   * @file    stm32g4xx_hal_pwr.h
00004   * @author  MCD Application Team
00005   * @brief   PWR HAL模块头文件。
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2019 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32G4xx_HAL_PWR_H
00021 #define STM32G4xx_HAL_PWR_H
00022 
00023 #ifdef __cplusplus
00024  extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32g4xx_hal_def.h"
00029 
00030 /** @addtogroup STM32G4xx_HAL_Driver
00031   * @{
00032   */
00033 
00034 /** @addtogroup PWR
00035   * @{
00036   */
00037 
00038 /* Exported types ------------------------------------------------------------*/
00039 
00040 /** @defgroup PWR_Exported_Types PWR导出的类型
00041   * @{
00042   */
00043 
00044 /**
00045   * @brief  PWR PVD配置结构体定义
00046   */
00047 typedef struct
00048 {
00049   uint32_t PVDLevel;   /*!< PVDLevel: 指定PVD检测电平。
00050                             此参数可以是@ref PWR_PVD_detection_level的值。 */
00051 
00052   uint32_t Mode;      /*!< Mode: 指定所选引脚的工作模式。
00053                            此参数可以是@ref PWR_PVD_Mode的值。 */
00054 }PWR_PVDTypeDef;
00055 
00056 
00057 /**
00058   * @}
00059   */
00060 
00061 /* Exported constants --------------------------------------------------------*/
00062 
00063 /** @defgroup PWR_Exported_Constants PWR导出的常量
00064   * @{
00065   */
00066 
00067 
00068 /** @defgroup PWR_PVD_detection_level 可编程电压检测电平
00069   * @{
00070   */
00071 #define PWR_PVDLEVEL_0                  PWR_CR2_PLS_LEV0  /*!< PVD阈值约2.0V */
00072 #define PWR_PVDLEVEL_1                  PWR_CR2_PLS_LEV1  /*!< PVD阈值约2.2V */
00073 #define PWR_PVDLEVEL_2                  PWR_CR2_PLS_LEV2  /*!< PVD阈值约2.4V */
00074 #define PWR_PVDLEVEL_3                  PWR_CR2_PLS_LEV3  /*!< PVD阈值约2.5V */
00075 #define PWR_PVDLEVEL_4                  PWR_CR2_PLS_LEV4  /*!< PVD阈值约2.6V */
00076 #define PWR_PVDLEVEL_5                  PWR_CR2_PLS_LEV5  /*!< PVD阈值约2.8V */
00077 #define PWR_PVDLEVEL_6                  PWR_CR2_PLS_LEV6  /*!< PVD阈值约2.9V */
00078 #define PWR_PVDLEVEL_7                  PWR_CR2_PLS_LEV7  /*!< 外部输入模拟电压(内部与VREFINT比较) */
00079 /**
00080   * @}
00081   */
00082 
00083 /** @defgroup PWR_PVD_Mode  PWR PVD中断和事件模式
00084   * @{
00085   */
00086 #define PWR_PVD_MODE_NORMAL                 ((uint32_t)0x00000000)   /*!< 使用基本模式 */
00087 #define PWR_PVD_MODE_IT_RISING              ((uint32_t)0x00010001)   /*!< 外部中断模式,上升沿触发检测 */
00088 #define PWR_PVD_MODE_IT_FALLING             ((uint32_t)0x00010002)   /*!< 外部中断模式,下降沿触发检测 */
00089 #define PWR_PVD_MODE_IT_RISING_FALLING      ((uint32_t)0x00010003)   /*!< 外部中断模式,上升/下降沿触发检测 */
00090 #define PWR_PVD_MODE_EVENT_RISING           ((uint32_t)0x00020001)   /*!< 事件模式,上升沿触发检测 */
00091 #define PWR_PVD_MODE_EVENT_FALLING          ((uint32_t)0x00020002)   /*!< 事件模式,下降沿触发检测 */
00092 #define PWR_PVD_MODE_EVENT_RISING_FALLING   ((uint32_t)0x00020003)   /*!< 事件模式,上升/下降沿触发检测 */
00093 /**
00094   * @}
00095   */
00096 
00097 
00098 
00099 
00100 /** @defgroup PWR_Regulator_state_in_SLEEP_STOP_mode  PWR稳压器模式
00101   * @{
00102   */
00103 #define PWR_MAINREGULATOR_ON            ((uint32_t)0x00000000) /*!< 稳压器处于主模式      */
00104 #define PWR_LOWPOWERREGULATOR_ON        PWR_CR1_LPR            /*!< 稳压器处于低功耗模式 */
00105 /**
00106   * @}
00107   */
00108 
00109 /** @defgroup PWR_SLEEP_mode_entry  PWR SLEEP模式入口
00110   * @{
00111   */
00112 #define PWR_SLEEPENTRY_WFI              ((uint8_t)0x01)        /*!< 等待中断指令进入睡眠模式 */
00113 #define PWR_SLEEPENTRY_WFE              ((uint8_t)0x02)        /*!< 等待事件指令进入睡眠模式        */
00114 /**
00115   * @}
00116   */
00117 
00118 /** @defgroup PWR_STOP_mode_entry  PWR STOP模式入口
00119   * @{
00120   */
00121 #define PWR_STOPENTRY_WFI               ((uint8_t)0x01)       /*!< 等待中断指令进入停止模式 */
00122 #define PWR_STOPENTRY_WFE               ((uint8_t)0x02)       /*!< 等待事件指令进入停止模式        */
00123 /**
00124   * @}
00125   */
00126 
00127 
00128 /** @defgroup PWR_PVD_EXTI_LINE  PWR PVD外部中断线
00129   * @{
00130   */
00131 #define PWR_EXTI_LINE_PVD  ((uint32_t)0x00010000)   /*!< 外部中断线16连接到PVD EXTI线 */
00132 /**
00133   * @}
00134   */
00135 
00136 /** @defgroup PWR_PVD_EVENT_LINE  PWR PVD事件线
00137   * @{
00138   */
00139 #define PWR_EVENT_LINE_PVD  ((uint32_t)0x00010000)  /*!< 事件线16连接到PVD事件线 */
00140 /**
00141   * @}
00142   */
00143 
00144 /**
00145   * @}
00146   */
00147 
00148 /* Exported macros -----------------------------------------------------------*/
00149 /** @defgroup PWR_Exported_Macros  PWR导出的宏
00150   * @{
00151   */
00152 
00153 /** @brief  检查是否设置了特定的PWR标志。
00154   * @param  __FLAG__: 指定要检查的标志。
00155   *           此参数可以是以下值之一:
00156   *            @arg @ref PWR_FLAG_WUF1 唤醒标志1。表示从WKUP引脚1接收到唤醒事件。
00157   *            @arg @ref PWR_FLAG_WUF2 唤醒标志2。表示从WKUP引脚2接收到唤醒事件。
00158   *            @arg @ref PWR_FLAG_WUF3 唤醒标志3。表示从WKUP引脚3接收到唤醒事件。
00159   *            @arg @ref PWR_FLAG_WUF4 唤醒标志4。表示从WKUP引脚4接收到唤醒事件。
00160   *            @arg @ref PWR_FLAG_WUF5 唤醒标志5。表示从WKUP引脚5接收到唤醒事件。
00161   *            @arg @ref PWR_FLAG_SB 待机标志。表示系统进入了待机模式。
00162   *            @arg @ref PWR_FLAG_WUFI 唤醒标志内部。当在内置唤醒线上检测到唤醒时设置。
00163   *            @arg @ref PWR_FLAG_REGLPS 低功耗稳压器已启动。表示低功耗稳压器是否就绪。
00164   *            @arg @ref PWR_FLAG_REGLPF 低功耗稳压器标志。表示稳压器是在主模式下就绪还是处于低功耗模式。
00165   *            @arg @ref PWR_FLAG_VOSF 电压调节标志。表示稳压器在所选电压范围内是否就绪或仍在变化到所需电压电平。
00166   *            @arg @ref PWR_FLAG_PVDO 电源电压检测器输出。表示VDD电压是低于还是高于所选的PVD阈值。