create and pass correct comIF
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2022-05-12 12:21:47 +02:00
parent a173ef4308
commit 382d93863f
6 changed files with 13 additions and 7 deletions

View File

@@ -191,7 +191,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
}
void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
PowerSwitchIF* pwrSwitcher) {
PowerSwitchIF* pwrSwitcher, SpiComIF* comIF) {
using namespace gpio;
GpioCookie* rtdGpioCookie = new GpioCookie;
@@ -288,6 +288,10 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
std::array<DeviceHandlerBase*, NUM_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
bool useDirectHandler = false;
if (not useDirectHandler) {
// Create special low level reader communication interface
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF);
}
auto directRtdsCreator = [&](uint8_t idx) {
auto typedHandler =
new Max31865PT1000Handler(rtdInfos[idx].first, objects::SPI_MAIN_COM_IF, rtdCookies[idx]);
@@ -298,7 +302,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
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);
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
rtds[idx] = typedHandler;
typedHandler->setDeviceInfo(idx, rtdInfos[idx].second);
};