ESP32_RTOS_SDK V1.1.0

- Main Page
- Modules
- Data Structures
- Files

Functions
UART Driver APIs
Driver APIs

UART driver APIs. More...

## Functions

void | uart_div_modify (UART_Port uart_no, uint16 div)
| Set UART baud rate. More...
void | UART_WaitTxFifoEmpty (UART_Port uart_no)
| Wait uart tx fifo empty, do not use it if tx flow control enabled. More...
void | UART_ResetFifo (UART_Port uart_no)
| Clear uart tx fifo and rx fifo. More...
void | UART_ClearIntrStatus (UART_Port uart_no, uint32 clr_mask)
| Clear uart interrupt flags. More...
void | UART_SetIntrEna (UART_Port uart_no, uint32 ena_mask)
| Enable uart interrupts . More...
void | UART_intr_handler_register (void *fn, void *arg)
| Register an application-specific interrupt handler for Uarts interrupts. More...
void | UART_SetPrintPort (UART_Port uart_no)
| Config from which serial output printf function. More...
void | UART_ParamConfig (UART_Port uart_no, UART_ConfigTypeDef *pUARTConfig)
| Config Common parameters of serial ports. More...
void | UART_IntrConfig (UART_Port uart_no, UART_IntrConfTypeDef *pUARTIntrConf)
| Config types of uarts. More...
void | UART_SetWordLength (UART_Port uart_no, UART_WordLength len)
| Config the length of the uart communication data bits. More...
void | UART_SetStopBits (UART_Port uart_no, UART_StopBits bit_num)
| Config the length of the uart communication stop bits. More...
void | UART_SetParity (UART_Port uart_no, UART_ParityMode Parity_mode)
| Configure whether to open the parity. More...
void | UART_SetBaudrate (UART_Port uart_no, uint32 baud_rate)
| Configure the Baud rate. More...
void | UART_SetFlowCtrl (UART_Port uart_no, UART_HwFlowCtrl flow_ctrl, uint8 rx_thresh)
| Configure Hardware flow control. More...
void | UART_SetLineInverse (UART_Port uart_no, UART_LineLevelInverse inverse_mask)
| Configure trigging signal of uarts. More...
void | uart_init_new (void)
| An example illustrates how to configure the serial port. More...

## Detailed Description

UART driver APIs.

## Function Documentation

void UART_ClearIntrStatus | ( | UART_Port | uart_no,
|  | uint32 | clr_mask
| ) |  |

Clear uart interrupt flags.

Parameters

  UART_Port | uart_no : UART0 or UART1
  uint32 | clr_mask : To clear the interrupt bits

Returns
  null

void uart_div_modify | ( | UART_Port | uart_no,
|  | uint16 | div
| ) |  |

Set UART baud rate.

Example : uart_div_modify(uart_no, UART_CLK_FREQ / (UartDev.baut_rate));

Parameters

  UART_Port | uart_no : UART0 or UART1
  uint16 | div : frequency divider

Returns
  null

void uart_init_new | ( | void |  | ) |

An example illustrates how to configure the serial port.

Parameters

  null |

Returns
  null

void UART_intr_handler_register | ( | void * | fn,
|  | void * | arg
| ) |  |

Register an application-specific interrupt handler for Uarts interrupts.

Parameters

  void | *fn : interrupt handler for Uart interrupts.
  void | *arg : interrupt handler's arg.

Returns
  null

void UART_IntrConfig | ( | UART_Port | uart_no,
|  | UART_IntrConfTypeDef * | pUARTIntrConf
| ) |  |

Config types of uarts.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_IntrConfTypeDef | *pUARTIntrConf : parameters structure

Returns
  null

void UART_ParamConfig | ( | UART_Port | uart_no,
|  | UART_ConfigTypeDef * | pUARTConfig
| ) |  |

Config Common parameters of serial ports.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_ConfigTypeDef | *pUARTConfig : parameters structure

Returns
  null

void UART_ResetFifo | ( | UART_Port | uart_no | ) |

Clear uart tx fifo and rx fifo.

Parameters

  UART_Port | uart_no : UART0 or UART1

Returns
  null

void UART_SetBaudrate | ( | UART_Port | uart_no,
|  | uint32 | baud_rate
| ) |  |

Configure the Baud rate.

Parameters

  UART_Port | uart_no : UART0 or UART1
  uint32 | baud_rate : the Baud rate

Returns
  null

void UART_SetFlowCtrl | ( | UART_Port | uart_no,
|  | UART_HwFlowCtrl | flow_ctrl,
|  | uint8 | rx_thresh
| ) |  |

Configure Hardware flow control.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_HwFlowCtrl | flow_ctrl : Hardware flow control mode
  uint8 | rx_thresh : threshold of Hardware flow control

Returns
  null

void UART_SetIntrEna | ( | UART_Port | uart_no,
|  | uint32 | ena_mask
| ) |  |

Enable uart interrupts .

Parameters

  UART_Port | uart_no : UART0 or UART1
  uint32 | ena_mask : To enable the interrupt bits

Returns
  null

void UART_SetLineInverse | ( | UART_Port | uart_no,
|  | UART_LineLevelInverse | inverse_mask
| ) |  |

Configure trigging signal of uarts.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_LineLevelInverse | inverse_mask : Choose need to flip the IO

Returns
  null

void UART_SetParity | ( | UART_Port | uart_no,
|  | UART_ParityMode | Parity_mode
| ) |  |

Configure whether to open the parity.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_ParityMode | Parity_mode : the enum of uart parity configuration

Returns
  null

void UART_SetPrintPort | ( | UART_Port | uart_no | ) |

Config from which serial output printf function.

Parameters

  UART_Port | uart_no : UART0 or UART1

Returns
  null

void UART_SetStopBits | ( | UART_Port | uart_no,
|  | UART_StopBits | bit_num
| ) |  |

Config the length of the uart communication stop bits.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_StopBits | bit_num : the length uart communication stop bits

Returns
  null

void UART_SetWordLength | ( | UART_Port | uart_no,
|  | UART_WordLength | len
| ) |  |

Config the length of the uart communication data bits.

Parameters

  UART_Port | uart_no : UART0 or UART1
  UART_WordLength | len : the length of the uart communication data bits

Returns
  null

void UART_WaitTxFifoEmpty | ( | UART_Port | uart_no | ) |

Wait uart tx fifo empty, do not use it if tx flow control enabled.

Parameters

  UART_Port | uart_no : UART0 or UART1

Returns
  null