RISC-V/V203F6P6/programmer/software/baud.cpp

15 lines
285 B
C++
Raw Normal View History

2025-02-03 19:18:47 +01:00
#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);
}