mikroSDK Reference Manual
uart_config_t Struct Reference

UART init configuration structure, consisted of the following fields : More...

Data Fields

pin_name_t tx_pin
 
pin_name_t rx_pin
 
uint32_t baud
 
uart_data_bits_t data_bits
 
uart_parity_t parity
 
uart_stop_bits_t stop_bits
 
ring_buf8_t tx_buf
 
ring_buf8_t rx_buf
 
size_t tx_ring_size
 
size_t rx_ring_size
 

Detailed Description

User needs to specify values herein.

Note
Take into consideration that any value can be changed explicitly by the user.
Warning
The following example includes pins mapping. Take into consideration that different hardware might not have the same pins. Make sure to accommodate pin name based on your hardware specifics.

Example

// UART driver configuration structure.
static uart_config_t uart_cfg;
// Be careful to have large enough buffers.
static uint8_t uart_rx_buffer[128];
// Be careful to have large enough buffers.
static uint8_t uart_tx_buffer[128];
// Fill structure with default values.
// Specify desired UART RX pin.
uart_cfg.rx_pin = MIKROBUS_1_RX;
// Specify desired UART TX pin.
uart_cfg.tx_pin = MIKROBUS_1_TX;
// Declare buffer size.
uart_cfg.tx_ring_size = sizeof( uart_tx_buffer );
// Declare buffer size.
uart_cfg.rx_ring_size = sizeof( uart_rx_buffer );

Field Documentation

◆ tx_pin

pin_name_t uart_config_t::tx_pin

Tx pin.

◆ rx_pin

pin_name_t uart_config_t::rx_pin

Rx pin.

◆ baud

uint32_t uart_config_t::baud

Baud rate.

◆ data_bits

uart_data_bits_t uart_config_t::data_bits

Data bits.

◆ parity

uart_parity_t uart_config_t::parity

Parity bits.

◆ stop_bits

uart_stop_bits_t uart_config_t::stop_bits

Stop bits.

◆ tx_buf

ring_buf8_t uart_config_t::tx_buf

Tx buffer.

◆ rx_buf

ring_buf8_t uart_config_t::rx_buf

Rx buffer.

◆ tx_ring_size

size_t uart_config_t::tx_ring_size

Tx ring size.

◆ rx_ring_size

size_t uart_config_t::rx_ring_size

Rx ring size.

uart_config_t::rx_ring_size
size_t rx_ring_size
Definition: drv_uart.h:150
uart_config_t::tx_ring_size
size_t tx_ring_size
Definition: drv_uart.h:149
uart_config_t::rx_pin
pin_name_t rx_pin
Definition: drv_uart.h:139
uart_config_t
UART init configuration structure, consisted of the following fields :
Definition: drv_uart.h:136
uart_config_t::tx_pin
pin_name_t tx_pin
Definition: drv_uart.h:138
uart_configure_default
void uart_configure_default(uart_config_t *config)
Configure UART Driver configuration structure.