From 341437df1387aaf0128dd5304b5c0cc8ad734e69 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Mar 2023 20:20:13 +0100 Subject: [PATCH] add flush functions for serial helpers --- src/fsfw_hal/linux/serial/helper.cpp | 4 ++++ src/fsfw_hal/linux/serial/helper.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/fsfw_hal/linux/serial/helper.cpp b/src/fsfw_hal/linux/serial/helper.cpp index ba975f2f..bc344608 100644 --- a/src/fsfw_hal/linux/serial/helper.cpp +++ b/src/fsfw_hal/linux/serial/helper.cpp @@ -161,3 +161,7 @@ void uart::setStopbits(struct termios& options, StopBits bits) { options.c_cflag &= ~CSTOPB; } } + +void uart::flushRxBuf(int fd) { tcflush(fd, TCIFLUSH); } + +void uart::flushTxRxBuf(int fd) { tcflush(fd, TCIOFLUSH); } diff --git a/src/fsfw_hal/linux/serial/helper.h b/src/fsfw_hal/linux/serial/helper.h index 7f067d00..833886b1 100644 --- a/src/fsfw_hal/linux/serial/helper.h +++ b/src/fsfw_hal/linux/serial/helper.h @@ -64,6 +64,9 @@ void setParity(struct termios& options, Parity parity); void ignoreCtrlLines(struct termios& options); +void flushRxBuf(int fd); +void flushTxRxBuf(int fd); + int readCountersAndErrors(int serialPort, serial_icounter_struct& icounter); } // namespace uart