forked from sergev/pic32prog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serial.h
45 lines (39 loc) · 935 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
/*
* Interface to serial port.
*
* Copyright (C) 2015 Serge Vakulenko
*
* This file is part of PIC32PROG project, which is distributed
* under the terms of the GNU General Public License (GPL).
* See the accompanying file "COPYING" for more details.
*/
/*
* Open the serial port.
* Return -1 on error.
*/
int serial_open (const char *devname, int baud_rate);
/*
* Change the serial baud rate
* Return -1 on error.
*/
int serial_baud (int baud_rate);
/*
* Close the serial port.
*/
void serial_close (void);
/*
* Send data to device.
* Return number of bytes, or -1 on error.
*/
int serial_write (unsigned char *data, int len);
/*
* Receive data from device.
* Return number of bytes, or -1 on error.
*/
int serial_read (unsigned char *data, int len);
/*
* Check whether the given speed in bits per second
* is supported by the system.
* Return 0 when not supported.
*/
int serial_speed_valid (int bps);