Soletta™ Framework
|
UART (Universal Asynchronous Receiver/Transmitter) API for Soletta. More...
Data Structures | |
struct | sol_uart_config |
A configuration struct used to set the UART paramenters. More... | |
Typedefs | |
typedef struct sol_uart | sol_uart |
A handle to a UART device. More... | |
typedef struct sol_uart_config | sol_uart_config |
A configuration struct used to set the UART paramenters. More... | |
Enumerations | |
enum | sol_uart_baud_rate { SOL_UART_BAUD_RATE_9600 = 0, SOL_UART_BAUD_RATE_19200, SOL_UART_BAUD_RATE_38400, SOL_UART_BAUD_RATE_57600, SOL_UART_BAUD_RATE_115200 } |
Baud rate is the number of times the signal can switch states in one second. More... | |
enum | sol_uart_data_bits { SOL_UART_DATA_BITS_8 = 0, SOL_UART_DATA_BITS_7, SOL_UART_DATA_BITS_6, SOL_UART_DATA_BITS_5 } |
Amount of data bits. More... | |
enum | sol_uart_parity { SOL_UART_PARITY_NONE = 0, SOL_UART_PARITY_EVEN, SOL_UART_PARITY_ODD } |
The parity characteristic can be even, odd, or none and it influences last trasmitted bit. More... | |
enum | sol_uart_stop_bits { SOL_UART_STOP_BITS_ONE = 0, SOL_UART_STOP_BITS_TWO } |
Amount of stop bits. More... | |
Functions | |
enum sol_uart_baud_rate | sol_uart_baud_rate_from_str (const char *baud_rate) |
Converts a string UART baudRate to sol_uart_baud_rate. More... | |
const char * | sol_uart_baud_rate_to_str (enum sol_uart_baud_rate baud_rate) |
Converts sol_uart_baud_rate to a string name. More... | |
void | sol_uart_close (struct sol_uart *uart) |
Close an UART bus. More... | |
enum sol_uart_data_bits | sol_uart_data_bits_from_str (const char *data_bits) |
Converts a string UART dataBits to sol_uart_data_bits. More... | |
const char * | sol_uart_data_bits_to_str (enum sol_uart_data_bits data_bits) |
Converts sol_uart_data_bits to a string name. More... | |
int | sol_uart_feed (struct sol_uart *uart, struct sol_blob *blob) |
Perform an UART asynchronous transmission. More... | |
struct sol_uart * | sol_uart_open (const char *port_name, const struct sol_uart_config *config) |
Open an UART bus. More... | |
enum sol_uart_parity | sol_uart_parity_from_str (const char *parity) |
Converts a string UART parity to sol_uart_parity. More... | |
const char * | sol_uart_parity_to_str (enum sol_uart_parity parity) |
Converts sol_uart_parity to a string name. More... | |
enum sol_uart_stop_bits | sol_uart_stop_bits_from_str (const char *stop_bits) |
Converts a string UART stopBits to sol_uart_stop_bits. More... | |
const char * | sol_uart_stop_bits_to_str (enum sol_uart_stop_bits stop_bits) |
Converts sol_uart_stop_bits to a string name. More... | |
UART (Universal Asynchronous Receiver/Transmitter) API for Soletta.
A handle to a UART device.
typedef struct sol_uart_config sol_uart_config |
A configuration struct used to set the UART paramenters.
enum sol_uart_baud_rate |
enum sol_uart_data_bits |
enum sol_uart_parity |
The parity characteristic can be even, odd, or none and it influences last trasmitted bit.
enum sol_uart_stop_bits |
enum sol_uart_baud_rate sol_uart_baud_rate_from_str | ( | const char * | baud_rate | ) |
Converts a string UART baudRate to sol_uart_baud_rate.
This function converts a string UART baudRate to enumeration sol_uart_baud_rate.
baud_rate | Valid values are "baud-9600", "baud-19200", "baud-38400", "baud-57600", "baud-115200". |
const char* sol_uart_baud_rate_to_str | ( | enum sol_uart_baud_rate | baud_rate | ) |
Converts sol_uart_baud_rate to a string name.
This function converts sol_uart_baud_rate enumeration to a string UART baudRate.
baud_rate | sol_uart_baud_rate |
void sol_uart_close | ( | struct sol_uart * | uart | ) |
Close an UART bus.
It's important to note that after this functions is called pending blobs blobs will not be written and the sol_uart_config::on_feed_done() will be called with status
set to -ECANCELED
. The callback sol_uart_config::on_data() will also be called if the rx
buffer has data in it.
uart | The UART bus handle |
Referenced by consumer_read_available(), and shutdown().
enum sol_uart_data_bits sol_uart_data_bits_from_str | ( | const char * | data_bits | ) |
Converts a string UART dataBits to sol_uart_data_bits.
This function converts a string UART dataBits to enumeration sol_uart_data_bits.
data_bits | Valid values are "databits-5", "databits-6", "databits-7", "databits-8". |
const char* sol_uart_data_bits_to_str | ( | enum sol_uart_data_bits | data_bits | ) |
Converts sol_uart_data_bits to a string name.
This function converts sol_uart_data_bits enumeration to a string UART dataBits.
data_bits | sol_uart_data_bits |
Perform an UART asynchronous transmission.
This function will queue a feed operation on the UART bus. It calls sol_blob_ref(), thus it's safe to call sol_blob_unref() right after this function returns. After a blob is completely written the callback sol_uart_config::on_feed_done() is called, if provided. On errors callback sol_uart_config::on_feed_done() is called with negative status.
uart | The UART bus handle |
blob | The blob to be written |
-ENOSPC
if sol_uart_config::feed_size is not zero and there's no more space left or negative errno on error Referenced by send_blob().
struct sol_uart* sol_uart_open | ( | const char * | port_name, |
const struct sol_uart_config * | config | ||
) |
Open an UART bus.
port_name | the name of UART port, on Linux it should be ttyUSB0 or ttyACM0 in small OSes it should be a id number. |
config | The UART bus configuration |
Referenced by startup().
enum sol_uart_parity sol_uart_parity_from_str | ( | const char * | parity | ) |
Converts a string UART parity to sol_uart_parity.
This function converts a string UART parity to enumeration sol_uart_parity.
parity | Valid values are "none", "even", "odd". |
const char* sol_uart_parity_to_str | ( | enum sol_uart_parity | parity | ) |
Converts sol_uart_parity to a string name.
This function converts sol_uart_parity enumeration to a string UART parity.
parity | sol_uart_parity |
enum sol_uart_stop_bits sol_uart_stop_bits_from_str | ( | const char * | stop_bits | ) |
Converts a string UART stopBits to sol_uart_stop_bits.
This function converts a string UART stopBits to enumeration sol_uart_stop_bits.
stop_bits | Valid values are "stopbits-1", "stopbits-2". |
const char* sol_uart_stop_bits_to_str | ( | enum sol_uart_stop_bits | stop_bits | ) |
Converts sol_uart_stop_bits to a string name.
This function converts sol_uart_stop_bits enumeration to a string UART stopBits.
stop_bits | sol_uart_stop_bits |