added loopback test mode
This commit is contained in:
parent
97a752120a
commit
7435ce903a
@ -13,6 +13,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
|
|||||||
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
||||||
}
|
}
|
||||||
gpioInterface->initialize(gpioCookie);
|
gpioInterface->initialize(gpioCookie);
|
||||||
|
testCase = TestCases::READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibgpiodTest::~LibgpiodTest() {
|
LibgpiodTest::~LibgpiodTest() {
|
||||||
@ -22,16 +23,26 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
|||||||
int gpioState;
|
int gpioState;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState);
|
switch(testCase) {
|
||||||
if (result != RETURN_OK) {
|
case(testCase == TestCases::READ): {
|
||||||
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
|
result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState);
|
||||||
<< std::endl;
|
if (result != RETURN_OK) {
|
||||||
return RETURN_FAILED;
|
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 {
|
case(testCase == TestCases::LOOPBACK): {
|
||||||
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,13 @@
|
|||||||
*/
|
*/
|
||||||
class LibgpiodTest: public TestTask {
|
class LibgpiodTest: public TestTask {
|
||||||
public:
|
public:
|
||||||
|
enum TestCases {
|
||||||
|
READ = 0,
|
||||||
|
LOOPBACK = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
TestCases testCase;
|
||||||
|
|
||||||
LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie);
|
LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie);
|
||||||
virtual ~LibgpiodTest();
|
virtual ~LibgpiodTest();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user