dhb2normal #115
@ -16,123 +16,99 @@ void uart::setMode(struct termios& options, UartModes mode) {
|
||||
void uart::setBaudrate(struct termios& options, UartBaudRate baud) {
|
||||
switch (baud) {
|
||||
case UartBaudRate::RATE_50:
|
||||
cfsetispeed(&options, B50);
|
||||
cfsetospeed(&options, B50);
|
||||
cfsetspeed(&options, B50);
|
||||
break;
|
||||
case UartBaudRate::RATE_75:
|
||||
cfsetispeed(&options, B75);
|
||||
cfsetospeed(&options, B75);
|
||||
cfsetspeed(&options, B75);
|
||||
break;
|
||||
case UartBaudRate::RATE_110:
|
||||
cfsetispeed(&options, B110);
|
||||
cfsetospeed(&options, B110);
|
||||
cfsetspeed(&options, B110);
|
||||
break;
|
||||
case UartBaudRate::RATE_134:
|
||||
cfsetispeed(&options, B134);
|
||||
cfsetospeed(&options, B134);
|
||||
cfsetspeed(&options, B134);
|
||||
break;
|
||||
case UartBaudRate::RATE_150:
|
||||
cfsetispeed(&options, B150);
|
||||
cfsetospeed(&options, B150);
|
||||
cfsetspeed(&options, B150);
|
||||
break;
|
||||
case UartBaudRate::RATE_200:
|
||||
cfsetispeed(&options, B200);
|
||||
cfsetospeed(&options, B200);
|
||||
break;
|
||||
case UartBaudRate::RATE_300:
|
||||
cfsetispeed(&options, B300);
|
||||
cfsetospeed(&options, B300);
|
||||
cfsetspeed(&options, B300);
|
||||
break;
|
||||
case UartBaudRate::RATE_600:
|
||||
cfsetispeed(&options, B600);
|
||||
cfsetospeed(&options, B600);
|
||||
cfsetspeed(&options, B600);
|
||||
break;
|
||||
case UartBaudRate::RATE_1200:
|
||||
cfsetispeed(&options, B1200);
|
||||
cfsetospeed(&options, B1200);
|
||||
cfsetspeed(&options, B1200);
|
||||
break;
|
||||
case UartBaudRate::RATE_1800:
|
||||
cfsetispeed(&options, B1800);
|
||||
cfsetospeed(&options, B1800);
|
||||
cfsetspeed(&options, B1800);
|
||||
break;
|
||||
case UartBaudRate::RATE_2400:
|
||||
cfsetispeed(&options, B2400);
|
||||
cfsetospeed(&options, B2400);
|
||||
cfsetspeed(&options, B2400);
|
||||
break;
|
||||
case UartBaudRate::RATE_4800:
|
||||
cfsetispeed(&options, B4800);
|
||||
cfsetospeed(&options, B4800);
|
||||
cfsetspeed(&options, B4800);
|
||||
break;
|
||||
case UartBaudRate::RATE_9600:
|
||||
cfsetispeed(&options, B9600);
|
||||
cfsetospeed(&options, B9600);
|
||||
break;
|
||||
case UartBaudRate::RATE_19200:
|
||||
cfsetispeed(&options, B19200);
|
||||
cfsetospeed(&options, B19200);
|
||||
cfsetspeed(&options, B19200);
|
||||
break;
|
||||
case UartBaudRate::RATE_38400:
|
||||
cfsetspeed(&options, B38400);
|
||||
break;
|
||||
case UartBaudRate::RATE_57600:
|
||||
cfsetispeed(&options, B57600);
|
||||
cfsetospeed(&options, B57600);
|
||||
cfsetspeed(&options, B57600);
|
||||
break;
|
||||
case UartBaudRate::RATE_115200:
|
||||
cfsetspeed(&options, B115200);
|
||||
break;
|
||||
case UartBaudRate::RATE_230400:
|
||||
cfsetispeed(&options, B230400);
|
||||
cfsetospeed(&options, B230400);
|
||||
cfsetspeed(&options, B230400);
|
||||
break;
|
||||
#ifndef __APPLE__
|
||||
case UartBaudRate::RATE_460800:
|
||||
cfsetispeed(&options, B460800);
|
||||
cfsetospeed(&options, B460800);
|
||||
cfsetspeed(&options, B460800);
|
||||
break;
|
||||
case UartBaudRate::RATE_500000:
|
||||
cfsetispeed(&options, B500000);
|
||||
cfsetospeed(&options, B500000);
|
||||
cfsetspeed(&options, B500000);
|
||||
break;
|
||||
case UartBaudRate::RATE_576000:
|
||||
cfsetispeed(&options, B576000);
|
||||
cfsetospeed(&options, B576000);
|
||||
break;
|
||||
case UartBaudRate::RATE_921600:
|
||||
cfsetispeed(&options, B921600);
|
||||
cfsetospeed(&options, B921600);
|
||||
cfsetspeed(&options, B921600);
|
||||
break;
|
||||
case UartBaudRate::RATE_1000000:
|
||||
cfsetispeed(&options, B1000000);
|
||||
cfsetospeed(&options, B1000000);
|
||||
cfsetspeed(&options, B1000000);
|
||||
break;
|
||||
case UartBaudRate::RATE_1152000:
|
||||
cfsetispeed(&options, B1152000);
|
||||
cfsetospeed(&options, B1152000);
|
||||
cfsetspeed(&options, B1152000);
|
||||
break;
|
||||
case UartBaudRate::RATE_1500000:
|
||||
cfsetispeed(&options, B1500000);
|
||||
cfsetospeed(&options, B1500000);
|
||||
cfsetspeed(&options, B1500000);
|
||||
break;
|
||||
case UartBaudRate::RATE_2000000:
|
||||
cfsetispeed(&options, B2000000);
|
||||
cfsetospeed(&options, B2000000);
|
||||
cfsetspeed(&options, B2000000);
|
||||
break;
|
||||
case UartBaudRate::RATE_2500000:
|
||||
cfsetispeed(&options, B2500000);
|
||||
cfsetospeed(&options, B2500000);
|
||||
cfsetspeed(&options, B2500000);
|
||||
break;
|
||||
case UartBaudRate::RATE_3000000:
|
||||
cfsetispeed(&options, B3000000);
|
||||
cfsetospeed(&options, B3000000);
|
||||
break;
|
||||
case UartBaudRate::RATE_3500000:
|
||||
cfsetispeed(&options, B3500000);
|
||||
cfsetospeed(&options, B3500000);
|
||||
cfsetspeed(&options, B3500000);
|
||||
break;
|
||||
case UartBaudRate::RATE_4000000:
|
||||
cfsetispeed(&options, B4000000);
|
||||
cfsetospeed(&options, B4000000);
|
||||
cfsetspeed(&options, B4000000);
|
||||
break;
|
||||
#endif // ! __APPLE__
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user