mraa  0.9.6
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
uart.h
Go to the documentation of this file.
1 /*
2  * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
3  * Contributions: Jon Trulson <jtrulson@ics.com>
4  * Brendan Le Foll <brendan.le.foll@intel.com>
5  * Copyright (c) 2014 - 2015 Intel Corporation
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  */
26 
27 #pragma once
28 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #include <stdio.h>
45 
46 #include "common.h"
47 
48 typedef struct _uart* mraa_uart_context;
49 
56 mraa_uart_context mraa_uart_init(int uart);
57 
64 mraa_uart_context mraa_uart_init_raw(const char* path);
65 
73 mraa_result_t mraa_uart_flush(mraa_uart_context dev);
74 
84 mraa_result_t mraa_uart_set_baudrate(mraa_uart_context dev, unsigned int baud);
85 
97 mraa_result_t mraa_uart_set_mode(mraa_uart_context dev, int bytesize, mraa_uart_parity_t parity, int stopbits);
98 
107 mraa_result_t mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_boolean_t rtscts);
108 
119 mraa_result_t mraa_uart_set_timeout(mraa_uart_context dev, int read, int write, int interchar);
120 
128 const char* mraa_uart_get_dev_path(mraa_uart_context dev);
129 
136 mraa_result_t mraa_uart_stop(mraa_uart_context dev);
137 
146 int mraa_uart_read(mraa_uart_context dev, char* buf, size_t length);
147 
156 int mraa_uart_write(mraa_uart_context dev, const char* buf, size_t length);
157 
165 mraa_boolean_t mraa_uart_data_available(mraa_uart_context dev, unsigned int millis);
166 
167 #ifdef __cplusplus
168 }
169 #endif
unsigned int mraa_boolean_t
Definition: common.h:60
int mraa_uart_write(mraa_uart_context dev, const char *buf, size_t length)
mraa_result_t mraa_uart_stop(mraa_uart_context dev)
mraa_result_t mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_boolean_t rtscts)
mraa_result_t mraa_uart_flush(mraa_uart_context dev)
mraa_uart_context mraa_uart_init_raw(const char *path)
mraa_boolean_t mraa_uart_data_available(mraa_uart_context dev, unsigned int millis)
const char * mraa_uart_get_dev_path(mraa_uart_context dev)
mraa_result_t mraa_uart_set_mode(mraa_uart_context dev, int bytesize, mraa_uart_parity_t parity, int stopbits)
int mraa_uart_read(mraa_uart_context dev, char *buf, size_t length)
mraa_uart_context mraa_uart_init(int uart)
mraa_result_t
Definition: types.h:193
mraa_result_t mraa_uart_set_timeout(mraa_uart_context dev, int read, int write, int interchar)
mraa_result_t mraa_uart_set_baudrate(mraa_uart_context dev, unsigned int baud)