-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathusbserial.h
More file actions
31 lines (24 loc) · 746 Bytes
/
Copy pathusbserial.h
File metadata and controls
31 lines (24 loc) · 746 Bytes
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
#ifndef USBSERIAL_H
#define USBSERIAL_H
#include <sys/types.h>
#define VERSION "0.1.1"
struct serial_opt {
char *name;
int handler;
tcflag_t baud;
#ifndef _WIN32
struct termios options;
#endif
int timeout;
int max_msgs;
int endl;
};
typedef struct s_usbserial_ops {
void (*serial_port_close)(struct serial_opt *serial);
int (*serial_port_open)(struct serial_opt *serial);
int (*serial_port_read)(int fd, char *read_buffer, size_t max_chars_to_read);
int (*serial_port_write)(int fd, const char *write_buffer);
int (*serial_port_bytes_available)(struct serial_opt *serial);
} usbserial_ops;
usbserial_ops * serial_initialize(struct serial_opt * options);
#endif