diff --git a/src/fsfw_hal/linux/serial/helper.cpp b/src/fsfw_hal/linux/serial/helper.cpp index c58689c0..af170757 100644 --- a/src/fsfw_hal/linux/serial/helper.cpp +++ b/src/fsfw_hal/linux/serial/helper.cpp @@ -1,8 +1,6 @@ #include #include -#include "fsfw/serviceinterface.h" - void serial::setMode(struct termios& options, UartModes mode) { if (mode == UartModes::NON_CANONICAL) { /* Disable canonical mode */ @@ -153,15 +151,16 @@ int serial::readCountersAndErrors(int serialPort, serial_icounter_struct& icount } void serial::setStopbits(struct termios& options, StopBits bits) { + // Regular case: One stop bit. + options.c_cflag &= ~CSTOPB; if (bits == StopBits::TWO_STOP_BITS) { // Use two stop bits options.c_cflag |= CSTOPB; - } else { - // Clear stop field, only one stop bit used in communication - options.c_cflag &= ~CSTOPB; } } void serial::flushRxBuf(int fd) { tcflush(fd, TCIFLUSH); } void serial::flushTxRxBuf(int fd) { tcflush(fd, TCIOFLUSH); } + +void serial::flushTxBuf(int fd) { tcflush(fd, TCOFLUSH); } diff --git a/src/fsfw_hal/linux/serial/helper.h b/src/fsfw_hal/linux/serial/helper.h index 623612ad..6b93ae91 100644 --- a/src/fsfw_hal/linux/serial/helper.h +++ b/src/fsfw_hal/linux/serial/helper.h @@ -65,6 +65,7 @@ void setParity(struct termios& options, Parity parity); void ignoreCtrlLines(struct termios& options); void flushRxBuf(int fd); +void flushTxBuf(int fd); void flushTxRxBuf(int fd); int readCountersAndErrors(int serialPort, serial_icounter_struct& icounter);