Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
serial_port.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 *
21 */
22
23#ifndef SERIAL_PORT_H
24#define SERIAL_PORT_H
25
26#if !USE_ARBITRARY_BAUDRATE
27#include <termios.h>
28
29struct SerialPort {
30 int fd; /* serial device fd */
31 struct termios orig_termios; /* saved tty state structure */
32 struct termios cur_termios; /* tty state structure */
33};
34
35#else
36#include <linux/termios.h>
37
38struct SerialPort {
39 int fd; /* serial device fd */
40 struct termios2 orig_termios; /* saved tty state structure */
41 struct termios2 cur_termios; /* tty state structure */
42};
43
44#endif
45
46extern struct SerialPort *serial_port_new(void);
47extern void serial_port_free(struct SerialPort *me);
48extern void serial_port_flush(struct SerialPort *me);
49extern void serial_port_flush_output(struct SerialPort *me);
50extern int serial_port_open_raw(struct SerialPort *me, const char *device, speed_t speed);
51extern int serial_port_open(struct SerialPort *me, const char *device,
52 void(*term_conf_callback)(struct termios *, speed_t *));
53extern void serial_port_close(struct SerialPort *me);
54extern int serial_port_set_baudrate(struct SerialPort *me, speed_t speed);
55extern int serial_port_set_bits_stop_parity(struct SerialPort *me, const int bits, const int stop, const int parity);
56
57#endif /* SERIAL_PORT_H */
uint16_t foo
Definition main_demo5.c:58
struct termios cur_termios
Definition serial_port.h:32
void serial_port_free(struct SerialPort *me)
Definition serial_port.c:80
void serial_port_close(struct SerialPort *me)
int serial_port_open_raw(struct SerialPort *me, const char *device, speed_t speed)
struct termios orig_termios
Definition serial_port.h:31
struct SerialPort * serial_port_new(void)
Definition serial_port.c:74
void serial_port_flush_output(struct SerialPort *me)
int serial_port_set_bits_stop_parity(struct SerialPort *me, const int bits, const int stop, const int parity)
int serial_port_open(struct SerialPort *me, const char *device, void(*term_conf_callback)(struct termios *, speed_t *))
int serial_port_set_baudrate(struct SerialPort *me, speed_t speed)
void serial_port_flush(struct SerialPort *me)
Definition serial_port.c:89