eive-obsw/bsp_q7s/callbacks/gnssCallback.cpp
Robin Mueller 01bac87afb
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
update reset pin handling
2022-05-25 10:59:20 +02:00

30 lines
917 B
C++

#include "gnssCallback.h"
#include "fsfw/action/HasActionsIF.h"
#include "devices/gpioIds.h"
#include "fsfw/tasks/TaskFactory.h"
ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args) {
// At least one byte which denotes which GPS to reset is required
if(len < 1 or actionData == nullptr) {
return HasActionsIF::INVALID_PARAMETERS;
}
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
if (args == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
if (resetArgs->gpioComIF == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
gpioId_t gpioId;
if (actionData[0] == 0) {
gpioId = gpioIds::GNSS_0_NRESET;
} else {
gpioId = gpioIds::GNSS_1_NRESET;
}
resetArgs->gpioComIF->pullLow(gpioId);
TaskFactory::delayTask(resetArgs->waitPeriodMs);
resetArgs->gpioComIF->pullHigh(gpioId);
return HasReturnvaluesIF::RETURN_OK;
}