Astra MCU SDK Peripheral Driver Library
 
Loading...
Searching...
No Matches

General functions for UART driver. More...

Functions

INIT_CODE uart_status_en uart_init (uart_instance_en id)
 
INIT_CODE uart_status_en uart_deinit (uart_instance_en id)
 
uart_status_en uart_set_configuration (uart_instance_en id, uart_config_t *cfg, uint32_t *achieved_baudrate)
 
uart_status_en uart_get_configuration (uart_instance_en id, uart_config_t *cfg, uint32_t *achieved_baudrate)
 

Detailed Description

General functions for UART driver.

Function Documentation

◆ uart_init()

INIT_CODE uart_status_en uart_init ( uart_instance_en id)

Initializes the UART hardware and internal driver structures for the specified UART instance.

Parameters
idUART Instance ID.
Returns
uart_status_en Status code indicating success or the reason for failure.

◆ uart_deinit()

INIT_CODE uart_status_en uart_deinit ( uart_instance_en id)

Deinitializes the UART hardware and releases any resources held by the driver for the specified UART instance.

Parameters
idUART Instance ID.
Returns
uart_status_en Status code indicating success or the reason for failure.

◆ uart_set_configuration()

uart_status_en uart_set_configuration ( uart_instance_en id,
uart_config_t * cfg,
uint32_t * achieved_baudrate )

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
idUART Instance ID.
cfgPointer to the UART configuration structure specifying desired settings.
achieved_baudratePointer 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()

uart_status_en uart_get_configuration ( uart_instance_en id,
uart_config_t * cfg,
uint32_t * achieved_baudrate )

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
idUART Instance ID.
cfgPointer to the UART configuration structure to be populated with current settings.
achieved_baudratePointer 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.