moved gpiod test to bsp folder
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
target_sources(${TARGET_NAME} PUBLIC
|
||||
LibgpiodTest.cpp
|
||||
TestTask.cpp
|
||||
)
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
#include "LibgpiodTest.h"
|
||||
|
||||
#include "devices/gpioIds.h"
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
|
||||
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) :
|
||||
TestTask(objectId) {
|
||||
|
||||
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
|
||||
if (gpioInterface == nullptr) {
|
||||
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
||||
}
|
||||
gpioInterface->initialize(gpioCookie);
|
||||
}
|
||||
|
||||
LibgpiodTest::~LibgpiodTest() {
|
||||
}
|
||||
|
||||
ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
||||
int gpioState;
|
||||
ReturnValue_t result;
|
||||
|
||||
result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
else {
|
||||
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
|
||||
<< std::endl;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
#ifndef TEST_TESTTASKS_LIBGPIODTEST_H_
|
||||
#define TEST_TESTTASKS_LIBGPIODTEST_H_
|
||||
|
||||
#include "TestTask.h"
|
||||
#include "GpioIF.h"
|
||||
#include "GpioCookie.h"
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
/**
|
||||
* @brief Test for the GPIO read implementation of the LinuxLibgpioIF.
|
||||
* @author J. Meier
|
||||
*/
|
||||
class LibgpiodTest: public TestTask {
|
||||
public:
|
||||
LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie);
|
||||
virtual ~LibgpiodTest();
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t performPeriodicAction() override;
|
||||
|
||||
private:
|
||||
GpioIF* gpioInterface;
|
||||
};
|
||||
|
||||
#endif /* TEST_TESTTASKS_LIBGPIODTEST_H_ */
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* MutextestTask.cpp
|
||||
*
|
||||
* Created on: 19.07.2018
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#include <test/testtasks/MutextestTask.h>
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
MutexIF * MutextestTask::mutex = nullptr;
|
||||
|
||||
MutextestTask::MutextestTask(const char *name, object_id_t setObjectId) :
|
||||
SystemObject(setObjectId), name(name), locked(false) {
|
||||
if (mutex == NULL) {
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t MutextestTask::performOperation(uint8_t operationCode) {
|
||||
if (!locked){
|
||||
sif::info << name << ": locking..." << std::endl;
|
||||
ReturnValue_t result = mutex->lockMutex(MutexIF::BLOCKING);
|
||||
sif::info << name << ": locked with " << (int) result << std::endl;
|
||||
if (result == HasReturnvaluesIF::RETURN_OK){
|
||||
locked = true;
|
||||
}
|
||||
} else {
|
||||
sif::info << name << ": releasing" << std::endl;
|
||||
mutex->unlockMutex();
|
||||
locked = false;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
MutextestTask::~MutextestTask() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* MutextestTask.h
|
||||
*
|
||||
* Created on: 19.07.2018
|
||||
* Author: mohr
|
||||
*/
|
||||
|
||||
#ifndef MISSION_MUTEXTESTTASK_H_
|
||||
#define MISSION_MUTEXTESTTASK_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||
#include <fsfw/ipc/MutexFactory.h>
|
||||
|
||||
/**
|
||||
* Start two of them with a little time difference and different periods to see mutex in action
|
||||
*/
|
||||
|
||||
class MutextestTask: public SystemObject, public ExecutableObjectIF {
|
||||
public:
|
||||
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0);
|
||||
|
||||
MutextestTask(const char *name, object_id_t setObjectId);
|
||||
virtual ~MutextestTask();
|
||||
private:
|
||||
static MutexIF *mutex;
|
||||
const char * name;
|
||||
bool locked;
|
||||
};
|
||||
|
||||
#endif /* MISSION_MUTEXTESTTASK_H_ */
|
Reference in New Issue
Block a user