#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <asm/termios.h>
#include <termios.h>
#include <math.h>
#include <pthread.h>
#include <stropts.h>
#include <endian.h>
#include <stdint.h>
#include <rt/rt_serial.h>
Go to the source code of this file.
#define termios asmtermios |
int set_interface_attribs_custom_baud |
( |
int |
fd, |
|
|
int |
speed, |
|
|
int |
parity, |
|
|
int |
port |
|
) |
| |
Configure serial port.
- Parameters
-
fd | Serial port FD |
speed | Baud rate |
parity | Parity |
port | Port number |
Definition at line 40 of file rt_serial.cpp.
44 printf(
"\t[RT SERIAL] Configuring serial device...\n");
47 ioctl(fd, TCGETS2, &tty);
48 tty.c_cflag &= ~CBAUD;
49 tty.c_cflag |= BOTHER;
53 tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
56 tty.c_iflag &= ~IGNBRK;
63 tty.c_iflag &= ~(IXON | IXOFF | IXANY);
65 tty.c_cflag |= (CLOCAL | CREAD);
68 tty.c_cflag |= PARENB;
69 tty.c_cflag &= ~CSTOPB;
70 tty.c_cflag &= ~CRTSCTS;
73 ioctl(fd, TCSETS2, &tty);