mikroSDK Reference Manual
drv_uart.h File Reference

Go to the source code of this file.

Data Structures

struct  uart_config_t
 UART init configuration structure, consisted of the following fields : More...
 
struct  uart_t
 UART driver context structure, consisted of the following fields : More...
 

Enumerations

enum  uart_err_t
 
enum  uart_data_bits_t
 
enum  uart_parity_t
 
enum  uart_stop_bits_t
 

Functions

void uart_configure_default (uart_config_t *config)
 Configure UART Driver configuration structure. More...
 
err_t uart_open (uart_t *obj, uart_config_t *config)
 Open the UART Driver object. More...
 
err_t uart_set_baud (uart_t *obj, uint32_t baud)
 Set the UART baud rate. More...
 
err_t uart_set_parity (uart_t *obj, uart_parity_t parity)
 Set the UART parity. More...
 
err_t uart_set_stop_bits (uart_t *obj, uart_stop_bits_t stop)
 Set the number of UART stop bits. More...
 
err_t uart_set_data_bits (uart_t *obj, uart_data_bits_t bits)
 Set the number of UART data bits. More...
 
void uart_set_blocking (uart_t *obj, bool blocking)
 Set UART Driver in blocking/non-blocking mode. More...
 
err_t uart_write (uart_t *obj, uint8_t *buffer, size_t size)
 Write data to UART. More...
 
err_t uart_print (uart_t *obj, char *text)
 Print the string to UART. More...
 
err_t uart_println (uart_t *obj, char *text)
 Print the string to UART and append new line. More...
 
err_t uart_read (uart_t *obj, uint8_t *buffer, size_t size)
 Read data from UART. More...
 
size_t uart_bytes_available (uart_t *obj)
 Check number of bytes available to read from UART. More...
 
void uart_clear (uart_t *obj)
 Discard all characters from UART buffers. More...
 
err_t uart_close (uart_t *obj)
 Close UART Driver object. More...
 

Enumeration Type Documentation

◆ uart_err_t

enum uart_err_t

Return values.

Enumerator
UART_SUCCESS 

Success.

UART_ERROR 

Error.

◆ uart_data_bits_t

Predefined enum values for data bit selection.

Enumerator
UART_DATA_BITS_7 

7 data bits.

UART_DATA_BITS_8 

8 data bits.

UART_DATA_BITS_9 

9 data bits.

UART_DATA_BITS_DEFAULT 

Default (8 data bits).

◆ uart_parity_t

Predefined enum values for parity selection.

Enumerator
UART_PARITY_NONE 

No parity.

UART_PARITY_EVEN 

Even parity.

UART_PARITY_ODD 

Odd parity.

UART_PARITY_DEFAULT 

Default (no parity).

◆ uart_stop_bits_t

Predefined enum values for stop bit selection.

Enumerator
UART_STOP_BITS_HALF 

Half stop bit.

UART_STOP_BITS_ONE 

One stop bit.

UART_STOP_BITS_ONE_AND_A_HALF 

One and a half stop bit.

UART_STOP_BITS_TWO 

Two stop bits.

UART_STOP_BITS_DEFAULT 

Default (one stop bit).