changed for updated FSFW GPIO API

This commit is contained in:
Robin Müller 2022-05-04 14:08:27 +02:00
parent f0270b91d9
commit 86752417f2
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 19 additions and 19 deletions

2
fsfw

@ -1 +1 @@
Subproject commit 7f6c8b8b123a63546de0d73f0de35900d6c806bf Subproject commit 8ee26f81f9449e28566a8d34fbb3454cfd1da01c

View File

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

View File

@ -42,17 +42,17 @@ void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; } void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
ReturnValue_t PapbVcInterface::pollPapbBusySignal() { ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
int papbBusyState = 0; gpio::Levels papbBusyState = gpio::Levels::LOW;
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
/** Check if PAPB interface is ready to receive data */ /** Check if PAPB interface is ready to receive data */
result = gpioComIF->readGpio(papbBusyId, &papbBusyState); result = gpioComIF->readGpio(papbBusyId, papbBusyState);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal" sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
<< std::endl; << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
if (!papbBusyState) { if (papbBusyState == gpio::Levels::LOW) {
sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl; sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl;
return PAPB_BUSY; return PAPB_BUSY;
} }
@ -62,9 +62,9 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
void PapbVcInterface::isVcInterfaceBufferEmpty() { void PapbVcInterface::isVcInterfaceBufferEmpty() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
int papbEmptyState = 1; gpio::Levels papbEmptyState = gpio::Levels::HIGH;
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState); result = gpioComIF->readGpio(papbEmptyId, papbEmptyState);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal" sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
@ -72,7 +72,7 @@ void PapbVcInterface::isVcInterfaceBufferEmpty() {
return; return;
} }
if (papbEmptyState == 1) { if (papbEmptyState == gpio::Levels::HIGH) {
sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is empty" << std::endl; sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is empty" << std::endl;
} else { } else {
sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is not empty" << std::endl; sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is not empty" << std::endl;