mikroSDK Reference Manual
hal_uart.h File Reference

Go to the source code of this file.

Data Structures

struct  hal_uart_handle_register_t
 
struct  hal_uart_config_t
 UART HAL init configuration structure, consisted of the following fields : More...
 
struct  hal_uart_t
 UART HAL context structure, consisted of the following fields : More...
 

Enumerations

enum  hal_uart_err_t
 
enum  hal_uart_irq_t
 Predefined enum values for interrupt request type. More...
 
enum  hal_uart_data_bits_t
 Predefined enum values for data bit selection. More...
 
enum  hal_uart_parity_t
 Predefined enum values for parity selection. More...
 
enum  hal_uart_stop_bits_t
 Predefined enum values for stop bit selection. More...
 

Functions

void hal_uart_configure_default (hal_uart_config_t *config)
 Configure UART configuration structure with default values. More...
 
err_t hal_uart_open (handle_t *handle, bool hal_obj_open_state)
 Open the UART HAL layer object on selected pins. More...
 
err_t hal_uart_set_baud (handle_t *handle, hal_uart_config_t *config)
 Set the UART baud rate. More...
 
err_t hal_uart_set_parity (handle_t *handle, hal_uart_config_t *config)
 Set the UART parity. More...
 
err_t hal_uart_set_stop_bits (handle_t *handle, hal_uart_config_t *config)
 Set the number of UART stop bits. More...
 
err_t hal_uart_set_data_bits (handle_t *handle, hal_uart_config_t *config)
 Set the number of UART data bits. More...
 
void hal_uart_set_blocking (handle_t *handle, bool blocking)
 Set UART HAL in blocking/non-blocking mode. More...
 
size_t hal_uart_write (handle_t *handle, uint8_t *buffer, size_t size)
 Write data to UART. More...
 
size_t hal_uart_print (handle_t *handle, char *text)
 Print the string to UART. More...
 
size_t hal_uart_println (handle_t *handle, char *text)
 Print the string to UART and append new line. More...
 
size_t hal_uart_read (handle_t *handle, uint8_t *buffer, size_t size)
 Read data from UART. More...
 
size_t hal_uart_bytes_available (hal_uart_t *hal_obj)
 Check number of data available to read. More...
 
void hal_uart_clear (hal_uart_t *hal_obj)
 Discard all characters from UART buffers. More...
 
err_t hal_uart_close (handle_t *handle)
 Close UART HAL layer object. More...
 

Enumeration Type Documentation

◆ hal_uart_err_t

Return values.

Enumerator
HAL_UART_SUCCESS 

Success.

HAL_UART_WRONG_PINS 

Wrong pins selected.

HAL_UART_MODULE_ERROR 

Object wasn't closed.

HAL_UART_ERROR 

Error.

◆ hal_uart_irq_t

Enumerator
HAL_UART_IRQ_RX 

RX INT

HAL_UART_IRQ_TX 

TX INT

◆ hal_uart_data_bits_t

Enumerator
HAL_UART_DATA_BITS_7 

7 data bits.

HAL_UART_DATA_BITS_8 

8 data bits.

HAL_UART_DATA_BITS_9 

9 data bits.

HAL_UART_DATA_BITS_DEFAULT 

Default (8 data bits).

◆ hal_uart_parity_t

Enumerator
HAL_UART_PARITY_NONE 

No parity.

HAL_UART_PARITY_EVEN 

Even parity.

HAL_UART_PARITY_ODD 

Odd parity.

HAL_UART_PARITY_DEFAULT 

Default (no parity).

◆ hal_uart_stop_bits_t

Enumerator
HAL_UART_STOP_BITS_HALF 

Half stop bit.

HAL_UART_STOP_BITS_ONE 

One stop bit.

HAL_UART_STOP_BITS_ONE_AND_A_HALF 

One and a half stop bit.

HAL_UART_STOP_BITS_TWO 

Two stop bits.

HAL_UART_STOP_BITS_DEFAULT 

Default (one stop bit).