move HAL and tests folder

This commit is contained in:
2022-07-18 08:59:40 +02:00
parent 3686bbc486
commit 6f7be281ef
229 changed files with 494 additions and 559 deletions

View File

@ -0,0 +1,3 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TestTask.cpp
)

View File

@ -0,0 +1,62 @@
#include "TestTask.h"
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
MutexIF* TestTask::testLock = nullptr;
TestTask::TestTask(object_id_t objectId) : SystemObject(objectId), testMode(testModes::A) {
if (testLock == nullptr) {
testLock = MutexFactory::instance()->createMutex();
}
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
}
TestTask::~TestTask() = default;
ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
testLock->lockMutex(MutexIF::TimeoutType::WAITING, 20);
if (oneShotAction) {
// Add code here which should only be run once
performOneShotAction();
oneShotAction = false;
}
testLock->unlockMutex();
// Add code here which should only be run once per performOperation
performPeriodicAction();
// Add code here which should only be run on alternating cycles.
if (testMode == testModes::A) {
performActionA();
testMode = testModes::B;
} else if (testMode == testModes::B) {
performActionB();
testMode = testModes::A;
}
return result;
}
ReturnValue_t TestTask::performOneShotAction() {
/* Everything here will only be performed once. */
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t TestTask::performPeriodicAction() {
/* This is performed each task cycle */
ReturnValue_t result = RETURN_OK;
return result;
}
ReturnValue_t TestTask::performActionA() {
/* This is performed each alternating task cycle */
ReturnValue_t result = RETURN_OK;
return result;
}
ReturnValue_t TestTask::performActionB() {
/* This is performed each alternating task cycle */
ReturnValue_t result = RETURN_OK;
return result;
}

View File

@ -0,0 +1,37 @@
#ifndef MISSION_DEMO_TESTTASK_H_
#define MISSION_DEMO_TESTTASK_H_
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
/**
* @brief Test class for general C++ testing and any other code which will not be part of the
* primary mission software.
* @details
* Should not be used for board specific tests. Instead, a derived board test class should be used.
*/
class TestTask : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
public:
explicit TestTask(object_id_t objectId);
~TestTask() override;
ReturnValue_t performOperation(uint8_t operationCode) override;
protected:
virtual ReturnValue_t performOneShotAction();
virtual ReturnValue_t performPeriodicAction();
virtual ReturnValue_t performActionA();
virtual ReturnValue_t performActionB();
enum testModes : uint8_t { A, B };
testModes testMode;
bool testFlag = false;
private:
bool oneShotAction = true;
static MutexIF* testLock;
StorageManagerIF* IPCStore;
};
#endif /* TESTTASK_H_ */