create low level rtd handler in obj factory
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
||||
#include <linux/callbacks/gpioCallbacks.h>
|
||||
#include <linux/devices/Max31865RtdLowlevelHandler.h>
|
||||
#include <mission/devices/Max31865EiveHandler.h>
|
||||
#include <mission/devices/Max31865PT1000Handler.h>
|
||||
#include <mission/devices/SusHandler.h>
|
||||
#include <mission/system/SusAssembly.h>
|
||||
@ -245,8 +247,8 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
gpioChecker(gpioComIF->addGpios(rtdGpioCookie), "RTDs");
|
||||
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
static constexpr uint8_t NUMBER_RTDS = 16;
|
||||
std::array<std::pair<address_t, gpioId_t>, NUMBER_RTDS> cookieArgs = {{
|
||||
using namespace EiveMax31855;
|
||||
std::array<std::pair<address_t, gpioId_t>, NUM_RTDS> cookieArgs = {{
|
||||
{addresses::RTD_IC_3, gpioIds::RTD_IC_3},
|
||||
{addresses::RTD_IC_4, gpioIds::RTD_IC_4},
|
||||
{addresses::RTD_IC_5, gpioIds::RTD_IC_5},
|
||||
@ -264,7 +266,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
{addresses::RTD_IC_17, gpioIds::RTD_IC_17},
|
||||
{addresses::RTD_IC_18, gpioIds::RTD_IC_18},
|
||||
}};
|
||||
std::array<std::pair<object_id_t, std::string>, NUMBER_RTDS> rtdInfos = {{
|
||||
std::array<std::pair<object_id_t, std::string>, NUM_RTDS> rtdInfos = {{
|
||||
{objects::RTD_0_IC3_PLOC_HEATSPREADER, "RTD_0_PLOC_HEATSPREADER"},
|
||||
{objects::RTD_1_IC4_PLOC_MISSIONBOARD, "RTD_1_PLOC_MISSIONBOARD"},
|
||||
{objects::RTD_2_IC5_4K_CAMERA, "RTD_2_4K_CAMERA"},
|
||||
@ -282,31 +284,44 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
{objects::RTD_14_IC17_TCS_BOARD, "RTD_14_TCS_BOARD"},
|
||||
{objects::RTD_15_IC18_IMTQ, "RTD_15_IMTQ"},
|
||||
}};
|
||||
std::array<SpiCookie*, NUMBER_RTDS> rtdCookies = {};
|
||||
std::array<Max31865PT1000Handler*, NUMBER_RTDS> rtds = {};
|
||||
std::array<SpiCookie*, NUM_RTDS> rtdCookies = {};
|
||||
std::array<DeviceHandlerBase*, NUM_RTDS> rtds = {};
|
||||
RtdFdir* rtdFdir = nullptr;
|
||||
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
|
||||
bool useDirectHandler = false;
|
||||
auto directRtdsCreator = [&](uint8_t idx) {
|
||||
auto typedHandler =
|
||||
new Max31865PT1000Handler(rtdInfos[idx].first, objects::SPI_MAIN_COM_IF, rtdCookies[idx]);
|
||||
rtds[idx] = typedHandler;
|
||||
typedHandler->setDeviceInfo(idx + 3, rtdInfos[idx].second);
|
||||
};
|
||||
auto lowLevelRtdsCreator = [&](uint8_t idx) {
|
||||
Max31865ReaderCookie* rtdLowLevelCookie =
|
||||
new Max31865ReaderCookie(rtdInfos[idx].first, idx, rtdInfos[idx].second, rtdCookies[idx]);
|
||||
auto typedHandler =
|
||||
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_MAIN_COM_IF, rtdLowLevelCookie);
|
||||
rtds[idx] = typedHandler;
|
||||
typedHandler->setDeviceInfo(idx, rtdInfos[idx].second);
|
||||
};
|
||||
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
|
||||
rtdCookies[idx] = new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second,
|
||||
MAX31865::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||
rtds[idx] =
|
||||
new Max31865PT1000Handler(rtdInfos[idx].first, objects::SPI_MAIN_COM_IF, rtdCookies[idx]);
|
||||
if (useDirectHandler) {
|
||||
directRtdsCreator(idx);
|
||||
} else {
|
||||
lowLevelRtdsCreator(idx);
|
||||
}
|
||||
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
|
||||
rtdFdir = new RtdFdir(rtdInfos[idx].first);
|
||||
rtds[idx]->setCustomFdir(rtdFdir);
|
||||
rtds[idx]->setDeviceInfo(idx + 3, rtdInfos[idx].second);
|
||||
#if OBSW_DEBUG_RTD == 1
|
||||
rtds[idx]->setDebugMode(true);
|
||||
#endif
|
||||
#if OBSW_TEST_RTD == 1
|
||||
rtds[idx]->setStartUpImmediately();
|
||||
rtds[idx]->setInstantNormal(true);
|
||||
#endif // OBSW_TEST_RTD == 1
|
||||
}
|
||||
|
||||
#if OBSW_TEST_RTD == 1
|
||||
for (auto& rtd : rtds) {
|
||||
if (rtd != nullptr) {
|
||||
rtd->setStartUpImmediately();
|
||||
rtd->setInstantNormal(true);
|
||||
}
|
||||
}
|
||||
#endif // OBSW_TEST_RTD == 1
|
||||
TcsBoardHelper helper(rtdInfos);
|
||||
TcsBoardAssembly* tcsBoardAss =
|
||||
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "fsfw/devicehandlers/DeviceCommunicationIF.h"
|
||||
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||
|
||||
struct Max31865ReaderCookie {
|
||||
struct Max31865ReaderCookie : public CookieIF {
|
||||
Max31865ReaderCookie(){};
|
||||
Max31865ReaderCookie(object_id_t handlerId_, uint8_t idx_, const std::string& locString_,
|
||||
SpiCookie* spiCookie_)
|
||||
|
Reference in New Issue
Block a user