From df712c71000fa129a95bd2a6311a78a8109713e3 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 25 Mar 2022 17:48:38 +0100 Subject: [PATCH] scex reader task started --- bsp_linux_board/InitMission.cpp | 8 ++++++++ bsp_linux_board/ObjectFactory.cpp | 2 ++ linux/boardtest/UartTestClass.cpp | 1 + linux/devices/CMakeLists.txt | 3 +++ linux/devices/ScexUartReader.cpp | 18 ++++++++++++++++++ linux/devices/ScexUartReader.h | 18 ++++++++++++++++++ linux/fsfwconfig/objects/systemObjectList.h | 2 ++ 7 files changed, 52 insertions(+) create mode 100644 linux/devices/ScexUartReader.cpp create mode 100644 linux/devices/ScexUartReader.h diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 6dfe3af1..0a242209 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -228,7 +228,15 @@ void initmission::createTestTasks(TaskFactory& factory, if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } + PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask( + "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = scexReaderTask->addComponent(objects::SCEX_UART_READER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); + } + #endif /* RPI_ADD_GPIO_TEST == 1 */ + taskVec.push_back(scexReaderTask); taskVec.push_back(testTask); bool startTestPst = true; diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 18da8896..7df6b116 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -1,3 +1,4 @@ +#include #include "ObjectFactory.h" #include "OBSWConfig.h" @@ -182,6 +183,7 @@ void ObjectFactory::createTestTasks() { #endif #if OBSW_ADD_UART_TEST_CODE == 1 + new ScexUartReader(objects::SCEX_UART_READER); new UartTestClass(objects::UART_TEST); #else new UartComIF(objects::UART_COM_IF); diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 9c51ed8a..bfa735e9 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -197,6 +197,7 @@ void UartTestClass::scexPeriodic() { sif::info << "Received " << bytesRead << " bytes from the Solar Cell Experiment:" << std::endl; arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); + break; } } while (bytesRead > 0); } diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 7d39837d..1130e7cd 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -4,4 +4,7 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER) ) endif() +target_sources(${OBSW_NAME} PRIVATE + ScexUartReader.cpp +) add_subdirectory(startracker) diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp new file mode 100644 index 00000000..4aa78357 --- /dev/null +++ b/linux/devices/ScexUartReader.cpp @@ -0,0 +1,18 @@ +#include "ScexUartReader.h" +#include + + +ScexUartReader::ScexUartReader(object_id_t objectId):SystemObject(objectId) { +} + +void ScexUartRead::start() { + semaphore->give(); +} +ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { + std::cout<<"hallo welt"<take(); + while(true) { + semaphore->take(); + } + return RETURN_OK; +} diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h new file mode 100644 index 00000000..70eafcf7 --- /dev/null +++ b/linux/devices/ScexUartReader.h @@ -0,0 +1,18 @@ +#ifndef LINUX_DEVICES_SCEXUARTREADER_H_ +#define LINUX_DEVICES_SCEXUARTREADER_H_ +#include +#include + + +class ScexUartReader: public SystemObject, //strg+shift+n +public ExecutableObjectIF, +public HasReturnvaluesIF { +public: + ScexUartReader(object_id_t objectId); +private: + ReturnValue_t performOperation(uint8_t operationCode = 0) override; + +}; + + +#endif /* LINUX_DEVICES_SCEXUARTREADER_H_ */ diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index a03e4d38..5fbc99d5 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -49,6 +49,7 @@ enum sourceObjects : uint32_t { UART_COM_IF = 0x49030003, SPI_COM_IF = 0x49020004, GPIO_IF = 0x49010005, + SCEX_UART_READER = 0x49010006, /* Custom device handler */ PCDU_HANDLER = 0x442000A1, @@ -57,6 +58,7 @@ enum sourceObjects : uint32_t { HEATER_HANDLER = 0x444100A4, RAD_SENSOR = 0x443200A5, + /* 0x54 ('T') for test handlers */ TEST_TASK = 0x54694269, LIBGPIOD_TEST = 0x54123456,