diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..6dfa6b9a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +/build* +generators +misc +tmtc +doc + diff --git a/README.md b/README.md index ec32a2bb..ba18152d 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,7 @@ The CMake build system can be used to generate build systems as well (see helper ### Installing Vivado the the Xilinx development tools It's also possible to perform debugging with a normal Eclipse installation by installing -the TCF plugin. Still, it is necessary to install Vivado to get the toolchain for generating -C++ applications. Alternatively you can download the toolchain -[from the cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486). +the TCF plugin and downloading the cross-compiler as specified in the section below. * Install Vivado 2018.2 and Xilinx SDK from https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html. Install the Vivado Design Suite - HLx Editions - 2018.2 Full Product Installation instead of the updates. It is recommended to use the installer. @@ -53,6 +51,24 @@ C++ applications. Alternatively you can download the toolchain `\SDK\2018.2\gnu\aarch32\nt\gcc-arm-linux-gnueabi\bin` or set up path each time before debugging. +### Installing toolchain without Vivado + +You can download the toolchains for Windows and Linux +[from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files?dir=/EIVE_IRS/Software/tools&fileid=831898). + +If `wget` is available (e.g. MinGW64), you can use the following command to download the +toolchain for Windows + +```sh +wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/rfoaistRd67yBbH/download/gcc-arm-linux-gnueabi-win.zip +``` + +or the following command for Linux (could be useful for CI/CD) + +```sh +wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/2Fp2ag6NGnbtAsK/download/gcc-arm-linux-gnueabi.tar.gz +``` + ### Installing CMake and MSYS2 on Windows 1. Install [MSYS2](https://www.msys2.org/) and [CMake](https://cmake.org/download/) first. @@ -89,7 +105,15 @@ C++ applications. Alternatively you can download the toolchain ## Getting the Q7S system root It is necessary to copy the Q7S system root to your local development machine for libraries -like `libgpio`. You can find the system root [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486). Download it and unzip it somewhere in the Xilinx installation folder. +like `libgpio`. You can find the system root for the Q7S, the Raspberry Pi and the +Beagle Bone Black for download here +[here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs&fileid=831849). +Download it and unzip it somewhere in the Xilinx installation folder. +You can use the following command if `wget` can be used or for CI/CD: + +``` +wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz +``` Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path. @@ -116,18 +140,30 @@ When using Windows, run theses steps in MSYS2. or to set up the [PATH and the CROSS_COMPILE variable permanently](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path) in the `.profile` file. -4. Run the CMake configuration to create the build system in a `Debug` folder. - Navigate into the `eive_obsw` folder first. - +4. Run the CMake configuration to create the build system in a `build-Debug-Q7S` folder. + Add `-G "MinGW Makefiles` in MinGW64 on Windows. + + ```sh + mkdir build-Debug-Q7S && cd build-Debug-Q7S + cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DOS_FSFW=linux .. + cmake --build . -j + ``` + + You can also use provided shell scripts to perform these commands + ```sh cd cmake/scripts/Q7S ./create_cmake_debug.sh cd ../../.. ``` - + This will invoke a Python script which in turn invokes CMake with the correct arguments to configure CMake for Q7S cross-compilation. + You can build the hosted variant of the OBSW by replacing `-DOS_FSFW=linux` with + `-DOS_FSFW=host`. There are also different values for `-DTGT_BSP` to build for the Raspberry Pi + or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`. + 5. Build the software with ```sh cd Debug @@ -529,6 +565,38 @@ GET out_en[0] = 1 * Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel) * Remote File Path: /tmp/eive_obsw.elf +## Running cppcheck on the Software + +Static code analysis can be useful to find bugs. +`cppcheck` can be used for this purpose. On Windows you can use MinGW64 to do this. + +```sh +pacman -S mingw-w64-x86_64-cppcheck +``` + +On Ubuntu, install with + +```sh +sudo apt-get install cppcheck +``` + +You can use the Eclipse integration or you can perform the scanning manually from the command line. +CMake will be used for this. + +Run the CMake build generation commands specified above but supply +`-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to the build generation. Invoking the build command will +generate a `compile_commands.json` file which can be used by cppcheck. + +```sh +cppcheck --project=compile_commands.json --xml 2> report.xml +``` + +Finally, you can convert the generated `.xml` file to HTML with the following command + +```sh +cppcheck-htmlreport --file=report.xml --report-dir=cppcheck --source-dir=.. +``` + ## Libgpiod Detect all gpio device files: @@ -598,4 +666,4 @@ This shows the memory mapping of /dev/i2c-0 Rebooting currently running image: ```` xsc_boot_copy -r -```` \ No newline at end of file +```` diff --git a/bsp_hosted/Dockerfile b/bsp_hosted/Dockerfile new file mode 100644 index 00000000..dccf909a --- /dev/null +++ b/bsp_hosted/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:latest +# FROM alpine:latest + +RUN apt-get update && apt-get install -y cmake g++ +# RUN apk add cmake make g++ + +WORKDIR /usr/src/app +COPY . . + +RUN set -ex; \ + rm -rf build-hosted; \ + mkdir build-hosted; \ + cd build-hosted; \ + cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux ..; + +ENTRYPOINT ["cmake", "--build", "build-hosted"] +CMD ["-j"] +# CMD ["bash"] diff --git a/bsp_linux_board/Dockerfile b/bsp_linux_board/Dockerfile new file mode 100644 index 00000000..970b44db --- /dev/null +++ b/bsp_linux_board/Dockerfile @@ -0,0 +1,37 @@ +FROM ubuntu:latest +# FROM alpine:latest + +RUN apt-get update && apt-get install -y curl wget cmake g++ + +# Raspberry Pi rootfs +RUN mkdir -p /usr/rootfs; \ + curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/kJe3nCnGPRGKFCz/download/rpi-rootfs.tar.gz /usr/rootfs \ + | tar xvz -C /usr/rootfs +# Raspberry Pi toolchain +RUN mkdir -p /opt; \ + cd /opt; \ + wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz; \ + tar xfz raspi-toolchain.tar.gz --strip-components=1 -C .; \ + rm -rf raspi-toolchain.tar.gz + +# RUN apk add cmake make g++ + +# Required for cmake build +ENV RASPBERRY_VERSION="4" +ENV RASPBIAN_ROOTFS="/usr/rootfs/rootfs" +ENV PATH=$PATH:"/opt/cross-pi-gcc/bin" +ENV CROSS_COMPILE="arm-linux-gnueabihf" + +WORKDIR /usr/src/app +COPY . . + +RUN set -ex; \ + rm -rf build-rpi; \ + mkdir build-rpi; \ + cd build-rpi; \ + cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux -DTGT_BSP="arm/raspberrypi" ..; + +ENTRYPOINT ["cmake", "--build", "build-rpi"] +CMD ["-j"] +# CMD ["bash"] + diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 40c38e6c..154797dc 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -1,9 +1,9 @@ #include "InitMission.h" #include "ObjectFactory.h" -#include -#include -#include +#include "objects/systemObjectList.h" +#include "OBSWConfig.h" +#include "pollingsequence/pollingSequenceFactory.h" #include #include @@ -125,10 +125,10 @@ void initmission::initTasks() { initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); } -#if RPI_TEST_ACS_BOARD == 1 - FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask( +#if OBSW_ADD_TEST_PST == 1 + FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask( "ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); - result = pst::pollingSequenceAcsTest(acsTask); + result = pst::pollingSequenceTest(pstTestTask); if(result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl; } @@ -170,8 +170,8 @@ void initmission::initTasks() { testTask->startTask(); #endif /* OBSW_ADD_TEST_CODE == 1 */ -#if RPI_TEST_ACS_BOARD == 1 - acsTask->startTask(); +#if OBSW_ADD_TEST_PST == 1 + pstTestTask->startTask(); #endif /* RPI_TEST_ACS_BOARD == 1 */ sif::info << "Tasks started.." << std::endl; } diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 0518ac87..21a2ec07 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -1,12 +1,12 @@ #include "ObjectFactory.h" -#include -#include -#include -#include -#include -#include -#include +#include "objects/systemObjectList.h" +#include "devices/addresses.h" +#include "devices/gpioIds.h" +#include "OBSWConfig.h" +#include "tmtc/apid.h" +#include "tmtc/pusIds.h" +#include "spiConf.h" #include #include @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -56,9 +57,7 @@ void ObjectFactory::produce(){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); - new UdpTmTcBridge(objects::UDP_BRIDGE, - objects::CCSDS_PACKET_DISTRIBUTOR, - objects::TM_STORE, objects::TC_STORE); + new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF); @@ -122,4 +121,18 @@ void ObjectFactory::produce(){ gyroL3gHandler->setStartUpImmediately(); #endif /* RPI_TEST_ACS_BOARD == 1 */ + +#if RPI_TEST_ADIS16507 == 1 + GpioCookie* gpioCookieAcsBoard = new GpioCookie(); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, + "GYRO_0_ADIS", gpio::Direction::OUT, 1); + gpioIF->addGpios(gpioCookieAcsBoard); + + std::string spiDev = "/dev/spidev0.0"; + SpiCookie* spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED, + nullptr, nullptr); + auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); + adisGyroHandler->setStartUpImmediately(); +#endif /* RPI_TEST_ADIS16507 == 1 */ } diff --git a/bsp_linux_board/boardconfig/rpi_config.h b/bsp_linux_board/boardconfig/rpi_config.h index a9f4fd9f..31d6c157 100644 --- a/bsp_linux_board/boardconfig/rpi_config.h +++ b/bsp_linux_board/boardconfig/rpi_config.h @@ -6,6 +6,8 @@ #define RPI_ADD_GPIO_TEST 0 #define RPI_LOOPBACK_TEST_GPIO 0 +#define RPI_TEST_ADIS16507 1 + /* Only one of those 2 should be enabled! */ #define RPI_ADD_SPI_TEST 0 #define RPI_TEST_ACS_BOARD 0 diff --git a/bsp_q7s/Dockerfile b/bsp_q7s/Dockerfile new file mode 100644 index 00000000..73bdd069 --- /dev/null +++ b/bsp_q7s/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:latest +# FROM alpine:latest + +RUN apt-get update && apt-get install -y curl cmake g++ + +# Q7S root filesystem, required for cross-compilation +RUN mkdir -p /usr/rootfs; \ + curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \ + | tar xvz -C /usr/rootfs +# Q7S C++ cross-compiler +RUN mkdir -p /usr/tools; \ + curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/2Fp2ag6NGnbtAsK/download/gcc-arm-linux-gnueabi.tar.gz \ + | tar xvz -C /usr/tools + +# RUN apk add cmake make g++ + +# Required for cmake build +ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi" +ENV PATH=$PATH:"/usr/tools/gcc-arm-linux-gnueabi/bin" + +WORKDIR /usr/src/app +COPY . . + +RUN set -ex; \ + rm -rf build-q7s; \ + mkdir build-q7s; \ + cd build-q7s; \ + cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux -DTGT_BSP="arm/q7s" ..; + +ENTRYPOINT ["cmake", "--build", "build-q7s"] +CMD ["-j"] +# CMD ["bash"] diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 85573bbd..6629c0bd 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -5,7 +5,7 @@ #include "devices/gpioIds.h" #include "tmtc/pusIds.h" #include "devices/powerSwitcherList.h" -#include "devices/spi.h" +#include "spiConf.h" #include diff --git a/cmake/scripts/RPi/create_cmake_debug_cfg.sh b/cmake/scripts/RPi/create_cmake_debug_cfg.sh index d0ec5d76..57561846 100755 --- a/cmake/scripts/RPi/create_cmake_debug_cfg.sh +++ b/cmake/scripts/RPi/create_cmake_debug_cfg.sh @@ -17,7 +17,7 @@ fi os_fsfw="linux" tgt_bsp="arm/raspberrypi" build_generator="" -build_dir="Debug-RPi" +build_dir="build-Debug-RPi" if [ "${OS}" = "Windows_NT" ]; then build_generator="MinGW Makefiles" # Could be other OS but this works for now. diff --git a/cmake/scripts/RPi/create_cmake_release_cfg.sh b/cmake/scripts/RPi/create_cmake_release_cfg.sh index 4eb9b38a..10e4b777 100755 --- a/cmake/scripts/RPi/create_cmake_release_cfg.sh +++ b/cmake/scripts/RPi/create_cmake_release_cfg.sh @@ -17,7 +17,7 @@ fi os_fsfw="linux" tgt_bsp="arm/raspberrypi" build_generator="" -build_dir="Release-RPi" +build_dir="build-Release-RPi" if [ "${OS}" = "Windows_NT" ]; then build_generator="MinGW Makefiles" # Could be other OS but this works for now. diff --git a/linux/fsfwconfig/devices/spi.h b/common/config/spiConf.h similarity index 77% rename from linux/fsfwconfig/devices/spi.h rename to common/config/spiConf.h index eb17786b..2632924d 100644 --- a/linux/fsfwconfig/devices/spi.h +++ b/common/config/spiConf.h @@ -1,5 +1,5 @@ -#ifndef FSFWCONFIG_DEVICES_SPI_H_ -#define FSFWCONFIG_DEVICES_SPI_H_ +#ifndef COMMON_CONFIG_SPICONF_H_ +#define COMMON_CONFIG_SPICONF_H_ #include #include @@ -23,8 +23,9 @@ static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; +static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; +static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; + } - - -#endif /* FSFWCONFIG_DEVICES_SPI_H_ */ +#endif /* COMMON_CONFIG_SPICONF_H_ */ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..66073617 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.8" + +services: + build-host: + build: + context: . + dockerfile: bsp_hosted/Dockerfile + + build-obsw: + build: + context: . + dockerfile: bsp_q7s/Dockerfile + + build-rpi: + build: + context: . + dockerfile: bsp_linux_board/Dockerfile + diff --git a/fsfw_hal b/fsfw_hal index a0f698ff..4ba4e457 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit a0f698fffa4dd5c9f86337c5d6170f9321cb8de7 +Subproject commit 4ba4e45789a9fc37c8ff45d09b7986ee1dbd53ca diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index a078035a..8314ee97 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(csp) -add_subdirectory(uart) add_subdirectory(utility) add_subdirectory(boardtest) add_subdirectory(devices) diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index 1798b152..a8f13963 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -82,7 +82,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF *cookie, /* Extract csp port and bytes to query from command buffer */ uint8_t cspPort; - uint16_t querySize; + uint16_t querySize = 0; result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize); if(result != HasReturnvaluesIF::RETURN_OK) { return result; diff --git a/linux/fsfwconfig/FSFWConfig.h b/linux/fsfwconfig/FSFWConfig.h index 8095bd12..8ec01cb9 100644 --- a/linux/fsfwconfig/FSFWConfig.h +++ b/linux/fsfwconfig/FSFWConfig.h @@ -68,4 +68,6 @@ static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; } +#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 + #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/OBSWConfig.h b/linux/fsfwconfig/OBSWConfig.h index 9426d01b..c4441eef 100644 --- a/linux/fsfwconfig/OBSWConfig.h +++ b/linux/fsfwconfig/OBSWConfig.h @@ -19,22 +19,29 @@ debugging. */ #define OBSW_VERBOSE_LEVEL 1 #define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_ADD_TEST_CODE 1 +#define OBSW_ADD_TEST_PST 1 + #define TEST_LIBGPIOD 0 #define TEST_RADIATION_SENSOR_HANDLER 1 #define TEST_SUS_HANDLER 1 #define TEST_PLOC_HANDLER 0 -#define TE0720 0 -#define TE0720_HEATER_TEST 0 +#define TE0720 0 +#define TE0720_HEATER_TEST 0 -#define P60DOCK_DEBUG 0 -#define PDU1_DEBUG 0 -#define PDU2_DEBUG 0 -#define ACU_DEBUG 0 -#define SYRLINKS_DEBUG 0 -#define IMQT_DEBUG 0 -#define DEBUG_RAD_SENSOR 1 -#define DEBUG_SUS 1 +#define P60DOCK_DEBUG 0 +#define PDU1_DEBUG 0 +#define PDU2_DEBUG 0 +#define ACU_DEBUG 0 +#define SYRLINKS_DEBUG 0 +#define IMQT_DEBUG 0 +#define ADIS16507_DEBUG 1 +#define L3GD20_GYRO_DEBUG 0 +#define DEBUG_RAD_SENSOR 1 +#define DEBUG_SUS 1 + +// Leave at one as the BSP is linux. Used by the ADIS16507 device handler +#define OBSW_ADIS16507_LINUX_COM_IF 1 #include "OBSWVersion.h" diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index a8c7312b..64ffb4e1 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -471,28 +471,38 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); + if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Initialization of GomSpace PST failed" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t pst::pollingSequenceTest(FixedTimeslotTaskIF* thisSequence) { + /* Length of a communication cycle */ + uint32_t length = thisSequence->getPeriodMs(); #if OBSW_ADD_ACS_BOARD == 1 thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -519,18 +529,18 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); @@ -540,14 +550,23 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - #endif - if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { - sif::error << "Initialization of GomSpace PST failed" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; +#if RPI_TEST_ADIS16507 == 1 + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); +#endif + + if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { + return HasReturnvaluesIF::RETURN_OK; } - return HasReturnvaluesIF::RETURN_OK; + + sif::error << "PollingSequence::initialize has errors!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; } ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) { diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h index 73cdc0bb..e05f96aa 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h @@ -34,7 +34,7 @@ ReturnValue_t pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence); */ ReturnValue_t gomspacePstInit(FixedTimeslotTaskIF *thisSequence); -ReturnValue_t pollingSequenceAcsTest(FixedTimeslotTaskIF* thisSequence); +ReturnValue_t pollingSequenceTest(FixedTimeslotTaskIF* thisSequence); /** * @brief This polling sequence will be created when the software is compiled for the TE0720. diff --git a/linux/uart/CMakeLists.txt b/linux/uart/CMakeLists.txt deleted file mode 100644 index 7b503d02..00000000 --- a/linux/uart/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -target_sources(${TARGET_NAME} PUBLIC - UartComIF.cpp - UartCookie.cpp -) - - - - diff --git a/linux/uart/UartComIF.cpp b/linux/uart/UartComIF.cpp deleted file mode 100644 index 8d9a15c3..00000000 --- a/linux/uart/UartComIF.cpp +++ /dev/null @@ -1,371 +0,0 @@ -#include "UartComIF.h" - -#include -#include - -#include -#include -#include -#include - -UartComIF::UartComIF(object_id_t objectId): SystemObject(objectId){ -} - -UartComIF::~UartComIF() {} - -ReturnValue_t UartComIF::initializeInterface(CookieIF * cookie) { - - std::string deviceFile; - UartDeviceMapIter uartDeviceMapIter; - - if(cookie == nullptr) { - return NULLPOINTER; - } - - UartCookie* uartCookie = dynamic_cast(cookie); - if (uartCookie == nullptr) { - sif::error << "UartComIF::initializeInterface: Invalid UART Cookie!" << std::endl; - return NULLPOINTER; - } - - deviceFile = uartCookie->getDeviceFile(); - - uartDeviceMapIter = uartDeviceMap.find(deviceFile); - if(uartDeviceMapIter == uartDeviceMap.end()) { - int fileDescriptor = configureUartPort(uartCookie); - if (fileDescriptor < 0) { - return RETURN_FAILED; - } - size_t maxReplyLen = uartCookie->getMaxReplyLen(); - UartElements_t uartElements = {fileDescriptor, std::vector(maxReplyLen), 0}; - std::pair status = uartDeviceMap.emplace(deviceFile, uartElements); - if (status.second == false) { - sif::debug << "UartComIF::initializeInterface: Failed to insert device " << deviceFile - << "to Uart device map" << std::endl; - return RETURN_FAILED; - } - } - else { - sif::debug << "UartComIF::initializeInterface: Uart device " << deviceFile << "already in " - << "use" << std::endl; - return RETURN_FAILED; - } - - return RETURN_OK; -} - -int UartComIF::configureUartPort(UartCookie* uartCookie) { - - struct termios options; - - std::string deviceFile = uartCookie->getDeviceFile(); - int fd = open(deviceFile.c_str(), O_RDWR); - - if (fd < 0) { - sif::debug << "UartComIF::configureUartPort: Failed to open uart " << deviceFile << "with" - << " error code " << errno << strerror(errno) << std::endl; - return fd; - } - - /* Read in existing settings */ - if(tcgetattr(fd, &options) != 0) { - sif::debug << "UartComIF::configureUartPort: Error " << errno << "from tcgetattr: " - << strerror(errno) << std::endl; - return fd; - } - - setParityOptions(&options, uartCookie); - setStopBitOptions(&options, uartCookie); - setDatasizeOptions(&options, uartCookie); - setFixedOptions(&options); - - /* Sets uart to non-blocking mode. Read returns immediately when there are no data available */ - options.c_cc[VTIME] = 0; - options.c_cc[VMIN] = 0; - - configureBaudrate(&options, uartCookie); - - /* Save option settings */ - if (tcsetattr(fd, TCSANOW, &options) != 0) { - sif::debug << "UartComIF::configureUartPort: Failed to set options with error " << errno - << ": " << strerror(errno); - return fd; - } - return fd; -} - -void UartComIF::setParityOptions(struct termios* options, UartCookie* uartCookie) { - /* Clear parity bit */ - options->c_cflag &= ~PARENB; - switch (uartCookie->getParity()) { - case Parity::EVEN: - options->c_cflag |= PARENB; - options->c_cflag &= ~PARODD; - break; - case Parity::ODD: - options->c_cflag |= PARENB; - options->c_cflag |= PARODD; - break; - default: - break; - } -} - -void UartComIF::setStopBitOptions(struct termios* options, UartCookie* uartCookie) { - /* Clear stop field. Sets stop bit to one bit */ - options->c_cflag &= ~CSTOPB; - switch (uartCookie->getStopBits()) { - case StopBits::TWO_STOP_BITS: - options->c_cflag |= CSTOPB; - break; - default: - break; - } -} - -void UartComIF::setDatasizeOptions(struct termios* options, UartCookie* uartCookie) { - /* Clear size bits */ - options->c_cflag &= ~CSIZE; - switch (uartCookie->getBitsPerWord()) { - case 5: - options->c_cflag |= CS5; - break; - case 6: - options->c_cflag |= CS6; - break; - case 7: - options->c_cflag |= CS7; - break; - case 8: - options->c_cflag |= CS8; - break; - default: - sif::debug << "UartComIF::setDatasizeOptions: Invalid size specified" << std::endl; - break; - } -} - -void UartComIF::setFixedOptions(struct termios* options) { - /* Disable RTS/CTS hardware flow control */ - options->c_cflag &= ~CRTSCTS; - /* Turn on READ & ignore ctrl lines (CLOCAL = 1) */ - options->c_cflag |= CREAD | CLOCAL; - /* Disable canonical mode */ - options->c_lflag &= ~ICANON; - /* Disable echo */ - options->c_lflag &= ~ECHO; - /* Disable erasure */ - options->c_lflag &= ~ECHOE; - /* Disable new-line echo */ - options->c_lflag &= ~ECHONL; - /* Disable interpretation of INTR, QUIT and SUSP */ - options->c_lflag &= ~ISIG; - /* Turn off s/w flow ctrl */ - options->c_iflag &= ~(IXON | IXOFF | IXANY); - /* Disable any special handling of received bytes */ - options->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL); - /* Prevent special interpretation of output bytes (e.g. newline chars) */ - options->c_oflag &= ~OPOST; - /* Prevent conversion of newline to carriage return/line feed */ - options->c_oflag &= ~ONLCR; -} - -void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCookie) { - switch (uartCookie->getBaudrate()) { - case 50: - cfsetispeed(options, B50); - cfsetospeed(options, B50); - break; - case 75: - cfsetispeed(options, B75); - cfsetospeed(options, B75); - break; - case 110: - cfsetispeed(options, B110); - cfsetospeed(options, B110); - break; - case 134: - cfsetispeed(options, B134); - cfsetospeed(options, B134); - break; - case 150: - cfsetispeed(options, B150); - cfsetospeed(options, B150); - break; - case 200: - cfsetispeed(options, B200); - cfsetospeed(options, B200); - break; - case 300: - cfsetispeed(options, B300); - cfsetospeed(options, B300); - break; - case 600: - cfsetispeed(options, B600); - cfsetospeed(options, B600); - break; - case 1200: - cfsetispeed(options, B1200); - cfsetospeed(options, B1200); - break; - case 1800: - cfsetispeed(options, B1800); - cfsetospeed(options, B1800); - break; - case 2400: - cfsetispeed(options, B2400); - cfsetospeed(options, B2400); - break; - case 4800: - cfsetispeed(options, B4800); - cfsetospeed(options, B4800); - break; - case 9600: - cfsetispeed(options, B9600); - cfsetospeed(options, B9600); - break; - case 19200: - cfsetispeed(options, B19200); - cfsetospeed(options, B19200); - break; - case 38400: - cfsetispeed(options, B38400); - cfsetospeed(options, B38400); - break; - case 57600: - cfsetispeed(options, B57600); - cfsetospeed(options, B57600); - break; - case 115200: - cfsetispeed(options, B115200); - cfsetospeed(options, B115200); - break; - case 230400: - cfsetispeed(options, B230400); - cfsetospeed(options, B230400); - break; - case 460800: - cfsetispeed(options, B460800); - cfsetospeed(options, B460800); - break; - default: - sif::debug << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl; - break; - } -} - -ReturnValue_t UartComIF::sendMessage(CookieIF *cookie, - const uint8_t *sendData, size_t sendLen) { - - int fd; - std::string deviceFile; - UartDeviceMapIter uartDeviceMapIter; - - if(sendData == nullptr) { - sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl; - return RETURN_FAILED; - } - - if(sendLen == 0) { - return RETURN_OK; - } - - UartCookie* uartCookie = dynamic_cast(cookie); - if(uartCookie == nullptr) { - sif::debug << "UartComIF::sendMessasge: Invalid Uart Cookie!" << std::endl; - return NULLPOINTER; - } - - deviceFile = uartCookie->getDeviceFile(); - uartDeviceMapIter = uartDeviceMap.find(deviceFile); - if (uartDeviceMapIter == uartDeviceMap.end()) { - sif::debug << "UartComIF::sendMessage: Device file " << deviceFile << "not in uart map" - << std::endl; - return RETURN_FAILED; - } - - fd = uartDeviceMapIter->second.fileDescriptor; - - if (write(fd, sendData, sendLen) != (int)sendLen) { - sif::error << "UartComIF::sendMessage: Failed to send data with error code " << errno - << ": Error description: " << strerror(errno) << std::endl; - return RETURN_FAILED; - } - - return RETURN_OK; -} - -ReturnValue_t UartComIF::getSendSuccess(CookieIF *cookie) { - return RETURN_OK; -} - -ReturnValue_t UartComIF::requestReceiveMessage(CookieIF *cookie, - size_t requestLen) { - - int fd; - std::string deviceFile; - UartDeviceMapIter uartDeviceMapIter; - uint8_t* bufferPtr; - - if(requestLen == 0) { - return RETURN_OK; - } - - UartCookie* uartCookie = dynamic_cast(cookie); - if(uartCookie == nullptr) { - sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl; - return NULLPOINTER; - } - - deviceFile = uartCookie->getDeviceFile(); - uartDeviceMapIter = uartDeviceMap.find(deviceFile); - if (uartDeviceMapIter == uartDeviceMap.end()) { - sif::debug << "UartComIF::requestReceiveMessage: Device file " << deviceFile - << " not in uart map" << std::endl; - return RETURN_FAILED; - } - - fd = uartDeviceMapIter->second.fileDescriptor; - bufferPtr = uartDeviceMapIter->second.replyBuffer.data(); - int bytesRead = read(fd, bufferPtr, requestLen); - if (bytesRead != static_cast(requestLen)) { - sif::debug << "UartComIF::requestReceiveMessage: Only read " << bytesRead - << " of " << requestLen << " bytes" << std::endl; - return RETURN_FAILED; - } - else { - uartDeviceMapIter->second.replyLen = bytesRead; - } - - return RETURN_OK; -} - -ReturnValue_t UartComIF::readReceivedMessage(CookieIF *cookie, - uint8_t **buffer, size_t* size) { - - std::string deviceFile; - UartDeviceMapIter uartDeviceMapIter; - - UartCookie* uartCookie = dynamic_cast(cookie); - if(uartCookie == nullptr) { - sif::debug << "UartComIF::readReceivedMessage: Invalid uart cookie!" << std::endl; - return NULLPOINTER; - } - - deviceFile = uartCookie->getDeviceFile(); - uartDeviceMapIter = uartDeviceMap.find(deviceFile); - if (uartDeviceMapIter == uartDeviceMap.end()) { - sif::debug << "UartComIF::readReceivedMessage: Device file " << deviceFile - << " not in uart map" << std::endl; - return RETURN_FAILED; - } - - *buffer = uartDeviceMapIter->second.replyBuffer.data(); - *size = uartDeviceMapIter->second.replyLen; - - /* Length is reset to 0 to prevent reading the same data twice */ - uartDeviceMapIter->second.replyLen = 0; - - return RETURN_OK; -} - diff --git a/linux/uart/UartComIF.h b/linux/uart/UartComIF.h deleted file mode 100644 index 9dd854da..00000000 --- a/linux/uart/UartComIF.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_ -#define BSP_Q7S_COMIF_UARTCOMIF_H_ - -#include -#include - -#include -#include - -#include "UartCookie.h" - -/** - * @brief This is the communication interface to access serial ports on linux based operating - * systems. - * - * @details The implementation follows the instructions from https://blog.mbedded.ninja/programming/ - * operating-systems/linux/linux-serial-ports-using-c-cpp/#disabling-canonical-mode - * - * @author J. Meier - */ -class UartComIF: public DeviceCommunicationIF, public SystemObject { -public: - UartComIF(object_id_t objectId); - - virtual ~UartComIF(); - - ReturnValue_t initializeInterface(CookieIF * cookie) override; - ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, - size_t sendLen) override; - ReturnValue_t getSendSuccess(CookieIF *cookie) override; - ReturnValue_t requestReceiveMessage(CookieIF *cookie, - size_t requestLen) override; - ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, - size_t *size) override; - -private: - - using UartDeviceFile_t = std::string; - - typedef struct UartElements { - int fileDescriptor; - std::vector replyBuffer; - /** Number of bytes read will be written to this variable */ - size_t replyLen; - } UartElements_t; - - using UartDeviceMap = std::unordered_map; - using UartDeviceMapIter = UartDeviceMap::iterator; - - /** - * The uart devie map stores informations of initialized uart ports. - */ - UartDeviceMap uartDeviceMap; - - /** - * @brief This function opens and configures a uart device by using the information stored - * in the uart cookie. - * @param uartCookie Pointer to uart cookie with information about the uart. Contains the - * uart device file, baudrate, parity, stopbits etc. - * @return The file descriptor of the configured uart. - */ - int configureUartPort(UartCookie* uartCookie); - - /** - * @brief This function adds the parity settings to the termios options struct. - * - * @param options Pointer to termios options struct which will be modified to enable or disable - * parity checking. - * @param uartCookie Pointer to uart cookie containing the information about the desired - * parity settings. - * - */ - void setParityOptions(struct termios* options, UartCookie* uartCookie); - - void setStopBitOptions(struct termios* options, UartCookie* uartCookie); - - /** - * @brief This function sets options which are not configurable by the uartCookie. - */ - void setFixedOptions(struct termios* options); - - /** - * @brief With this function the datasize settings are added to the termios options struct. - */ - void setDatasizeOptions(struct termios* options, UartCookie* uartCookie); - - /** - * @brief This functions adds the baudrate specified in the uartCookie to the termios options - * struct. - */ - void configureBaudrate(struct termios* options, UartCookie* uartCookie); -}; - -#endif /* BSP_Q7S_COMIF_UARTCOMIF_H_ */ diff --git a/linux/uart/UartCookie.cpp b/linux/uart/UartCookie.cpp deleted file mode 100644 index b8149388..00000000 --- a/linux/uart/UartCookie.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "UartCookie.h" - -#include - -UartCookie::UartCookie(std::string deviceFile, uint32_t baudrate, size_t maxReplyLen) : - deviceFile(deviceFile), baudrate(baudrate), maxReplyLen(maxReplyLen) { -} - -UartCookie::~UartCookie() {} - -uint32_t UartCookie::getBaudrate() const { - return baudrate; -} - -size_t UartCookie::getMaxReplyLen() const { - return maxReplyLen; -} - -std::string UartCookie::getDeviceFile() const { - return deviceFile; -} - -void UartCookie::setParityOdd() { - parity = Parity::ODD; -} - -void UartCookie::setParityEven() { - parity = Parity::EVEN; -} - -Parity UartCookie::getParity() const { - return parity; -} - -void UartCookie::setBitsPerWord(uint8_t bitsPerWord_) { - switch(bitsPerWord_) { - case 5: - case 6: - case 7: - case 8: - break; - default: - sif::debug << "UartCookie::setBitsPerWord: Invalid bits per word specified" << std::endl; - return; - } - bitsPerWord = bitsPerWord_; -} - -uint8_t UartCookie::getBitsPerWord() const { - return bitsPerWord; -} - -StopBits UartCookie::getStopBits() const { - return stopBits; -} - -void UartCookie::setTwoStopBits() { - stopBits = StopBits::TWO_STOP_BITS; -} - -void UartCookie::setOneStopBit() { - stopBits = StopBits::ONE_STOP_BIT; -} diff --git a/linux/uart/UartCookie.h b/linux/uart/UartCookie.h deleted file mode 100644 index 59004719..00000000 --- a/linux/uart/UartCookie.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ -#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ - -#include -#include - -enum class Parity { - NONE, - EVEN, - ODD -}; - -enum class StopBits { - ONE_STOP_BIT, - TWO_STOP_BITS -}; - -/** - * @brief Cookie for the UartComIF. There are many options available to configure the uart driver. - * The constructor only requests for common options like the baudrate. Other options can - * be set by member functions. - * - * @author J. Meier - */ -class UartCookie: public CookieIF { -public: - - /** - * @brief Constructor for the uart cookie. - * @param deviceFile The device file specifying the uart to use. E.g. "/dev/ttyPS1". - * @param baudrate The baudrate to use for input and output. Possible Baudrates are: 50, - * 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, B19200, - * 38400, 57600, 115200, 230400, 460800 - * @param maxReplyLen The maximum size an object using this cookie expects. - * - * @details Default configuration: No parity - * 8 databits (number of bits transfered with one uart frame) - * One stop bit - * - * - */ - UartCookie(std::string deviceFile, uint32_t baudrate, size_t maxReplyLen); - - virtual ~UartCookie(); - - uint32_t getBaudrate() const; - size_t getMaxReplyLen() const; - std::string getDeviceFile() const; - Parity getParity() const; - uint8_t getBitsPerWord() const; - StopBits getStopBits() const; - - /** - * Functions two enable parity checking. - */ - void setParityOdd(); - void setParityEven(); - - /** - * Function two set number of bits per UART frame. - */ - void setBitsPerWord(uint8_t bitsPerWord_); - - /** - * Function to specify the number of stopbits. - */ - void setTwoStopBits(); - void setOneStopBit(); - - -private: - - std::string deviceFile; - uint32_t baudrate; - size_t maxReplyLen = 0; - Parity parity = Parity::NONE; - uint8_t bitsPerWord = 8; - StopBits stopBits = StopBits::ONE_STOP_BIT; -}; - -#endif diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 1b85c534..16685a01 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -19,7 +19,7 @@ - + @@ -121,7 +121,7 @@ - +