eive-obsw/bsp_q7s/callbacks/pcduSwitchCb.cpp

33 lines
955 B
C++
Raw Normal View History

2022-01-19 18:05:17 +01:00
#include "pcduSwitchCb.h"
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include "devices/gpioIds.h"
void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args) {
LinuxLibgpioIF* gpioComIF = reinterpret_cast<LinuxLibgpioIF*>(args);
if (gpioComIF == nullptr) {
return;
}
if (pdu == GOMSPACE::Pdu::PDU1) {
2022-04-07 19:48:09 +02:00
PDU1::Channels typedChannel = static_cast<PDU1::Channels>(channel);
if (typedChannel == PDU1::Channels::ACS_A_SIDE) {
2022-01-19 18:05:17 +01:00
if (state) {
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
} else {
gpioComIF->pullLow(gpioIds::GNSS_0_NRESET);
}
}
} else if (pdu == GOMSPACE::Pdu::PDU2) {
2022-04-07 19:48:09 +02:00
PDU2::Channels typedChannel = static_cast<PDU2::Channels>(channel);
if (typedChannel == PDU2::Channels::ACS_B_SIDE) {
2022-01-19 18:05:17 +01:00
if (state) {
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
} else {
gpioComIF->pullLow(gpioIds::GNSS_1_NRESET);
}
}
}
}