open gpio by label test on te0720
This commit is contained in:
@ -15,7 +15,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
|
||||
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
||||
}
|
||||
gpioInterface->addGpios(gpioCookie);
|
||||
testCase = TestCases::LOOPBACK;
|
||||
testCase = TestCases::BLINK;
|
||||
}
|
||||
|
||||
LibgpiodTest::~LibgpiodTest() {
|
||||
@ -29,7 +29,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
||||
case(TestCases::READ): {
|
||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
|
||||
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
@ -42,6 +42,38 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
||||
case(TestCases::LOOPBACK): {
|
||||
break;
|
||||
}
|
||||
case(TestCases::BLINK): {
|
||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
if (gpioState == 1) {
|
||||
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
else if (gpioState == 0) {
|
||||
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "LibgpiodTest::performPeriodicAction: Invalid test case" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +88,9 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
|
||||
case(TestCases::READ): {
|
||||
break;
|
||||
}
|
||||
case(TestCases::BLINK): {
|
||||
break;
|
||||
}
|
||||
case(TestCases::LOOPBACK): {
|
||||
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
|
Reference in New Issue
Block a user