added loopback test mode

This commit is contained in:
Robin Müller 2021-02-22 12:40:12 +01:00
parent 7c71e2b067
commit 86e527882c
2 changed files with 26 additions and 8 deletions

View File

@ -13,6 +13,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
}
gpioInterface->initialize(gpioCookie);
testCase = TestCases::READ;
}
LibgpiodTest::~LibgpiodTest() {
@ -22,16 +23,26 @@ 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;
switch(testCase) {
case(testCase == TestCases::READ): {
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;
}
break;
}
else {
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
<< std::endl;
case(testCase == TestCases::LOOPBACK): {
}
}
return RETURN_OK;
}

View File

@ -12,6 +12,13 @@
*/
class LibgpiodTest: public TestTask {
public:
enum TestCases {
READ = 0,
LOOPBACK = 1
};
TestCases testCase;
LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie);
virtual ~LibgpiodTest();