Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

UART Exported Functions

UART Exported Functions
[UART Driver]

Functions

__STATIC_INLINE void UART_CLEAR_RTS (UART_T *uart)
 Set RTS pin to low.
__STATIC_INLINE void UART_SET_RTS (UART_T *uart)
 Set RTS pin to high.
void UART_ClearIntFlag (UART_T *uart, uint32_t u32InterruptFlag)
 Clear UART specified interrupt flag.
void UART_Close (UART_T *uart)
 Disable UART interrupt.
void UART_DisableFlowCtrl (UART_T *uart)
 Disable UART auto flow control function.
void UART_DisableInt (UART_T *uart, uint32_t u32InterruptFlag)
 Disable UART specified interrupt.
void UART_EnableFlowCtrl (UART_T *uart)
 Enable UART auto flow control function.
void UART_EnableInt (UART_T *uart, uint32_t u32InterruptFlag)
 The function is used to enable UART specified interrupt and enable NVIC UART IRQ.
void UART_Open (UART_T *uart, uint32_t u32baudrate)
 Open and set UART function.
uint32_t UART_Read (UART_T *uart, uint8_t pu8RxBuf[], uint32_t u32ReadBytes)
 Read UART data.
void UART_SetLineConfig (UART_T *uart, uint32_t u32baudrate, uint32_t u32data_width, uint32_t u32parity, uint32_t u32stop_bits)
 Set UART line configuration.
void UART_SetTimeoutCnt (UART_T *uart, uint32_t u32TOC)
 Set Rx timeout count.
void UART_SelectIrDAMode (UART_T *uart, uint32_t u32Buadrate, uint32_t u32Direction)
 Select and configure IrDA function.
void UART_SelectRS485Mode (UART_T *uart, uint32_t u32Mode, uint32_t u32Addr)
 Select and configure RS485 function.
void UART_SelectLINMode (UART_T *uart, uint32_t u32Mode, uint32_t u32BreakLength)
 Select and configure LIN function.
uint32_t UART_Write (UART_T *uart, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
 Write UART data.

Function Documentation

__STATIC_INLINE void UART_CLEAR_RTS ( UART_T *  uart )

Set RTS pin to low.

Parameters:
[in]uartThe pointer of the specified UART module
Returns:
None

This macro set RTS pin to low.

Definition at line 449 of file m480_uart.h.

void UART_ClearIntFlag ( UART_T *  uart,
uint32_t  u32InterruptFlag 
)

Clear UART specified interrupt flag.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32InterruptFlagThe specified interrupt of UART module.

  • UART_INTSTS_LININT_Msk : LIN bus interrupt
  • UART_INTEN_WKIEN_Msk : Wake-up interrupt
  • UART_INTSTS_BUFERRINT_Msk : Buffer Error interrupt
  • UART_INTSTS_MODEMINT_Msk : Modem Status interrupt
  • UART_INTSTS_RLSINT_Msk : Receive Line Status interrupt
Returns:
None

The function is used to clear UART specified interrupt flag.

Definition at line 62 of file m480_uart.c.

void UART_Close ( UART_T *  uart )

Disable UART interrupt.

Parameters:
[in]uartThe pointer of the specified UART module.
Returns:
None

The function is used to disable UART interrupt.

Definition at line 102 of file m480_uart.c.

void UART_DisableFlowCtrl ( UART_T *  uart )

Disable UART auto flow control function.

Parameters:
[in]uartThe pointer of the specified UART module.
Returns:
None

The function is used to disable UART auto flow control.

Definition at line 117 of file m480_uart.c.

void UART_DisableInt ( UART_T *  uart,
uint32_t  u32InterruptFlag 
)

Disable UART specified interrupt.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32InterruptFlagThe specified interrupt of UART module.

  • UART_INTEN_WKIEN_Msk : Wake-up interrupt
  • UART_INTEN_LINIEN_Msk : Lin bus interrupt
  • UART_INTEN_BUFERRIEN_Msk : Buffer Error interrupt
  • UART_INTEN_RXTOIEN_Msk : Rx time-out interrupt
  • UART_INTEN_MODEMIEN_Msk : Modem status interrupt
  • UART_INTEN_RLSIEN_Msk : Receive Line status interrupt
  • UART_INTEN_THREIEN_Msk : Tx empty interrupt
  • UART_INTEN_RDAIEN_Msk : Rx ready interrupt *
Returns:
None

The function is used to disable UART specified interrupt and disable NVIC UART IRQ.

Definition at line 141 of file m480_uart.c.

void UART_EnableFlowCtrl ( UART_T *  uart )

Enable UART auto flow control function.

Parameters:
[in]uartThe pointer of the specified UART module.
Returns:
None

The function is used to Enable UART auto flow control.

Definition at line 157 of file m480_uart.c.

void UART_EnableInt ( UART_T *  uart,
uint32_t  u32InterruptFlag 
)

The function is used to enable UART specified interrupt and enable NVIC UART IRQ.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32InterruptFlagThe specified interrupt of UART module:

  • UART_INTEN_WKIEN_Msk : Wake-up interrupt
  • UART_INTEN_LINIEN_Msk : Lin bus interrupt
  • UART_INTEN_BUFERRIEN_Msk : Buffer Error interrupt
  • UART_INTEN_RXTOIEN_Msk : Rx time-out interrupt
  • UART_INTEN_MODEMIEN_Msk : Modem status interrupt
  • UART_INTEN_RLSIEN_Msk : Receive Line status interrupt
  • UART_INTEN_THREIEN_Msk : Tx empty interrupt
  • UART_INTEN_RDAIEN_Msk : Rx ready interrupt *
Returns:
None

The function is used to enable UART specified interrupt and enable NVIC UART IRQ.

Definition at line 186 of file m480_uart.c.

void UART_Open ( UART_T *  uart,
uint32_t  u32baudrate 
)

Open and set UART function.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32baudrateThe baudrate of UART module.
Returns:
None

This function use to enable UART function and set baud-rate.

Definition at line 203 of file m480_uart.c.

uint32_t UART_Read ( UART_T *  uart,
uint8_t  pu8RxBuf[],
uint32_t  u32ReadBytes 
)

Read UART data.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]pu8RxBufThe buffer to receive the data of receive FIFO.
[in]u32ReadBytesThe the read bytes number of data.
Returns:
u32Count Receive byte count

The function is used to read Rx data from RX FIFO and the data will be stored in pu8RxBuf.

Definition at line 277 of file m480_uart.c.

void UART_SelectIrDAMode ( UART_T *  uart,
uint32_t  u32Buadrate,
uint32_t  u32Direction 
)

Select and configure IrDA function.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32BuadrateThe baudrate of UART module.
[in]u32DirectionThe direction of UART module in IrDA mode:

  • UART_IRDA_TXEN
  • UART_IRDA_RXEN
Returns:
None

The function is used to configure IrDA relative settings. It consists of TX or RX mode and baudrate.

Definition at line 424 of file m480_uart.c.

void UART_SelectLINMode ( UART_T *  uart,
uint32_t  u32Mode,
uint32_t  u32BreakLength 
)

Select and configure LIN function.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32ModeThe LIN direction :

  • UART_ALTCTL_LINTXEN_Msk
  • UART_ALTCTL_LINRXEN_Msk
[in]u32BreakLengthThe break field length.
Returns:
None

The function is used to set LIN relative setting.

Definition at line 528 of file m480_uart.c.

void UART_SelectRS485Mode ( UART_T *  uart,
uint32_t  u32Mode,
uint32_t  u32Addr 
)

Select and configure RS485 function.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32ModeThe operation mode(NMM/AUD/AAD).

  • UART_ALTCTL_RS485NMM_Msk
  • UART_ALTCTL_RS485AUD_Msk
  • UART_ALTCTL_RS485AAD_Msk
[in]u32AddrThe RS485 address.
Returns:
None

The function is used to set RS485 relative setting.

Definition at line 505 of file m480_uart.c.

__STATIC_INLINE void UART_SET_RTS ( UART_T *  uart )

Set RTS pin to high.

Parameters:
[in]uartThe pointer of the specified UART module
Returns:
None

This macro set RTS pin to high.

Definition at line 465 of file m480_uart.h.

void UART_SetLineConfig ( UART_T *  uart,
uint32_t  u32baudrate,
uint32_t  u32data_width,
uint32_t  u32parity,
uint32_t  u32stop_bits 
)

Set UART line configuration.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32baudrateThe register value of baudrate of UART module. If u32baudrate = 0, UART baudrate will not change.
[in]u32data_widthThe data length of UART module.

  • UART_WORD_LEN_5
  • UART_WORD_LEN_6
  • UART_WORD_LEN_7
  • UART_WORD_LEN_8
[in]u32parityThe parity setting (none/odd/even/mark/space) of UART module.

  • _UART_PARITY_NONE
  • _UART_PARITY_ODD
  • _UART_PARITY_EVEN
  • _UART_PARITY_MARK
  • _UART_PARITY_SPACE
[in]u32stop_bitsThe stop bit length (1/1.5/2 bit) of UART module.

  • UART_STOP_BIT_1
  • UART_STOP_BIT_1_5
  • UART_STOP_BIT_2
Returns:
None

This function use to config UART line setting.

Definition at line 332 of file m480_uart.c.

void UART_SetTimeoutCnt ( UART_T *  uart,
uint32_t  u32TOC 
)

Set Rx timeout count.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]u32TOCRx timeout counter.
Returns:
None

This function use to set Rx timeout count.

Definition at line 402 of file m480_uart.c.

uint32_t UART_Write ( UART_T *  uart,
uint8_t  pu8TxBuf[],
uint32_t  u32WriteBytes 
)

Write UART data.

Parameters:
[in]uartThe pointer of the specified UART module.
[in]pu8TxBufThe buffer to send the data to UART transmission FIFO.
[out]u32WriteBytesThe byte number of data.
Returns:
u32Count transfer byte count

The function is to write data into TX buffer to transmit data by UART.

Definition at line 549 of file m480_uart.c.