RISC-V/V203F6P6/programmer/software/baud.cpp
2025-02-03 19:18:47 +01:00

14 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);
}