mikroSDK Reference Manual
hal_uart_config_t Struct Reference

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

Data Fields

hal_pin_name_t tx_pin
 
hal_pin_name_t rx_pin
 
uint32_t baud
 
hal_uart_data_bits_t data_bits
 
hal_uart_parity_t parity
 
hal_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 specifiy values herein.

Note
Take into consideration that any value can be changed explicitly by the user.

Example

// UART HAL config structure
static hal_uart_config_t hal_uart_cfg;
// Be careful to have large enough buffers
static uint8_t hal_uart_rx_buffer[128];
// Be careful to have large enough buffers
static uint8_t hal_uart_tx_buffer[128];
// Fill structure with default values
hal_uart_configure_default( &hal_uart_cfg );
// Specify desired UART RX pin
hal_uart_cfg.rx_pin = PC6;
// Specify desired UART TX pin
hal_uart_cfg.tx_pin = PC7;
// Declare buffer size
hal_uart_cfg.tx_ring_size = sizeof( hal_uart_tx_buffer );
// Declare buffer size
hal_uart_cfg.rx_ring_size = sizeof( hal_uart_rx_buffer );

Field Documentation

◆ tx_pin

hal_pin_name_t hal_uart_config_t::tx_pin

Tx pin.

◆ rx_pin

hal_pin_name_t hal_uart_config_t::rx_pin

Rx pin.

◆ baud

uint32_t hal_uart_config_t::baud

Baud rate.

◆ data_bits

hal_uart_data_bits_t hal_uart_config_t::data_bits

Data bits. See hal_uart_data_bits_t for valid values.

◆ parity

hal_uart_parity_t hal_uart_config_t::parity

Parity bits. See hal_uart_parity_t for valid values.

◆ stop_bits

hal_uart_stop_bits_t hal_uart_config_t::stop_bits

Stop bits. See hal_uart_stop_bits_t for valid values.

◆ tx_buf

ring_buf8_t hal_uart_config_t::tx_buf

Tx buffer.

◆ rx_buf

ring_buf8_t hal_uart_config_t::rx_buf

Rx buffer.

◆ tx_ring_size

size_t hal_uart_config_t::tx_ring_size

Tx ring size.

◆ rx_ring_size

size_t hal_uart_config_t::rx_ring_size

Rx ring size.

hal_uart_config_t::tx_ring_size
size_t tx_ring_size
Definition: hal_uart.h:170
hal_uart_config_t::rx_ring_size
size_t rx_ring_size
Definition: hal_uart.h:171
hal_uart_config_t::tx_pin
hal_pin_name_t tx_pin
Definition: hal_uart.h:159
hal_uart_config_t::rx_pin
hal_pin_name_t rx_pin
Definition: hal_uart.h:160
hal_uart_configure_default
void hal_uart_configure_default(hal_uart_config_t *config)
Configure UART configuration structure with default values.
hal_uart_config_t
UART HAL init configuration structure, consisted of the following fields :
Definition: hal_uart.h:157