15 lines
285 B
C++
15 lines
285 B
C++
|
#include <asm/termbits.h>
|
||
|
#include <sys/ioctl.h>
|
||
|
#include "usart.h"
|
||
|
|
||
|
void UsartClass::setBaud (int baud) {
|
||
|
struct termios2 tio;
|
||
|
|
||
|
ioctl(fd, TCGETS2, &tio);
|
||
|
tio.c_cflag &= ~CBAUD;
|
||
|
tio.c_cflag |= BOTHER;
|
||
|
tio.c_ispeed = baud;
|
||
|
tio.c_ospeed = baud;
|
||
|
ioctl(fd, TCSETS2, &tio);
|
||
|
}
|