Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
sol_uart_config Struct Reference

A configuration struct used to set the UART paramenters. More...

#include <sol-uart.h>

Data Fields

uint16_t api_version
 must match SOL_UART_CONFIG_API_VERSION at runtime More...
 
enum sol_uart_baud_rate baud_rate
 The baud rate value. More...
 
enum sol_uart_data_bits data_bits
 The data bits value. More...
 
size_t data_buffer_size
 The receiving buffer max size. More...
 
size_t feed_size
 The feed buffer max size. More...
 
bool flow_control
 Enables software flow control(XOFF and XON) More...
 
ssize_t(* on_data )(void *data, struct sol_uart *uart, const struct sol_buffer *buf)
 Callback containing data was read from UART. More...
 
void(* on_feed_done )(void *data, struct sol_uart *uart, struct sol_blob *blob, int status)
 Informs that a feed operation has ended. More...
 
enum sol_uart_parity parity
 The parity value. More...
 
enum sol_uart_stop_bits stop_bits
 The stop bits value. More...
 
const void * user_data
 User data to sol_uart_config::on_feed_done() and sol_uart_config::on_data() More...
 

Detailed Description

A configuration struct used to set the UART paramenters.

See Also
sol_uart_open()
Note
UART follows the Soletta stream design pattern, which can be found here: IO Streams
Examples:
/src/samples/common/uart.c.

Field Documentation

uint16_t sol_uart_config::api_version

must match SOL_UART_CONFIG_API_VERSION at runtime

Examples:
/src/samples/common/uart.c.

Referenced by startup().

enum sol_uart_baud_rate sol_uart_config::baud_rate

The baud rate value.

enum sol_uart_data_bits sol_uart_config::data_bits

The data bits value.

size_t sol_uart_config::data_buffer_size

The receiving buffer max size.

The value 0 means unlimited data. In other words, the buffer will always grow in order to store all the data and shrink when data is consumed.

size_t sol_uart_config::feed_size

The feed buffer max size.

The value 0 means unlimited data. Since sol_uart_feed() works with blobs, no extra buffers will be allocated in order to store feed_size bytes. All the blobs that are schedule to be written will be referenced and the sum of all queued blobs must not be equal or exceed feed_size. If it happens sol_uart_feed() will return -ENOSPC and one must start to control the writing flow until on_feed_done is called.

See Also
sol_uart_feed()
bool sol_uart_config::flow_control

Enables software flow control(XOFF and XON)

ssize_t(* sol_uart_config::on_data)(void *data, struct sol_uart *uart, const struct sol_buffer *buf)

Callback containing data was read from UART.

Parameters
dataUser data as provided in sol_uart_config::user_data
uartThe UART handle
bufThe UART data
Returns
The number of bytes read from buf or negative errno on error.
void(* sol_uart_config::on_feed_done)(void *data, struct sol_uart *uart, struct sol_blob *blob, int status)

Informs that a feed operation has ended.

Parameters
dataUser data as provided in sol_uart_config::user_data
uartThe UART handle
blobThe blob that was written
status0 on success or negative errno on error
Note
There is no need to call sol_blob_unref().
See Also
sol_uart_feed()
enum sol_uart_parity sol_uart_config::parity

The parity value.

enum sol_uart_stop_bits sol_uart_config::stop_bits

The stop bits value.

const void* sol_uart_config::user_data

The documentation for this struct was generated from the following file: