|
STM32G474xx HAL用户手册
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_hal_pwr_ex.h 00004 * @author MCD Application Team 00005 * @brief Header file of PWR HAL Extended module. 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_EX_H 00021 #define STM32G4xx_HAL_PWR_EX_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 PWREx 00035 * @{ 00036 */ 00037 00038 00039 /* Exported types ------------------------------------------------------------*/ 00040 00041 /** @defgroup PWREx_Exported_Types PWR Extended Exported Types 00042 * @{ 00043 */ 00044 00045 00046 /** 00047 * @brief PWR PVM configuration structure definition 00048 */ 00049 typedef struct 00050 { 00051 uint32_t PVMType; /*!< PVMType: Specifies which voltage is monitored and against which threshold. 00052 This parameter can be a value of @ref PWREx_PVM_Type. */ 00053 uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins. 00054 This parameter can be a value of @ref PWREx_PVM_Mode. */ 00055 }PWR_PVMTypeDef; 00056 00057 /** 00058 * @} 00059 */ 00060 00061 /* Exported constants --------------------------------------------------------*/ 00062 00063 /** @defgroup PWREx_Exported_Constants PWR Extended Exported Constants 00064 * @{ 00065 */ 00066 00067 /** @defgroup PWREx_WUP_Polarity Shift to apply to retrieve polarity information from PWR_WAKEUP_PINy_xxx constants 00068 * @{ 00069 */ 00070 #define PWR_WUP_POLARITY_SHIFT 0x05U /*!< Internal constant used to retrieve wakeup pin polariry */ 00071 /** 00072 * @} 00073 */ 00074 00075 00076 /** @defgroup PWREx_WakeUp_Pins PWR wake-up pins 00077 * @{ 00078 */ 00079 #define PWR_WAKEUP_PIN1 PWR_CR3_EWUP1 /*!< Wakeup pin 1 (with high level polarity) */ 00080 #define PWR_WAKEUP_PIN2 PWR_CR3_EWUP2 /*!< Wakeup pin 2 (with high level polarity) */ 00081 #define PWR_WAKEUP_PIN3 PWR_CR3_EWUP3 /*!< Wakeup pin 3 (with high level polarity) */ 00082 #define PWR_WAKEUP_PIN4 PWR_CR3_EWUP4 /*!< Wakeup pin 4 (with high level polarity) */ 00083 #define PWR_WAKEUP_PIN5 PWR_CR3_EWUP5 /*!< Wakeup pin 5 (with high level polarity) */ 00084 #define PWR_WAKEUP_PIN1_HIGH PWR_CR3_EWUP1 /*!< Wakeup pin 1 (with high level polarity) */ 00085 #define PWR_WAKEUP_PIN2_HIGH PWR_CR3_EWUP2 /*!< Wakeup pin 2 (with high level polarity) */ 00086 #define PWR_WAKEUP_PIN3_HIGH PWR_CR3_EWUP3 /*!< Wakeup pin 3 (with high level polarity) */ 00087 #define PWR_WAKEUP_PIN4_HIGH PWR_CR3_EWUP4 /*!< Wakeup pin 4 (with high level polarity) */ 00088 #define PWR_WAKEUP_PIN5_HIGH PWR_CR3_EWUP5 /*!< Wakeup pin 5 (with high level polarity) */ 00089 #define PWR_WAKEUP_PIN1_LOW (uint32_t)((PWR_CR4_WP1<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP1) /*!< Wakeup pin 1 (with low level polarity) */ 00090 #define PWR_WAKEUP_PIN2_LOW (uint32_t)((PWR_CR4_WP2<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP2) /*!< Wakeup pin 2 (with low level polarity) */ 00091 #define PWR_WAKEUP_PIN3_LOW (uint32_t)((PWR_CR4_WP3<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP3) /*!< Wakeup pin 3 (with low level polarity) */ 00092 #define PWR_WAKEUP_PIN4_LOW (uint32_t)((PWR_CR4_WP4<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP4) /*!< Wakeup pin 4 (with low level polarity) */ 00093 #define PWR_WAKEUP_PIN5_LOW (uint32_t)((PWR_CR4_WP5<<PWR_WUP_POLARITY_SHIFT) | PWR_CR3_EWUP5) /*!< Wakeup pin 5 (with low level polarity) */ 00094 /** 00095 * @} 00096 */ 00097 00098 /** @defgroup PWREx_PVM_Type Peripheral Voltage Monitoring type 00099 * @{ 00100 */ 00101 #if defined(PWR_CR2_PVME1) 00102 #define PWR_PVM_1 PWR_CR2_PVME1 /*!< Peripheral Voltage Monitoring 1 enable: VDDUSB versus 1.2 V (applicable when USB feature is supported) */ 00103 #endif /* PWR_CR2_PVME1 */ 00104 #if defined(PWR_CR2_PVME2) 00105 #define PWR_PVM_2 PWR_CR2_PVME2 /*!< Peripheral Voltage Monitoring 2 enable: VDDIO2 versus 0.9 V (applicable when VDDIO2 is present on device) */ 00106 #endif /* PWR_CR2_PVME2 */ 00107 #define PWR_PVM_3 PWR_CR2_PVME3 /*!< Peripheral Voltage Monitoring 3 enable: VDDA versus 1.62 V */ 00108 #define PWR_PVM_4 PWR_CR2_PVME4 /*!< Peripheral Voltage Monitoring 4 enable: VDDA versus 2.2 V */ 00109 /** 00110 * @} 00111 */ 00112 00113 /** @defgroup PWREx_PVM_Mode PWR PVM interrupt and event mode 00114 * @{ 00115 */ 00116 #define PWR_PVM_MODE_NORMAL 0x00000000U /*!< basic mode is used */ 00117 #define PWR_PVM_MODE_IT_RISING 0x00010001U /*!< External Interrupt Mode with Rising edge trigger detection */ 00118 #define PWR_PVM_MODE_IT_FALLING 0x00010002U /*!< External Interrupt Mode with Falling edge trigger detection */ 00119 #define PWR_PVM_MODE_IT_RISING_FALLING 0x00010003U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ 00120 #define PWR_PVM_MODE_EVENT_RISING 0x00020001U /*!< Event Mode with Rising edge trigger detection */ 00121 #define PWR_PVM_MODE_EVENT_FALLING 0x00020002U /*!< Event Mode with Falling edge trigger detection */ 00122 #define PWR_PVM_MODE_EVENT_RISING_FALLING 0x00020003U /*!< Event Mode with Rising/Falling edge trigger detection */ 00123 /** 00124 * @} 00125 */ 00126 00127 00128 00129 /** @defgroup PWREx_Regulator_Voltage_Scale PWR Regulator voltage scale 00130 * @{ 00131 */ 00132 #if defined(PWR_CR5_R1MODE) 00133 #define PWR_REGULATOR_VOLTAGE_SCALE1_BOOST ((uint32_t)0x00000000) /*!< Voltage scaling range 1 boost mode */ 00134 #endif /*PWR_CR5_R1MODE */ 00135 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR1_VOS_0 /*!< Voltage scaling range 1 normal mode */ 00136 #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR1_VOS_1 /*!< Voltage scaling range 2 */ 00137 /** 00138 * @} 00139 */ 00140 00141 00142 /** @defgroup PWREx_VBAT_Battery_Charging_Selection PWR battery charging resistor selection 00143 * @{ 00144 */ 00145 #define PWR_BATTERY_CHARGING_RESISTOR_5 0x00000000U /*!< VBAT charging through a 5 kOhms resistor */ 00146 #define PWR_BATTERY_CHARGING_RESISTOR_1_5 PWR_CR4_VBRS /*!< VBAT charging through a 1.5 kOhms resistor */ 00147 /**