eive-obsw/bsp_q7s/fmObjectFactory.cpp

95 lines
3.2 KiB
C++
Raw Normal View History

2022-10-26 17:11:57 +02:00
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
2022-09-27 18:54:48 +02:00
#include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h"
#include "devConf.h"
2022-09-16 12:28:39 +02:00
#include "eive/objects.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "mission/core/GenericFactory.h"
2022-05-25 10:25:40 +02:00
#include "mission/system/tree/system.h"
void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics();
2022-05-12 19:12:12 +02:00
HealthTableIF* healthTable = nullptr;
PusTmFunnel* pusFunnel = nullptr;
CfdpTmFunnel* cfdpFunnel = nullptr;
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel);
LinuxLibgpioIF* gpioComIF = nullptr;
2022-11-10 18:07:59 +01:00
SerialComIF* uartComIF = nullptr;
SpiComIF* spiMainComIF = nullptr;
I2cComIF* i2cComIF = nullptr;
PowerSwitchIF* pwrSwitcher = nullptr;
SpiComIF* spiRwComIF = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
2022-10-26 17:11:57 +02:00
/* Adding gpios for chip select decoding to the gpioComIf */
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
gpioCallbacks::disableAllDecoder(gpioComIF);
2022-10-26 17:11:57 +02:00
new CoreController(objects::CORE_CONTROLLER);
createPcduComponents(gpioComIF, &pwrSwitcher);
2022-12-21 14:11:31 +01:00
auto* stackHandler = new Stack5VHandler(*pwrSwitcher);
2022-12-20 11:45:46 +01:00
#if OBSW_ADD_RAD_SENSORS == 1
2022-12-21 14:11:31 +01:00
createRadSensorComponent(gpioComIF, *stackHandler);
2022-12-20 11:45:46 +01:00
#endif
#if OBSW_ADD_SUN_SENSORS == 1
2023-02-13 11:49:26 +01:00
createSunSensorComponents(gpioComIF, spiMainComIF, *pwrSwitcher, q7s::SPI_DEFAULT_DEV, true);
2022-12-20 11:45:46 +01:00
#endif
#if OBSW_ADD_ACS_BOARD == 1
2023-02-13 13:53:13 +01:00
createAcsBoardComponents(gpioComIF, uartComIF, *pwrSwitcher);
#endif
2022-11-25 11:01:06 +01:00
HeaterHandler* heaterHandler;
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
2022-10-27 08:48:46 +02:00
#if OBSW_ADD_TMP_DEVICES == 1
createTmpComponents();
#endif
2022-10-12 13:56:25 +02:00
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
2022-12-22 11:10:55 +01:00
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
#if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
2022-05-12 12:21:47 +02:00
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher);
#endif
createReactionWheelComponents(gpioComIF, pwrSwitcher);
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent();
#endif
#if OBSW_ADD_STAR_TRACKER == 1
createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_ADD_CCSDS_IP_CORES == 1
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
createCcsdsComponents(gpioComIF, &ipCoreHandler);
#if OBSW_TM_TO_PTME == 1
addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel);
#endif
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
#if OBSW_ADD_SCEX_DEVICE == 1
2022-09-28 17:01:40 +02:00
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), false,
2022-09-27 18:54:48 +02:00
pcdu::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
#endif
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
createTestComponents(gpioComIF);
#endif /* OBSW_ADD_TEST_CODE == 1 */
createMiscComponents();
2022-11-25 11:01:06 +01:00
createThermalController(*heaterHandler);
2022-09-30 14:30:30 +02:00
createAcsController(true);
2022-05-25 10:25:40 +02:00
satsystem::init();
}