From 64b4ab324928fe4b9d1b0b48eb5ced53acacdb1b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 17 Feb 2022 20:51:20 +0100 Subject: [PATCH] added rad sensor enable, obj factory fixes --- bsp_q7s/boardconfig/busConf.h | 1 + bsp_q7s/core/ObjectFactory.cpp | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 324d741f..eba4fb36 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -70,6 +70,7 @@ static constexpr char EN_RW_3[] = "enable_rw_3"; static constexpr char EN_RW_4[] = "enable_rw_4"; static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select"; +static constexpr char ENABLE_RADFET[] = "enable_radfet"; static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0"; static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0"; static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1"; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index eae4eb46..b248dbb3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -140,13 +140,11 @@ void ObjectFactory::produce(void* args) { createHeaterComponents(); createSolarArrayDeploymentComponents(); + createPlPcduComponents(gpioComIF, spiComIF); #if OBSW_ADD_SYRLINKS == 1 createSyrlinksComponents(); #endif /* OBSW_ADD_SYRLINKS == 1 */ - -#if OBSW_ADD_RTD_DEVICES == 1 createRtdComponents(gpioComIF); -#endif /* OBSW_ADD_RTD_DEVICES == 1 */ #if OBSW_ADD_MGT == 1 I2cCookie* imtqI2cCookie = @@ -254,9 +252,7 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua new CspComIF(objects::CSP_COM_IF); *i2cComIF = new I2cComIF(objects::I2C_COM_IF); *uartComIF = new UartComIF(objects::UART_COM_IF); -#if OBSW_ADD_SPI_TEST_CODE == 0 *spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF); -#endif /* Q7S_ADD_SPI_TEST_CODE == 0 */ #if BOARD_TE0720 == 0 /* Adding gpios for chip select decoding to the gpioComIf */ @@ -298,6 +294,9 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { GpiodRegularByLineName* gpio = new GpiodRegularByLineName( q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::DIR_OUT, gpio::HIGH); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio); + gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), gpio::DIR_OUT, + gpio::LOW); + gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio); gpioComIF->addGpios(gpioCookieRadSensor); SpiCookie* spiCookieRadSensor = new SpiCookie( @@ -355,6 +354,7 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI gpioComIF->addGpios(gpioCookieSus); +#if OBSW_ADD_SUN_SENSORS == 1 SpiCookie* spiCookie = new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ); @@ -464,6 +464,8 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI susHandler10->setToGoToNormalMode(true); susHandler11->setToGoToNormalMode(true); #endif + +#endif /* OBSW_ADD_SUN_SENSORS == 1 */ } void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF) { @@ -793,6 +795,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) { gpioComIF->addGpios(rtdGpioCookie); +#if OBSW_ADD_RTD_DEVICES == 1 SpiCookie* spiRtdIc0 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); @@ -900,6 +903,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) { static_cast(rtdIc13); static_cast(rtdIc14); static_cast(rtdIc15); +#endif } void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { @@ -941,6 +945,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { gpioComIF->addGpios(gpioCookieRw); +#if OBSW_ADD_RW == 1 auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr); @@ -982,6 +987,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rwHandler4->setStartUpImmediately(); #endif rw4SpiCookie->setCallbackArgs(rwHandler4); + +#endif /* OBSW_ADD_RW == 1 */ } void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) { @@ -1103,7 +1110,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* gpio::Levels::LOW); plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT0, gpio); consumer = "PLPCDU_ENB_VBAT_1"; - gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT0, consumer, gpio::DIR_OUT, + gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT1, consumer, gpio::DIR_OUT, gpio::Levels::LOW); plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT1, gpio); consumer = "PLPCDU_ENB_DRO";