-
Notifications
You must be signed in to change notification settings - Fork 4
/
serial.h
50 lines (39 loc) · 933 Bytes
/
serial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __SERIAL_H__
#define __SERIAL_H__
#ifdef __cplusplus
extern "C" {
#endif
/** Creates a basic fd, setting baud to 9600, raw data i/o (no flow
control, no fancy character handling. Configures it for blocking
reads. 8 data bits, 1 stop bit, no parity.
Returns the fd, -1 on error
**/
int
serial_open (const char *port, int baud, int blocking);
/** Set the baud rate, where the baudrate is just the integer value
desired.
Returns non-zero on error.
**/
int
serial_setbaud (int fd, int baudrate);
/** Enable cts/rts flow control.
Returns non-zero on error.
**/
int
serial_enablectsrts (int fd);
/** Enable xon/xoff flow control.
Returns non-zero on error.
**/
int
serial_enablexon (int fd);
/** Set the port to 8 data bits, 2 stop bits, no parity.
Returns non-zero on error.
**/
int
serial_set_N82 (int fd);
int
serial_close (int fd);
#ifdef __cplusplus
}
#endif
#endif //__SERIAL_H__