MG32F10x Standard Peripherals Firmware Library

函数
UART_Private_Functions
MG32F10x_StdPeriph_Driver » UART

## 函数
void | UART_DeInit (UART_TypeDef *UARTx)
| Deinitializes the UARTx peripheral registers to their default reset values. 更多...
void | UART_Init (UART_TypeDef *UARTx, UART_InitTypeDef *UART_InitStruct)
| Initializes the UARTx peripheral according to the specified parameters in the UART_InitStruct. 更多...
void | UART_StructInit (UART_InitTypeDef *UART_InitStruct)
| Fills each UART_InitStruct member with its default value. 更多...
void | UART_WriteData (UART_TypeDef *UARTx, uint16_t Data)
| Write data to THR register or Tx FIFO. 更多...
uint16_t | UART_ReadData (UART_TypeDef *UARTx)
| Read data from RBR register or Rx FIFO. 更多...
void | UART_RxFIFOThresholdConfig (UART_TypeDef *UARTx, uint8_t Threshold)
| Configure UARTx's Rx FIFO trigger threshold. 更多...
void | UART_TxFIFOThresholdConfig (UART_TypeDef *UARTx, uint8_t Threshold)
| Configure UARTx's Tx FIFO trigger threshold. 更多...
void | UART_FIFOCmd (UART_TypeDef *UARTx, FunctionalState NewState)
| Enables or disables the UARTx's FIFO. 更多...
void | UART_ResetRxFIFO (UART_TypeDef *UARTx)
| Reset the UART's Rx FIFO. 更多...
void | UART_ResetTxFIFO (UART_TypeDef *UARTx)
| Reset the UART's Tx FIFO. 更多...
void | UART_ForceBreakCmd (UART_TypeDef *UARTx, FunctionalState NewState)
| Force the serial out to spacing state or not. 更多...
void | UART_IrDACmd (UART_TypeDef *UARTx, FunctionalState NewState)
| Enables or disables the UARTx's IrDA SIR Mode. 更多...
void | UART_ProgrammableTHREModeCmd (UART_TypeDef *UARTx, FunctionalState NewState)
| Enables or disables the UARTx's Programmable THRE Interrupt Mode. 更多...
void | UART_LineStatusClearModeConfig (UART_TypeDef *UARTx, uint8_t Mode)
| Select the method for clearing the status in the LSR register. 更多...
void | UART_ITConfig (UART_TypeDef *UARTx, uint8_t UART_IT, FunctionalState NewState)
| Enables or disables the UARTx's interrupts. 更多...
uint8_t | UART_GetIntID (UART_TypeDef *UARTx)
| Get UARTx's Interrupt ID. 更多...
FlagStatus | UART_GetFlagStatus (UART_TypeDef *UARTx, uint32_t UART_FLAG)
| Checks whether the specified UART flag is set or not. 更多...
uint32_t | UART_GetLineStatus (UART_TypeDef *UARTx)
| Get UARTx's Line status. 更多...
uint32_t | UART_GetModemStatus (UART_TypeDef *UARTx)
| Get UARTx's Modem Status. 更多...
void | UART_LoopBackModeCmd (UART_TypeDef *UARTx, FunctionalState NewState)
| Enables or disables the UARTx's LoopBack Mode. 更多...
void | UART_ModemForceRtsPinState (UART_TypeDef *UARTx, SignalState NewState)
| Control RTS Pin State. 更多...

## 详细描述

## 函数说明

## ◆ UART_DeInit()

void UART_DeInit | ( | UART_TypeDef * | UARTx | ) |

Deinitializes the UARTx peripheral registers to their default reset values.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  None

## ◆ UART_FIFOCmd()

void UART_FIFOCmd | ( | UART_TypeDef * | UARTx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the UARTx's FIFO.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  NewState | new state of the FIFO. This parameter can be: ENABLE or DISABLE.

返回
  None

## ◆ UART_ForceBreakCmd()

void UART_ForceBreakCmd | ( | UART_TypeDef * | UARTx,
|  | FunctionalState | NewState
| ) |  |

Force the serial out to spacing state or not.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  NewState | new state of the Break control bit. This parameter can be: ENABLE or DISABLE.

返回
  None

## ◆ UART_GetFlagStatus()

FlagStatus UART_GetFlagStatus | ( | UART_TypeDef * | UARTx,
|  | uint32_t | UART_FLAG
| ) |  |

Checks whether the specified UART flag is set or not.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  UART_FLAG | specifies the flag to check. This parameter can be one of the following values: UART_FLAG_BUSY: Busy flag. UART_FLAG_TFNF: Transmit FIFO Not Full flag. UART_FLAG_TFE: Transmit FIFO Empty flag. UART_FLAG_RFNE: Receive FIFO Not Empty flag. UART_FLAG_RFF: Receive FIFO Full flag.

返回
  The new state of UART_FLAG (SET or RESET).

## ◆ UART_GetIntID()

uint8_t UART_GetIntID | ( | UART_TypeDef * | UARTx | ) |

Get UARTx's Interrupt ID.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  Interrupt ID.

## ◆ UART_GetLineStatus()

uint32_t UART_GetLineStatus | ( | UART_TypeDef * | UARTx | ) |

Get UARTx's Line status.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  UARTx's Line status.

## ◆ UART_GetModemStatus()

uint32_t UART_GetModemStatus | ( | UART_TypeDef * | UARTx | ) |

Get UARTx's Modem Status.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  UARTx's Modem Status.

## ◆ UART_Init()

void UART_Init | ( | UART_TypeDef * | UARTx,
|  | UART_InitTypeDef * | UART_InitStruct
| ) |  |

Initializes the UARTx peripheral according to the specified parameters in the UART_InitStruct.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  UART_InitStruct | pointer to a UART_InitTypeDef structure that contains the configuration information for the specified UART peripheral.

返回
  None

## ◆ UART_IrDACmd()

void UART_IrDACmd | ( | UART_TypeDef * | UARTx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the UARTx's IrDA SIR Mode.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  NewState | new state of the IrDA SIR Mode. This parameter can be: ENABLE or DISABLE.

返回
  None

## ◆ UART_ITConfig()

void UART_ITConfig | ( | UART_TypeDef * | UARTx,
|  | uint8_t | UART_IT,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the UARTx's interrupts.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  UART_IT | specifies the UART interrupt sources to be enabled or disabled. This parameter can be a combination of the following values: UART_IT_RDA UART_IT_THRE UART_IT_RLS UART_IT_MSI
  NewState | new state of the interrupts. This parameter can be: ENABLE or DISABLE.

返回
  None

## ◆ UART_LineStatusClearModeConfig()

void UART_LineStatusClearModeConfig | ( | UART_TypeDef * | UARTx,
|  | uint8_t | Mode
| ) |  |

Select the method for clearing the status in the LSR register.

注解
  This is applicable only for Overrun Error, Parity Error, Framing Error, and Break Interrupt status bits.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  Mode | the method for clearing the status in the LSR register. This parameter can be: 0 or 1. 0: LSR status bits are cleared either on reading Rx FIFO (RBR Read) or on reading LSR register. 1: LSR status bits are cleared only on reading LSR register.

返回
  None

## ◆ UART_LoopBackModeCmd()

void UART_LoopBackModeCmd | ( | UART_TypeDef * | UARTx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the UARTx's LoopBack Mode.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  NewState | new state of the LoopBack Mode. This parameter can be: ENABLE or DISABLE.

返回
  None

## ◆ UART_ModemForceRtsPinState()

void UART_ModemForceRtsPinState | ( | UART_TypeDef * | UARTx,
|  | SignalState | NewState
| ) |  |

Control RTS Pin State.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  NewState | new state of the RTS Pin State. This parameter can be: ACTIVE or INACTIVE.

返回
  None

## ◆ UART_ProgrammableTHREModeCmd()

void UART_ProgrammableTHREModeCmd | ( | UART_TypeDef * | UARTx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the UARTx's Programmable THRE Interrupt Mode.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  NewState | new state of the Programmable THRE Interrupt Mode. This parameter can be: ENABLE or DISABLE.

返回
  None

## ◆ UART_ReadData()

uint16_t UART_ReadData | ( | UART_TypeDef * | UARTx | ) |

Read data from RBR register or Rx FIFO.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  The received data

## ◆ UART_ResetRxFIFO()

void UART_ResetRxFIFO | ( | UART_TypeDef * | UARTx | ) |

Reset the UART's Rx FIFO.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  None

## ◆ UART_ResetTxFIFO()

void UART_ResetTxFIFO | ( | UART_TypeDef * | UARTx | ) |

Reset the UART's Tx FIFO.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.

返回
  None

## ◆ UART_RxFIFOThresholdConfig()

void UART_RxFIFOThresholdConfig | ( | UART_TypeDef * | UARTx,
|  | uint8_t | Threshold
| ) |  |

Configure UARTx's Rx FIFO trigger threshold.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  Threshold | This parameter can be one of the following values: UART_RxFIFOThreshold_1 UART_RxFIFOThreshold_4 UART_RxFIFOThreshold_8 UART_RxFIFOThreshold_14

返回
  None

## ◆ UART_StructInit()

void UART_StructInit | ( | UART_InitTypeDef * | UART_InitStruct | ) |

Fills each UART_InitStruct member with its default value.

参数

  UART_InitStruct | pointer to a UART_InitTypeDef structure which will be initialized.

返回
  None

## ◆ UART_TxFIFOThresholdConfig()

void UART_TxFIFOThresholdConfig | ( | UART_TypeDef * | UARTx,
|  | uint8_t | Threshold
| ) |  |

Configure UARTx's Tx FIFO trigger threshold.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  Threshold | This parameter can be one of the following values: UART_TxFIFOThreshold_0 UART_TxFIFOThreshold_2 UART_TxFIFOThreshold_4 UART_TxFIFOThreshold_8

返回
  None

## ◆ UART_WriteData()

void UART_WriteData | ( | UART_TypeDef * | UARTx,
|  | uint16_t | Data
| ) |  |

Write data to THR register or Tx FIFO.

参数

  UARTx | Pointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
  Data | the data to write.

返回
  None