dhb2normal #115

Merged
muellerr merged 11 commits from eive/dhb2normal into develop 2022-11-03 15:32:27 +01:00
Showing only changes of commit 8a61af779d - Show all commits

View File

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