create and pass correct comIF
EIVE/eive-obsw/pipeline/head This commit looks good Details

This commit is contained in:
Robin Müller 2022-05-12 12:21:47 +02:00
parent a173ef4308
commit 382d93863f
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 13 additions and 7 deletions

View File

@ -37,7 +37,7 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher);
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF);
#if OBSW_ADD_MGT == 1

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);
};

View File

@ -12,7 +12,8 @@ namespace ObjectFactory {
void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher,
std::string spiDev);
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher,
SpiComIF* comIF);
void gpioChecker(ReturnValue_t result, std::string output);

View File

@ -2,8 +2,8 @@
#include <fsfw/tasks/TaskFactory.h>
Max31865RtdReader::Max31865RtdReader(object_id_t objectId, SpiComIF* comIF)
: SystemObject(objectId), rtds(EiveMax31855::NUM_RTDS), comIF(comIF) {
Max31865RtdReader::Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelComIF)
: SystemObject(objectId), rtds(EiveMax31855::NUM_RTDS), comIF(lowLevelComIF) {
readerMutex = MutexFactory::instance()->createMutex();
}

View File

@ -38,7 +38,7 @@ class Max31865RtdReader : public SystemObject,
public ExecutableObjectIF,
public DeviceCommunicationIF {
public:
Max31865RtdReader(object_id_t objectId, SpiComIF* comIF);
Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelComIF);
[[noreturn]] ReturnValue_t performOperation(uint8_t operationCode) override;

View File

@ -50,6 +50,7 @@ enum sourceObjects : uint32_t {
SPI_MAIN_COM_IF = 0x49020004,
GPIO_IF = 0x49010005,
SPI_RW_COM_IF = 0x49020005,
SPI_RTD_COM_IF = 0x49020006,
/* Custom device handler */
PCDU_HANDLER = 0x442000A1,