added generic GPIO checker
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
73fbdfeb25
commit
0b64999ce2
@ -48,7 +48,7 @@ void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
|
||||
|
||||
result = gpioComIF->addGpios(spiMuxGpios);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
||||
sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), Direction::OUT,
|
||||
Levels::LOW);
|
||||
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
|
||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||
gpioChecker(gpioComIF->addGpios(gpioCookieRadSensor), "RAD sensor");
|
||||
|
||||
SpiCookie* spiCookieRadSensor = new SpiCookie(
|
||||
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
|
||||
@ -407,7 +407,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_SELECT, consumer.str(), Direction::OUT,
|
||||
Levels::LOW);
|
||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_SELECT, gpio);
|
||||
gpioComIF->addGpios(gpioCookieAcsBoard);
|
||||
gpioChecker(gpioComIF->addGpios(gpioCookieAcsBoard), "ACS Board");
|
||||
AcsBoardFdir* fdir = nullptr;
|
||||
static_cast<void>(fdir);
|
||||
|
||||
@ -658,7 +658,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
consumer.str(), Direction::OUT, Levels::HIGH);
|
||||
auto mpsocGpioCookie = new GpioCookie;
|
||||
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
|
||||
gpioComIF->addGpios(mpsocGpioCookie);
|
||||
gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC");
|
||||
auto mpsocCookie =
|
||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD,
|
||||
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
|
||||
@ -675,7 +675,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
Direction::OUT, Levels::HIGH);
|
||||
auto supvGpioCookie = new GpioCookie;
|
||||
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
|
||||
gpioComIF->addGpios(supvGpioCookie);
|
||||
gpioChecker(gpioComIF->addGpios(supvGpioCookie), "PLOC SUPV");
|
||||
auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPERVISOR_BAUD,
|
||||
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
|
||||
@ -729,7 +729,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
Levels::LOW);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
|
||||
|
||||
gpioComIF->addGpios(gpioCookieRw);
|
||||
gpioChecker(gpioComIF->addGpios(gpioCookieRw), "RWs");
|
||||
|
||||
#if OBSW_ADD_RW == 1
|
||||
std::array<std::pair<address_t, gpioId_t>, 4> rwCookieParams = {
|
||||
@ -795,7 +795,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
|
||||
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
|
||||
|
||||
gpioComIF->addGpios(gpioCookiePtmeIp);
|
||||
gpioChecker(gpioComIF->addGpios(gpioCookiePtmeIp), "PTME PAPB VCs");
|
||||
|
||||
// Creating virtual channel interfaces
|
||||
VcInterfaceIF* vc0 =
|
||||
@ -849,7 +849,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
Levels::LOW);
|
||||
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
|
||||
|
||||
gpioComIF->addGpios(gpioCookiePdec);
|
||||
gpioChecker(gpioComIF->addGpios(gpioCookiePdec), "PDEC");
|
||||
|
||||
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
|
||||
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
|
||||
@ -870,7 +870,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
Direction::OUT, Levels::LOW);
|
||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
|
||||
|
||||
gpioComIF->addGpios(gpioRS485Chip);
|
||||
gpioChecker(gpioComIF->addGpios(gpioRS485Chip), "RS485 Transceiver");
|
||||
}
|
||||
|
||||
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||
@ -915,7 +915,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, Direction::OUT,
|
||||
gpio::Levels::HIGH);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
|
||||
gpioComIF->addGpios(plPcduGpios);
|
||||
gpioChecker(gpioComIF->addGpios(plPcduGpios), "PL PCDU");
|
||||
SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS,
|
||||
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED);
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef BSP_Q7S_OBJECTFACTORY_H_
|
||||
#define BSP_Q7S_OBJECTFACTORY_H_
|
||||
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class LinuxLibgpioIF;
|
||||
class UartComIF;
|
||||
class SpiComIF;
|
||||
|
@ -62,7 +62,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
|
||||
|
||||
gpioComIF->addGpios(gpioCookieSus);
|
||||
gpioChecker(gpioComIF->addGpios(gpioCookieSus), "Sun Sensors");
|
||||
|
||||
#if OBSW_ADD_SUN_SENSORS == 1
|
||||
SusFdir* fdir = nullptr;
|
||||
@ -228,7 +228,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15);
|
||||
|
||||
gpioComIF->addGpios(rtdGpioCookie);
|
||||
gpioChecker(gpioComIF->addGpios(rtdGpioCookie), "RTDs");
|
||||
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
static constexpr uint8_t NUMBER_RTDS = 16;
|
||||
@ -287,3 +287,9 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
static_cast<void>(tcsBoardAss);
|
||||
#endif // OBSW_ADD_RTD_DEVICES == 1
|
||||
}
|
||||
|
||||
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class GpioIF;
|
||||
@ -12,4 +14,6 @@ void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitc
|
||||
std::string spiDev);
|
||||
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
|
||||
|
||||
void gpioChecker(ReturnValue_t result, std::string output);
|
||||
|
||||
} // namespace ObjectFactory
|
||||
|
Loading…
Reference in New Issue
Block a user