update for updated gpio API
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-05-04 10:34:11 +02:00
parent 5f5c996cfd
commit 50ca378318
13 changed files with 431 additions and 350 deletions

View File

@ -19,17 +19,17 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, Gpi
LibgpiodTest::~LibgpiodTest() {}
ReturnValue_t LibgpiodTest::performPeriodicAction() {
int gpioState;
gpio::Levels gpioState;
ReturnValue_t result;
switch (testCase) {
case (TestCases::READ): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
if (result != RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
return RETURN_FAILED;
} else {
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << static_cast<int>(gpioState)
<< std::endl;
}
break;
@ -38,19 +38,19 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
break;
}
case (TestCases::BLINK): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
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) {
if (gpioState == gpio::Levels::HIGH) {
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) {
} else if (gpioState == gpio::Levels::LOW) {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
@ -72,7 +72,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
}
ReturnValue_t LibgpiodTest::performOneShotAction() {
int gpioState;
gpio::Levels gpioState;
ReturnValue_t result;
switch (testCase) {
@ -93,8 +93,8 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
<< std::endl;
return HasReturnvaluesIF::RETURN_OK;
}
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == 1) {
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::HIGH) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO state read successfully and is high"
<< std::endl;
@ -110,8 +110,8 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
"GPIO pulled low successfully for loopback test"
<< std::endl;
}
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == 0) {
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::LOW) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO state read successfully and is low"
<< std::endl;