This commit is contained in:
32
bsp_q7s/callbacks/pcduSwitchCb.cpp
Normal file
32
bsp_q7s/callbacks/pcduSwitchCb.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#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) {
|
||||
PDU1::SwitchChannels typedChannel = static_cast<PDU1::SwitchChannels>(channel);
|
||||
if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) {
|
||||
if (state) {
|
||||
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
|
||||
} else {
|
||||
gpioComIF->pullLow(gpioIds::GNSS_0_NRESET);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (pdu == GOMSPACE::Pdu::PDU2) {
|
||||
PDU2::SwitchChannels typedChannel = static_cast<PDU2::SwitchChannels>(channel);
|
||||
if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) {
|
||||
if (state) {
|
||||
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
|
||||
} else {
|
||||
gpioComIF->pullLow(gpioIds::GNSS_1_NRESET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user