From f8a7c1d4ed621a3375db0da9b9e9f8d5484abbc1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Mar 2023 01:03:49 +0100 Subject: [PATCH] rename namespace --- src/fsfw_hal/linux/serial/SerialComIF.cpp | 6 +++--- src/fsfw_hal/linux/serial/helper.cpp | 20 ++++++++++---------- src/fsfw_hal/linux/serial/helper.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/fsfw_hal/linux/serial/SerialComIF.cpp b/src/fsfw_hal/linux/serial/SerialComIF.cpp index 177d74e4..f272e787 100644 --- a/src/fsfw_hal/linux/serial/SerialComIF.cpp +++ b/src/fsfw_hal/linux/serial/SerialComIF.cpp @@ -88,11 +88,11 @@ int SerialComIF::configureUartPort(SerialCookie* uartCookie) { return fd; } - uart::setParity(options, uartCookie->getParity()); + serial::setParity(options, uartCookie->getParity()); setStopBitOptions(&options, uartCookie); setDatasizeOptions(&options, uartCookie); setFixedOptions(&options); - uart::setMode(options, uartCookie->getUartMode()); + serial::setMode(options, uartCookie->getUartMode()); if (uartCookie->getInputShouldBeFlushed()) { tcflush(fd, TCIFLUSH); } @@ -101,7 +101,7 @@ int SerialComIF::configureUartPort(SerialCookie* uartCookie) { options.c_cc[VTIME] = 0; options.c_cc[VMIN] = 0; - uart::setBaudrate(options, uartCookie->getBaudrate()); + serial::setBaudrate(options, uartCookie->getBaudrate()); /* Save option settings */ if (tcsetattr(fd, TCSANOW, &options) != 0) { diff --git a/src/fsfw_hal/linux/serial/helper.cpp b/src/fsfw_hal/linux/serial/helper.cpp index bc344608..c58689c0 100644 --- a/src/fsfw_hal/linux/serial/helper.cpp +++ b/src/fsfw_hal/linux/serial/helper.cpp @@ -3,7 +3,7 @@ #include "fsfw/serviceinterface.h" -void uart::setMode(struct termios& options, UartModes mode) { +void serial::setMode(struct termios& options, UartModes mode) { if (mode == UartModes::NON_CANONICAL) { /* Disable canonical mode */ options.c_lflag &= ~ICANON; @@ -12,7 +12,7 @@ void uart::setMode(struct termios& options, UartModes mode) { } } -void uart::setBaudrate(struct termios& options, UartBaudRate baud) { +void serial::setBaudrate(struct termios& options, UartBaudRate baud) { switch (baud) { case UartBaudRate::RATE_50: cfsetspeed(&options, B50); @@ -114,7 +114,7 @@ void uart::setBaudrate(struct termios& options, UartBaudRate baud) { } } -void uart::setBitsPerWord(struct termios& options, BitsPerWord bits) { +void serial::setBitsPerWord(struct termios& options, BitsPerWord bits) { options.c_cflag &= ~CSIZE; // Clear all the size bits if (bits == BitsPerWord::BITS_5) { options.c_cflag |= CS5; @@ -127,11 +127,11 @@ void uart::setBitsPerWord(struct termios& options, BitsPerWord bits) { } } -void uart::enableRead(struct termios& options) { options.c_cflag |= CREAD; } +void serial::enableRead(struct termios& options) { options.c_cflag |= CREAD; } -void uart::ignoreCtrlLines(struct termios& options) { options.c_cflag |= CLOCAL; } +void serial::ignoreCtrlLines(struct termios& options) { options.c_cflag |= CLOCAL; } -void uart::setParity(struct termios& options, Parity parity) { +void serial::setParity(struct termios& options, Parity parity) { /* Clear parity bit */ options.c_cflag &= ~PARENB; switch (parity) { @@ -148,11 +148,11 @@ void uart::setParity(struct termios& options, Parity parity) { } } -int uart::readCountersAndErrors(int serialPort, serial_icounter_struct& icounter) { +int serial::readCountersAndErrors(int serialPort, serial_icounter_struct& icounter) { return ioctl(serialPort, TIOCGICOUNT, &icounter); } -void uart::setStopbits(struct termios& options, StopBits bits) { +void serial::setStopbits(struct termios& options, StopBits bits) { if (bits == StopBits::TWO_STOP_BITS) { // Use two stop bits options.c_cflag |= CSTOPB; @@ -162,6 +162,6 @@ void uart::setStopbits(struct termios& options, StopBits bits) { } } -void uart::flushRxBuf(int fd) { tcflush(fd, TCIFLUSH); } +void serial::flushRxBuf(int fd) { tcflush(fd, TCIFLUSH); } -void uart::flushTxRxBuf(int fd) { tcflush(fd, TCIOFLUSH); } +void serial::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 833886b1..ee59ac66 100644 --- a/src/fsfw_hal/linux/serial/helper.h +++ b/src/fsfw_hal/linux/serial/helper.h @@ -45,7 +45,7 @@ enum class UartBaudRate { RATE_4000000 }; -namespace uart { +namespace serial { void setMode(struct termios& options, UartModes mode); /**