new linux boardtest folder
This commit is contained in:
10
linux/boardtest/CMakeLists.txt
Normal file
10
linux/boardtest/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
LibgpiodTest.cpp
|
||||
I2cTestClass.cpp
|
||||
SpiTestClass.cpp
|
||||
UartTestClass.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
8
linux/boardtest/I2cTestClass.cpp
Normal file
8
linux/boardtest/I2cTestClass.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <linux/boardtest/I2cTestClass.h>
|
||||
|
||||
I2cTestClass::I2cTestClass(object_id_t objectId): TestTask(objectId) {
|
||||
}
|
||||
|
||||
ReturnValue_t I2cTestClass::performPeriodicAction() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
17
linux/boardtest/I2cTestClass.h
Normal file
17
linux/boardtest/I2cTestClass.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef LINUX_BOARDTEST_I2CTESTCLASS_H_
|
||||
#define LINUX_BOARDTEST_I2CTESTCLASS_H_
|
||||
|
||||
#include <test/testtasks/TestTask.h>
|
||||
|
||||
class I2cTestClass: public TestTask {
|
||||
public:
|
||||
I2cTestClass(object_id_t objectId);
|
||||
|
||||
ReturnValue_t performPeriodicAction() override;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* LINUX_BOARDTEST_I2CTESTCLASS_H_ */
|
37
linux/boardtest/LibgpiodTest.cpp
Normal file
37
linux/boardtest/LibgpiodTest.cpp
Normal 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;
|
||||
}
|
||||
|
25
linux/boardtest/LibgpiodTest.h
Normal file
25
linux/boardtest/LibgpiodTest.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef TEST_TESTTASKS_LIBGPIODTEST_H_
|
||||
#define TEST_TESTTASKS_LIBGPIODTEST_H_
|
||||
|
||||
#include "TestTask.h"
|
||||
#include <linux/gpio/GpioIF.h>
|
||||
#include <linux/gpio/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_ */
|
8
linux/boardtest/SpiTestClass.cpp
Normal file
8
linux/boardtest/SpiTestClass.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <linux/boardtest/SpiTestClass.h>
|
||||
|
||||
SpiTestClass::SpiTestClass(object_id_t objectId): TestTask(objectId) {
|
||||
}
|
||||
|
||||
ReturnValue_t SpiTestClass::performPeriodicAction() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
18
linux/boardtest/SpiTestClass.h
Normal file
18
linux/boardtest/SpiTestClass.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef LINUX_BOARDTEST_SPITESTCLASS_H_
|
||||
#define LINUX_BOARDTEST_SPITESTCLASS_H_
|
||||
|
||||
#include <test/testtasks/TestTask.h>
|
||||
|
||||
class SpiTestClass: public TestTask {
|
||||
public:
|
||||
SpiTestClass(object_id_t objectId);
|
||||
|
||||
ReturnValue_t performPeriodicAction() override;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LINUX_BOARDTEST_SPITESTCLASS_H_ */
|
8
linux/boardtest/UartTestClass.cpp
Normal file
8
linux/boardtest/UartTestClass.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <linux/boardtest/UartTestClass.h>
|
||||
|
||||
UartTestClass::UartTestClass(object_id_t objectId): TestTask(objectId) {
|
||||
}
|
||||
|
||||
ReturnValue_t UartTestClass::performPeriodicAction() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
15
linux/boardtest/UartTestClass.h
Normal file
15
linux/boardtest/UartTestClass.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef LINUX_BOARDTEST_UARTTESTCLASS_H_
|
||||
#define LINUX_BOARDTEST_UARTTESTCLASS_H_
|
||||
|
||||
#include <test/testtasks/TestTask.h>
|
||||
|
||||
class UartTestClass: public TestTask {
|
||||
public:
|
||||
UartTestClass(object_id_t objectId);
|
||||
|
||||
ReturnValue_t performPeriodicAction() override;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */
|
Reference in New Issue
Block a user