rename namespace

This commit is contained in:
Robin Müller 2023-03-22 01:03:49 +01:00
parent 341437df13
commit f8a7c1d4ed
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 14 additions and 14 deletions

View File

@ -88,11 +88,11 @@ int SerialComIF::configureUartPort(SerialCookie* uartCookie) {
return fd; return fd;
} }
uart::setParity(options, uartCookie->getParity()); serial::setParity(options, uartCookie->getParity());
setStopBitOptions(&options, uartCookie); setStopBitOptions(&options, uartCookie);
setDatasizeOptions(&options, uartCookie); setDatasizeOptions(&options, uartCookie);
setFixedOptions(&options); setFixedOptions(&options);
uart::setMode(options, uartCookie->getUartMode()); serial::setMode(options, uartCookie->getUartMode());
if (uartCookie->getInputShouldBeFlushed()) { if (uartCookie->getInputShouldBeFlushed()) {
tcflush(fd, TCIFLUSH); tcflush(fd, TCIFLUSH);
} }
@ -101,7 +101,7 @@ int SerialComIF::configureUartPort(SerialCookie* uartCookie) {
options.c_cc[VTIME] = 0; options.c_cc[VTIME] = 0;
options.c_cc[VMIN] = 0; options.c_cc[VMIN] = 0;
uart::setBaudrate(options, uartCookie->getBaudrate()); serial::setBaudrate(options, uartCookie->getBaudrate());
/* Save option settings */ /* Save option settings */
if (tcsetattr(fd, TCSANOW, &options) != 0) { if (tcsetattr(fd, TCSANOW, &options) != 0) {

View File

@ -3,7 +3,7 @@
#include "fsfw/serviceinterface.h" #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) { if (mode == UartModes::NON_CANONICAL) {
/* Disable canonical mode */ /* Disable canonical mode */
options.c_lflag &= ~ICANON; 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) { switch (baud) {
case UartBaudRate::RATE_50: case UartBaudRate::RATE_50:
cfsetspeed(&options, B50); 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 options.c_cflag &= ~CSIZE; // Clear all the size bits
if (bits == BitsPerWord::BITS_5) { if (bits == BitsPerWord::BITS_5) {
options.c_cflag |= CS5; 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 */ /* Clear parity bit */
options.c_cflag &= ~PARENB; options.c_cflag &= ~PARENB;
switch (parity) { 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); 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) { if (bits == StopBits::TWO_STOP_BITS) {
// Use two stop bits // Use two stop bits
options.c_cflag |= CSTOPB; 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); }

View File

@ -45,7 +45,7 @@ enum class UartBaudRate {
RATE_4000000 RATE_4000000
}; };
namespace uart { namespace serial {
void setMode(struct termios& options, UartModes mode); void setMode(struct termios& options, UartModes mode);
/** /**