STM32G474xx HAL用户手册
stm32g4xx_hal_uart_ex.h
转到此文件的文档。
00001 /**
00002   ******************************************************************************
00003   * @file    stm32g4xx_hal_uart_ex.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of UART 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.
00016   *
00017   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32G4xx_HAL_UART_EX_H
00021 #define STM32G4xx_HAL_UART_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 UARTEx
00035   * @{
00036   */
00037 
00038 /* Exported types ------------------------------------------------------------*/
00039 /** @defgroup UARTEx_Exported_Types UARTEx 导出类型
00040   * @{
00041   */
00042 
00043 /**
00044   * @brief  UART从停止模式唤醒参数
00045   */
00046 typedef struct
00047 {
00048   uint32_t WakeUpEvent;        /*!< 指定哪个事件将激活从停止模式唤醒标志(WUF)。
00049                                     此参数可以是@ref UART_WakeUp_from_Stop_Selection的值。
00050                                     如果设置为UART_WAKEUP_ON_ADDRESS,则必须填充下面两个字段。 */
00051                                     */
00052 
00053   uint16_t AddressLength;      /*!< 指定地址是4位还是7位长。
00054                                     此参数可以是@ref UARTEx_WakeUp_Address_Length的值。  */
00055 
00056   uint8_t Address;             /*!< UART/USART节点地址(最大7位长)。 */
00057 } UART_WakeUpTypeDef;
00058 
00059 /**
00060   * @}
00061   */
00062 
00063 /* Exported constants --------------------------------------------------------*/
00064 /** @defgroup UARTEx_Exported_Constants UARTEx 导出常量
00065   * @{
00066   */
00067 
00068 /** @defgroup UARTEx_Word_Length UARTEx 字长
00069   * @{
00070   */
00071 #define UART_WORDLENGTH_7B          USART_CR1_M1   /*!< 7位长UART帧 */
00072 #define UART_WORDLENGTH_8B          0x00000000U    /*!< 8位长UART帧 */
00073 #define UART_WORDLENGTH_9B          USART_CR1_M0   /*!< 9位长UART帧 */
00074 /**
00075   * @}
00076   */
00077 
00078 /** @defgroup UARTEx_WakeUp_Address_Length UARTEx 唤醒地址长度
00079   * @{
00080   */
00081 #define UART_ADDRESS_DETECT_4B      0x00000000U      /*!< 4位长唤醒地址 */
00082 #define UART_ADDRESS_DETECT_7B      USART_CR2_ADDM7  /*!< 7位长唤醒地址 */
00083 /**
00084   * @}
00085   */
00086 
00087 /** @defgroup UARTEx_FIFO_mode UARTEx FIFO模式
00088   * @brief    UART FIFO模式
00089   * @{
00090   */
00091 #define UART_FIFOMODE_DISABLE       0x00000000U       /*!< 禁用FIFO模式 */
00092 #define UART_FIFOMODE_ENABLE        USART_CR1_FIFOEN  /*!< 使能FIFO模式  */
00093 /**
00094   * @}
00095   */
00096 
00097 /** @defgroup UARTEx_TXFIFO_threshold_level UARTEx TXFIFO阈值电平
00098   * @brief    UART TXFIFO阈值电平
00099   * @{
00100   */
00101 #define UART_TXFIFO_THRESHOLD_1_8   0x00000000U                               /*!< TX FIFO达到其深度的1/8 */
00102 #define UART_TXFIFO_THRESHOLD_1_4   USART_CR3_TXFTCFG_0                       /*!< TX FIFO达到其深度的1/4 */
00103 #define UART_TXFIFO_THRESHOLD_1_2   USART_CR3_TXFTCFG_1                       /*!< TX FIFO达到其深度的1/2 */
00104 #define UART_TXFIFO_THRESHOLD_3_4   (USART_CR3_TXFTCFG_0|USART_CR3_TXFTCFG_1) /*!< TX FIFO达到其深度的3/4 */
00105 #define UART_TXFIFO_THRESHOLD_7_8   USART_CR3_TXFTCFG_2                       /*!< TX FIFO达到其深度的7/8 */
00106 #define UART_TXFIFO_THRESHOLD_8_8   (USART_CR3_TXFTCFG_2|USART_CR3_TXFTCFG_0) /*!< TX FIFO变空            */
00107 /**
00108   * @}
00109   */
00110 
00111 /** @defgroup UARTEx_RXFIFO_threshold_level UARTEx RXFIFO阈值电平
00112   * @brief    UART RXFIFO阈值电平
00113   * @{
00114   */
00115 #define UART_RXFIFO_THRESHOLD_1_8   0x00000000U                               /*!< RX FIFO达到其深度的1/8 */
00116 #define UART_RXFIFO_THRESHOLD_1_4   USART_CR3_RXFTCFG_0                       /*!< RX FIFO达到其深度的1/4 */
00117 #define UART_RXFIFO_THRESHOLD_1_2   USART_CR3_RXFTCFG_1                       /*!< RX FIFO达到其深度的1/2 */
00118 #define UART_RXFIFO_THRESHOLD_3_4   (USART_CR3_RXFTCFG_0|USART_CR3_RXFTCFG_1) /*!< RX FIFO达到其深度的3/4 */
00119 #define UART_RXFIFO_THRESHOLD_7_8   USART_CR3_RXFTCFG_2                       /*!< RX FIFO达到其深度的7/8 */
00120 #define UART_RXFIFO_THRESHOLD_8_8   (USART_CR3_RXFTCFG_2|USART_CR3_RXFTCFG_0) /*!< RX FIFO变满             */
00121 /**
00122   * @}
00123   */
00124 
00125 /**
00126   * @}
00127   */
00128 
00129 /* Exported macros -----------------------------------------------------------*/
00130 /* Exported functions --------------------------------------------------------*/
00131 /** @addtogroup UARTEx_Exported_Functions
00132   * @{
00133   */
00134