MG32F10x Standard Peripherals Firmware Library
Modules | Data Structures | Functions

UART driver modules. More...

Modules

 UART_Exported_Constants
 
 UART_Private_Functions
 

Data Structures

struct  UART_InitTypeDef
 UART Init Structure definition. More...
 

Functions

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

Detailed Description

UART driver modules.

Function Documentation

◆ UART_DeInit()

void UART_DeInit ( UART_TypeDef UARTx)

Deinitializes the UARTx peripheral registers to their default reset values.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
None

◆ UART_FIFOCmd()

void UART_FIFOCmd ( UART_TypeDef UARTx,
FunctionalState  NewState 
)

Enables or disables the UARTx's FIFO.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
NewStatenew state of the FIFO. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ UART_ForceBreakCmd()

void UART_ForceBreakCmd ( UART_TypeDef UARTx,
FunctionalState  NewState 
)

Force the serial out to spacing state or not.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
NewStatenew state of the Break control bit. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ UART_GetFlagStatus()

FlagStatus UART_GetFlagStatus ( UART_TypeDef UARTx,
uint32_t  UART_FLAG 
)

Checks whether the specified UART flag is set or not.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
UART_FLAGspecifies 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.
Returns
The new state of UART_FLAG (SET or RESET).

◆ UART_GetIntID()

uint8_t UART_GetIntID ( UART_TypeDef UARTx)

Get UARTx's Interrupt ID.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
Interrupt ID.

◆ UART_GetLineStatus()

uint32_t UART_GetLineStatus ( UART_TypeDef UARTx)

Get UARTx's Line status.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
UARTx's Line status.

◆ UART_GetModemStatus()

uint32_t UART_GetModemStatus ( UART_TypeDef UARTx)

Get UARTx's Modem Status.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
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.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
UART_InitStructpointer to a UART_InitTypeDef structure that contains the configuration information for the specified UART peripheral.
Returns
None

◆ UART_IrDACmd()

void UART_IrDACmd ( UART_TypeDef UARTx,
FunctionalState  NewState 
)

Enables or disables the UARTx's IrDA SIR Mode.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
NewStatenew state of the IrDA SIR Mode. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ UART_ITConfig()

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

Enables or disables the UARTx's interrupts.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
UART_ITspecifies 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
NewStatenew state of the interrupts. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ UART_LineStatusClearModeConfig()

void UART_LineStatusClearModeConfig ( UART_TypeDef UARTx,
uint8_t  Mode 
)

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

Note
This is applicable only for Overrun Error, Parity Error, Framing Error, and Break Interrupt status bits.
Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Modethe 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.
Returns
None

◆ UART_LoopBackModeCmd()

void UART_LoopBackModeCmd ( UART_TypeDef UARTx,
FunctionalState  NewState 
)

Enables or disables the UARTx's LoopBack Mode.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
NewStatenew state of the LoopBack Mode. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ UART_ModemForceRtsPinState()

void UART_ModemForceRtsPinState ( UART_TypeDef UARTx,
SignalState  NewState 
)

Control RTS Pin State.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
NewStatenew state of the RTS Pin State. This parameter can be: ACTIVE or INACTIVE.
Returns
None

◆ UART_ProgrammableTHREModeCmd()

void UART_ProgrammableTHREModeCmd ( UART_TypeDef UARTx,
FunctionalState  NewState 
)

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

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
NewStatenew state of the Programmable THRE Interrupt Mode. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ UART_ReadData()

uint16_t UART_ReadData ( UART_TypeDef UARTx)

Read data from RBR register or Rx FIFO.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
The received data

◆ UART_ResetRxFIFO()

void UART_ResetRxFIFO ( UART_TypeDef UARTx)

Reset the UART's Rx FIFO.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
None

◆ UART_ResetTxFIFO()

void UART_ResetTxFIFO ( UART_TypeDef UARTx)

Reset the UART's Tx FIFO.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Returns
None

◆ UART_RxFIFOThresholdConfig()

void UART_RxFIFOThresholdConfig ( UART_TypeDef UARTx,
uint8_t  Threshold 
)

Configure UARTx's Rx FIFO trigger threshold.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
ThresholdThis parameter can be one of the following values:
  • UART_RxFIFOThreshold_1
  • UART_RxFIFOThreshold_4
  • UART_RxFIFOThreshold_8
  • UART_RxFIFOThreshold_14
Returns
None

◆ UART_StructInit()

void UART_StructInit ( UART_InitTypeDef UART_InitStruct)

Fills each UART_InitStruct member with its default value.

Parameters
UART_InitStructpointer to a UART_InitTypeDef structure which will be initialized.
Returns
None

◆ UART_TxFIFOThresholdConfig()

void UART_TxFIFOThresholdConfig ( UART_TypeDef UARTx,
uint8_t  Threshold 
)

Configure UARTx's Tx FIFO trigger threshold.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
ThresholdThis parameter can be one of the following values:
  • UART_TxFIFOThreshold_0
  • UART_TxFIFOThreshold_2
  • UART_TxFIFOThreshold_4
  • UART_TxFIFOThreshold_8
Returns
None

◆ UART_WriteData()

void UART_WriteData ( UART_TypeDef UARTx,
uint16_t  Data 
)

Write data to THR register or Tx FIFO.

Parameters
UARTxPointer to selected UART peripheral. This parameter can be one of the following values: UART1, UART2, UART3.
Datathe data to write.
Returns
None