moved gpiod test to bsp folder
This commit is contained in:
parent
572e3d5bba
commit
83530f9c4e
@ -7,6 +7,7 @@ target_sources(${TARGET_NAME} PUBLIC
|
|||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
add_subdirectory(comIF)
|
add_subdirectory(comIF)
|
||||||
add_subdirectory(gpio)
|
add_subdirectory(gpio)
|
||||||
|
add_subdirectory(boardtest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
7
bsp_q7s/boardtest/CMakeLists.txt
Normal file
7
bsp_q7s/boardtest/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
|
LibgpiodTest.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
|||||||
#include "LibgpiodTest.h"
|
#include "LibgpiodTest.h"
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
#include <fsfwconfig/devices/gpioIds.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
|
|
||||||
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) :
|
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
|
||||||
|
GpioCookie* gpioCookie):
|
||||||
TestTask(objectId) {
|
TestTask(objectId) {
|
||||||
|
|
||||||
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
|
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
|
@ -1,5 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
target_sources(${TARGET_NAME} PUBLIC
|
||||||
LibgpiodTest.cpp
|
|
||||||
TestTask.cpp
|
TestTask.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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_ */
|
|
Loading…
Reference in New Issue
Block a user