eive-obsw/bsp_q7s/callbacks/gnssCallback.cpp

30 lines
879 B
C++
Raw Normal View History

2021-09-07 16:11:02 +02:00
#include "gnssCallback.h"
2022-01-17 15:58:27 +01:00
#include "devices/gpioIds.h"
2022-05-26 11:46:28 +02:00
#include "fsfw/action/HasActionsIF.h"
2021-09-07 16:11:02 +02:00
#include "fsfw/tasks/TaskFactory.h"
2022-05-25 10:59:20 +02:00
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
2022-05-26 11:46:28 +02:00
if (len < 1 or actionData == nullptr) {
2022-05-25 10:59:20 +02:00
return HasActionsIF::INVALID_PARAMETERS;
}
2022-01-17 15:58:27 +01:00
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
if (args == nullptr) {
2022-08-24 17:27:47 +02:00
return returnvalue::FAILED;
2022-01-17 15:58:27 +01:00
}
if (resetArgs->gpioComIF == nullptr) {
2022-08-24 17:27:47 +02:00
return returnvalue::FAILED;
2022-01-17 15:58:27 +01:00
}
gpioId_t gpioId;
2022-05-25 10:59:20 +02:00
if (actionData[0] == 0) {
2022-01-17 15:58:27 +01:00
gpioId = gpioIds::GNSS_0_NRESET;
2022-05-25 10:59:20 +02:00
} else {
gpioId = gpioIds::GNSS_1_NRESET;
2022-01-17 15:58:27 +01:00
}
resetArgs->gpioComIF->pullLow(gpioId);
TaskFactory::delayTask(resetArgs->waitPeriodMs);
resetArgs->gpioComIF->pullHigh(gpioId);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2021-09-07 16:11:02 +02:00
}