2022-03-26 16:38:42 +01:00
|
|
|
#include "ObjectFactory.h"
|
|
|
|
|
|
|
|
#include <fsfw/power/PowerSwitchIF.h>
|
|
|
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
|
|
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
|
|
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
|
|
|
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
|
|
|
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
|
|
|
#include <linux/callbacks/gpioCallbacks.h>
|
2022-05-12 12:12:47 +02:00
|
|
|
#include <linux/devices/Max31865RtdLowlevelHandler.h>
|
|
|
|
#include <mission/devices/Max31865EiveHandler.h>
|
2022-03-31 17:58:16 +02:00
|
|
|
#include <mission/devices/Max31865PT1000Handler.h>
|
2022-03-26 16:38:42 +01:00
|
|
|
#include <mission/devices/SusHandler.h>
|
2022-04-28 15:29:57 +02:00
|
|
|
#include <mission/system/fdir/RtdFdir.h>
|
|
|
|
#include <mission/system/fdir/SusFdir.h>
|
2022-04-25 10:36:03 +02:00
|
|
|
#include <mission/system/objects/SusAssembly.h>
|
|
|
|
#include <mission/system/objects/TcsBoardAssembly.h>
|
2022-03-26 16:38:42 +01:00
|
|
|
|
|
|
|
#include "OBSWConfig.h"
|
|
|
|
#include "devConf.h"
|
|
|
|
#include "devices/addresses.h"
|
|
|
|
#include "devices/gpioIds.h"
|
|
|
|
|
|
|
|
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,
|
|
|
|
PowerSwitchIF* pwrSwitcher, std::string spiDev) {
|
|
|
|
using namespace gpio;
|
|
|
|
GpioCookie* gpioCookieSus = new GpioCookie();
|
|
|
|
GpioCallback* susgpio = nullptr;
|
|
|
|
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 0", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_0, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 1", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 2", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 3", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 4", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 5", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 6", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 7", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 8", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 9", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 10", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
|
|
|
|
susgpio = new GpioCallback("Chip select SUS 11", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
|
|
|
|
|
2022-04-28 18:38:38 +02:00
|
|
|
gpioChecker(gpioComIF->addGpios(gpioCookieSus), "Sun Sensors");
|
2022-03-26 16:38:42 +01:00
|
|
|
|
|
|
|
#if OBSW_ADD_SUN_SENSORS == 1
|
|
|
|
SusFdir* fdir = nullptr;
|
|
|
|
std::array<SusHandler*, 12> susHandlers = {};
|
2022-05-11 11:13:00 +02:00
|
|
|
SpiCookie* spiCookie = new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, SUS::MAX_CMD_SIZE,
|
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[0] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_0_N_LOC_XFYFZM_PT_XF, 0, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[0]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[1] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_1_N_LOC_XBYFZM_PT_XB, 1, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[1]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[2] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_2_N_LOC_XFYBZB_PT_YB, 2, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[2]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[3] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_3_N_LOC_XFYBZF_PT_YF, 3, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[3]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[4] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, 4, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[4]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[5] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, 5, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[5]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[6] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_6_R_LOC_XFYBZM_PT_XF, 6, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[6]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[7] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_7_R_LOC_XBYBZM_PT_XB, 7, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[7]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[8] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_8_R_LOC_XBYBZB_PT_YB, 8, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[8]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[9] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_9_R_LOC_XBYBZB_PT_YF, 9, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[9]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[10] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, 10, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[10]->setCustomFdir(fdir);
|
|
|
|
|
2022-05-11 11:13:00 +02:00
|
|
|
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, SUS::MAX_CMD_SIZE,
|
2022-03-26 16:38:42 +01:00
|
|
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
2022-05-05 16:46:04 +02:00
|
|
|
susHandlers[11] =
|
2022-05-11 01:48:26 +02:00
|
|
|
new SusHandler(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, 11, objects::SPI_MAIN_COM_IF, spiCookie);
|
2022-05-05 16:46:04 +02:00
|
|
|
fdir = new SusFdir(objects::SUS_11_R_LOC_XBYMZB_PT_ZB);
|
2022-03-26 16:38:42 +01:00
|
|
|
susHandlers[11]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
susHandlers[11]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
for (auto& sus : susHandlers) {
|
|
|
|
if (sus != nullptr) {
|
|
|
|
#if OBSW_TEST_SUS == 1
|
|
|
|
sus->setStartUpImmediately();
|
|
|
|
sus->setToGoToNormalMode(true);
|
|
|
|
#endif
|
|
|
|
#if OBSW_DEBUG_SUS == 1
|
|
|
|
sus->enablePeriodicPrintout(true, 3);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2022-05-05 16:46:04 +02:00
|
|
|
std::array<object_id_t, 12> susIds = {
|
|
|
|
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
|
|
|
|
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
|
|
|
|
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
|
|
|
|
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
|
|
|
|
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
|
|
|
|
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
|
2022-03-26 16:38:42 +01:00
|
|
|
SusAssHelper susAssHelper = SusAssHelper(susIds);
|
|
|
|
auto susAss =
|
|
|
|
new SusAssembly(objects::SUS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, susAssHelper);
|
|
|
|
static_cast<void>(susAss);
|
|
|
|
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
|
|
|
|
}
|
2022-03-31 17:58:16 +02:00
|
|
|
|
|
|
|
void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
2022-05-12 12:21:47 +02:00
|
|
|
PowerSwitchIF* pwrSwitcher, SpiComIF* comIF) {
|
2022-03-31 17:58:16 +02:00
|
|
|
using namespace gpio;
|
|
|
|
GpioCookie* rtdGpioCookie = new GpioCookie;
|
|
|
|
|
|
|
|
GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc0);
|
|
|
|
GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc1);
|
|
|
|
GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc2);
|
|
|
|
GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc3);
|
|
|
|
GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc4);
|
|
|
|
GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc5);
|
|
|
|
GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc6);
|
|
|
|
GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc7);
|
|
|
|
GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc8);
|
|
|
|
GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc9);
|
|
|
|
GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc10);
|
|
|
|
GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc11);
|
|
|
|
GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc12);
|
|
|
|
GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc13);
|
|
|
|
GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc14);
|
|
|
|
GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", Direction::OUT, Levels::HIGH,
|
|
|
|
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
|
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15);
|
|
|
|
|
2022-04-28 18:38:38 +02:00
|
|
|
gpioChecker(gpioComIF->addGpios(rtdGpioCookie), "RTDs");
|
2022-03-31 17:58:16 +02:00
|
|
|
|
|
|
|
#if OBSW_ADD_RTD_DEVICES == 1
|
2022-05-12 12:12:47 +02:00
|
|
|
using namespace EiveMax31855;
|
|
|
|
std::array<std::pair<address_t, gpioId_t>, NUM_RTDS> cookieArgs = {{
|
2022-03-31 17:58:16 +02:00
|
|
|
{addresses::RTD_IC_3, gpioIds::RTD_IC_3},
|
|
|
|
{addresses::RTD_IC_4, gpioIds::RTD_IC_4},
|
|
|
|
{addresses::RTD_IC_5, gpioIds::RTD_IC_5},
|
|
|
|
{addresses::RTD_IC_6, gpioIds::RTD_IC_6},
|
|
|
|
{addresses::RTD_IC_7, gpioIds::RTD_IC_7},
|
|
|
|
{addresses::RTD_IC_8, gpioIds::RTD_IC_8},
|
|
|
|
{addresses::RTD_IC_9, gpioIds::RTD_IC_9},
|
|
|
|
{addresses::RTD_IC_10, gpioIds::RTD_IC_10},
|
|
|
|
{addresses::RTD_IC_11, gpioIds::RTD_IC_11},
|
|
|
|
{addresses::RTD_IC_12, gpioIds::RTD_IC_12},
|
|
|
|
{addresses::RTD_IC_13, gpioIds::RTD_IC_13},
|
|
|
|
{addresses::RTD_IC_14, gpioIds::RTD_IC_14},
|
|
|
|
{addresses::RTD_IC_15, gpioIds::RTD_IC_15},
|
|
|
|
{addresses::RTD_IC_16, gpioIds::RTD_IC_16},
|
|
|
|
{addresses::RTD_IC_17, gpioIds::RTD_IC_17},
|
|
|
|
{addresses::RTD_IC_18, gpioIds::RTD_IC_18},
|
|
|
|
}};
|
2022-05-13 10:33:35 +02:00
|
|
|
// HSPD: Heatspreader
|
2022-05-12 12:12:47 +02:00
|
|
|
std::array<std::pair<object_id_t, std::string>, NUM_RTDS> rtdInfos = {{
|
2022-05-13 10:33:35 +02:00
|
|
|
{objects::RTD_0_IC3_PLOC_HEATSPREADER, "RTD_0_PLOC_HSPD"},
|
|
|
|
{objects::RTD_1_IC4_PLOC_MISSIONBOARD, "RTD_1_PLOC_MISSIONBRD"},
|
2022-05-09 21:29:54 +02:00
|
|
|
{objects::RTD_2_IC5_4K_CAMERA, "RTD_2_4K_CAMERA"},
|
2022-05-13 10:33:35 +02:00
|
|
|
{objects::RTD_3_IC6_DAC_HEATSPREADER, "RTD_3_DAC_HSPD"},
|
2022-05-09 21:29:54 +02:00
|
|
|
{objects::RTD_4_IC7_STARTRACKER, "RTD_4_STARTRACKER"},
|
|
|
|
{objects::RTD_5_IC8_RW1_MX_MY, "RTD_5_RW1_MX_MY"},
|
|
|
|
{objects::RTD_6_IC9_DRO, "RTD_6_DRO"},
|
|
|
|
{objects::RTD_7_IC10_SCEX, "RTD_7_SCEX"},
|
|
|
|
{objects::RTD_8_IC11_X8, "RTD_8_X8"},
|
|
|
|
{objects::RTD_9_IC12_HPA, "RTD_9_HPA"},
|
|
|
|
{objects::RTD_10_IC13_PL_TX, "RTD_10_PL_TX,"},
|
|
|
|
{objects::RTD_11_IC14_MPA, "RTD_11_MPA"},
|
|
|
|
{objects::RTD_12_IC15_ACU, "RTD_12_ACU"},
|
2022-05-13 10:33:35 +02:00
|
|
|
{objects::RTD_13_IC16_PLPCDU_HEATSPREADER, "RTD_13_PLPCDU_HSPD"},
|
2022-05-09 21:29:54 +02:00
|
|
|
{objects::RTD_14_IC17_TCS_BOARD, "RTD_14_TCS_BOARD"},
|
|
|
|
{objects::RTD_15_IC18_IMTQ, "RTD_15_IMTQ"},
|
|
|
|
}};
|
2022-05-12 12:12:47 +02:00
|
|
|
std::array<SpiCookie*, NUM_RTDS> rtdCookies = {};
|
2022-05-14 15:26:08 +02:00
|
|
|
std::array<Max31865EiveHandler*, NUM_RTDS> rtds = {};
|
2022-03-31 17:58:16 +02:00
|
|
|
RtdFdir* rtdFdir = nullptr;
|
2022-05-14 15:26:08 +02:00
|
|
|
// Create special low level reader communication interface
|
|
|
|
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
|
2022-05-12 12:12:47 +02:00
|
|
|
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
|
2022-05-12 09:48:41 +02:00
|
|
|
rtdCookies[idx] = new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second,
|
|
|
|
MAX31865::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
2022-05-14 11:34:25 +02:00
|
|
|
rtdCookies[idx]->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RTD_CS_TIMEOUT);
|
2022-05-14 15:26:08 +02:00
|
|
|
Max31865ReaderCookie* rtdLowLevelCookie =
|
|
|
|
new Max31865ReaderCookie(rtdInfos[idx].first, idx, rtdInfos[idx].second, rtdCookies[idx]);
|
|
|
|
rtds[idx] =
|
|
|
|
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
|
|
|
|
rtds[idx]->setDeviceInfo(idx, rtdInfos[idx].second);
|
2022-03-31 17:58:16 +02:00
|
|
|
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
|
2022-05-09 21:29:54 +02:00
|
|
|
rtdFdir = new RtdFdir(rtdInfos[idx].first);
|
2022-03-31 17:58:16 +02:00
|
|
|
rtds[idx]->setCustomFdir(rtdFdir);
|
2022-04-26 10:37:25 +02:00
|
|
|
#if OBSW_DEBUG_RTD == 1
|
2022-05-14 15:26:08 +02:00
|
|
|
rtds[idx]->setDebugMode(true, 5);
|
2022-04-26 10:37:25 +02:00
|
|
|
#endif
|
2022-03-31 17:58:16 +02:00
|
|
|
#if OBSW_TEST_RTD == 1
|
2022-05-14 15:26:08 +02:00
|
|
|
rtds[idx]->setInstantNormal(true);
|
2022-05-12 12:12:47 +02:00
|
|
|
rtds[idx]->setStartUpImmediately();
|
2022-05-14 15:26:08 +02:00
|
|
|
#endif
|
2022-03-31 17:58:16 +02:00
|
|
|
}
|
2022-05-12 12:12:47 +02:00
|
|
|
|
2022-05-09 21:29:54 +02:00
|
|
|
TcsBoardHelper helper(rtdInfos);
|
2022-03-31 17:58:16 +02:00
|
|
|
TcsBoardAssembly* tcsBoardAss =
|
|
|
|
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
|
2022-04-07 19:48:09 +02:00
|
|
|
pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
|
2022-03-31 17:58:16 +02:00
|
|
|
static_cast<void>(tcsBoardAss);
|
|
|
|
#endif // OBSW_ADD_RTD_DEVICES == 1
|
|
|
|
}
|
2022-04-28 18:38:38 +02:00
|
|
|
|
|
|
|
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
|
|
|
}
|
|
|
|
}
|