General functions for UART driver.
More...
General functions for UART driver.
◆ uart_init()
Initializes the UART hardware and internal driver structures for the specified UART instance.
- Parameters
-
- Returns
- uart_status_en Status code indicating success or the reason for failure.
◆ uart_deinit()
Deinitializes the UART hardware and releases any resources held by the driver for the specified UART instance.
- Parameters
-
- Returns
- uart_status_en Status code indicating success or the reason for failure.
◆ uart_set_configuration()
Sets the UART hardware configuration for the specified UART instance, including data bits, stop bits, parity, flow control, and baud rate. Programs the UART registers accordingly and returns the actual baud rate achieved.
- Parameters
-
| id | UART Instance ID. |
| cfg | Pointer to the UART configuration structure specifying desired settings. |
| achieved_baudrate | Pointer to a variable to store the actual baud rate configured in bps. |
- Returns
- uart_status_en Status code indicating success or type of error.
◆ uart_get_configuration()
Retrieves the current UART hardware configuration for the specified UART instance, including data bits, stop bits, parity, flow control status, and the baud rate currently set. The configuration is populated into the provided structure and the actual baud rate is returned.
- Parameters
-
| id | UART Instance ID. |
| cfg | Pointer to the UART configuration structure to be populated with current settings. |
| achieved_baudrate | Pointer to a variable to receive the current baud rate (optional, can be NULL). |
- Returns
- uart_status_en Status code indicating success or type of error.