30 lines
917 B
C++
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;
|
|
}
|