Soletta™ Framework
|
UART sample. More...
#include <stdio.h>
#include <string.h>
#include "sol-mainloop.h"
#include "sol-uart.h"
#include "sol-util.h"
#include "sol-str-slice.h"
#include "soletta.h"
Macros | |
#define | FEED_SIZE (512) |
#define | MAX_PACKETS (100) |
Functions | |
static ssize_t | consumer_read_available (void *data, struct sol_uart *uart, const struct sol_buffer *buf) |
[uart write] More... | |
static void | producer_data_written (void *data, struct sol_uart *uart, struct sol_blob *blob, int status) |
[uart write completed] More... | |
static bool | producer_make_data (void *data) |
static bool | send_blob (struct sol_blob *blob) |
[uart write completed] More... | |
static void | shutdown (void) |
[uart configure] More... | |
SOL_MAIN_DEFAULT (startup, shutdown) | |
static void | startup (void) |
[uart read] More... | |
Variables | |
static struct sol_uart * | consumer |
static struct sol_blob * | pending_blob |
static struct sol_uart * | producer |
static struct sol_timeout * | producer_timeout |
UART sample.
This sample simulates an UART producer and consumer. In order to run this sample, you will need to cross connect two uart cables. This means the TX from one cable must be connect to the RX of the another cable and vice-versa.
#define FEED_SIZE (512) |
Referenced by startup().
#define MAX_PACKETS (100) |
Referenced by producer_make_data().
|
static |
[uart write]
[uart read]
References consumer, sol_str_slice::data, sol_str_slice::len, sol_buffer_get_slice(), sol_quit(), SOL_STR_SLICE_PRINT, sol_str_slice_str_contains(), and sol_uart_close().
Referenced by startup().
|
static |
[uart write completed]
References send_blob(), sol_quit(), sol_str_slice_from_blob(), SOL_STR_SLICE_PRINT, and sol_util_strerrora.
Referenced by startup().
|
static |
References MAX_PACKETS, producer_timeout, send_blob(), sol_blob_new(), SOL_BLOB_TYPE_DEFAULT, sol_buffer_append_slice(), SOL_BUFFER_INIT_EMPTY, sol_buffer_steal(), sol_quit(), sol_str_slice_from_blob(), sol_str_slice_from_str(), SOL_STR_SLICE_PRINT, sol_util_strerrora, and sol_util_uuid_gen().
Referenced by startup().
|
static |
[uart write completed]
[uart write]
References producer, sol_blob_unref(), sol_str_slice_from_blob(), SOL_STR_SLICE_PRINT, sol_uart_feed(), and sol_util_strerrora.
Referenced by producer_data_written(), and producer_make_data().
|
static |
[uart configure]
References consumer, producer, producer_timeout, sol_blob_unref(), sol_timeout_del(), and sol_uart_close().
|
static |
[uart read]
[uart configure]
References sol_uart_config::api_version, consumer, consumer_read_available(), FEED_SIZE, producer, producer_data_written(), producer_make_data(), producer_timeout, sol_argc(), sol_argv(), sol_quit(), SOL_SET_API_VERSION, sol_timeout_add(), SOL_UART_BAUD_RATE_9600, SOL_UART_CONFIG_API_VERSION, SOL_UART_DATA_BITS_8, sol_uart_open(), SOL_UART_PARITY_NONE, and SOL_UART_STOP_BITS_ONE.
|
static |
Referenced by consumer_read_available(), shutdown(), and startup().
|
static |
|
static |
Referenced by send_blob(), shutdown(), and startup().
|
static |
Referenced by producer_make_data(), shutdown(), and startup().