moved gpiod test to bsp folder

This commit is contained in:
2021-02-14 12:23:29 +01:00
parent f2b1255b39
commit ae47acdbbb
7 changed files with 11 additions and 76 deletions

View File

@ -7,6 +7,7 @@ target_sources(${TARGET_NAME} PUBLIC
add_subdirectory(boardconfig)
add_subdirectory(comIF)
add_subdirectory(gpio)
add_subdirectory(boardtest)

View File

@ -0,0 +1,7 @@
target_sources(${TARGET_NAME} PRIVATE
LibgpiodTest.cpp
)

View File

@ -0,0 +1,37 @@
#include "LibgpiodTest.h"
#include <fsfwconfig/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;
}

View File

@ -0,0 +1,25 @@
#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_ */