Swap PL and PS I2C #725

Merged
muellerr merged 20 commits from swap-pl-ps-i2c into main 2023-07-06 15:05:54 +02:00
5 changed files with 35 additions and 17 deletions
Showing only changes of commit d1b9608a14 - Show all commits

View File

@ -68,7 +68,11 @@ void ObjectFactory::produce(void* args) {
{objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}}; }};
createTmpComponents(tmpDevsToAdd); const char* tmpI2cDev = q7s::I2C_PS_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
tmpI2cDev = q7s::I2C_PL_EIVE;
}
createTmpComponents(tmpDevsToAdd, tmpI2cDev);
dummy::Tmp1075Cfg tmpCfg{}; dummy::Tmp1075Cfg tmpCfg{};
tmpCfg.addTcsBrd0 = true; tmpCfg.addTcsBrd0 = true;
tmpCfg.addTcsBrd1 = true; tmpCfg.addTcsBrd1 = true;
@ -114,8 +118,12 @@ void ObjectFactory::produce(void* args) {
gpioChecker(gpioComIF->addGpios(acsBoardGpios), "ACS Board"); gpioChecker(gpioComIF->addGpios(acsBoardGpios), "ACS Board");
#endif #endif
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
}
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher, enableHkSets); createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev);
#endif #endif
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
@ -127,7 +135,7 @@ void ObjectFactory::produce(void* args) {
#endif #endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 #if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent(enableHkSets); createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
#endif #endif
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1

View File

@ -76,7 +76,11 @@ void ObjectFactory::produce(void* args) {
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, // {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}}; }};
createTmpComponents(tmpDevsToAdd); const char* tmpI2cDev = q7s::I2C_PS_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
tmpI2cDev = q7s::I2C_PL_EIVE;
}
createTmpComponents(tmpDevsToAdd, tmpI2cDev);
#endif #endif
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF); createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler); createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
@ -86,13 +90,17 @@ void ObjectFactory::produce(void* args) {
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF); createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF, *pwrSwitcher); createPayloadComponents(gpioComIF, *pwrSwitcher);
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
}
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher, enableHkSets); createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev);
#endif #endif
createReactionWheelComponents(gpioComIF, pwrSwitcher); createReactionWheelComponents(gpioComIF, pwrSwitcher);
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 #if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent(enableHkSets); createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
#endif #endif
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1

View File

@ -161,13 +161,13 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
void ObjectFactory::createTmpComponents( void ObjectFactory::createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd,
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd) { const char* i2cDev) {
std::vector<I2cCookie*> tmpDevCookies; std::vector<I2cCookie*> tmpDevCookies;
for (size_t idx = 0; idx < tmpDevsToAdd.size(); idx++) { for (size_t idx = 0; idx < tmpDevsToAdd.size(); idx++) {
tmpDevCookies.push_back( tmpDevCookies.push_back(
new I2cCookie(tmpDevsToAdd[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_PL_EIVE)); new I2cCookie(tmpDevsToAdd[idx].second, TMP1075::MAX_REPLY_LENGTH, i2cDev));
auto* tmpDevHandler = auto* tmpDevHandler =
new Tmp1075Handler(tmpDevsToAdd[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]); new Tmp1075Handler(tmpDevsToAdd[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]);
tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first)); tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first));
@ -957,12 +957,13 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
starTracker->setCustomFdir(strFdir); starTracker->setCustomFdir(strFdir);
} }
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets) { void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets,
const char* i2cDev) {
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY); auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
new ImtqPollingTask(objects::IMTQ_POLLING, I2C_FATAL_ERRORS); new ImtqPollingTask(objects::IMTQ_POLLING, I2C_FATAL_ERRORS);
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, imtq::MAX_REPLY_SIZE, q7s::I2C_PS_EIVE); I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, imtq::MAX_REPLY_SIZE, i2cDev);
auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::IMTQ_POLLING, imtqI2cCookie, auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::IMTQ_POLLING, imtqI2cCookie,
power::Switches::PDU1_CH3_MGT_5V, enableHkSets); power::Switches::PDU1_CH3_MGT_5V, enableHkSets);
imtqHandler->enableThermalModule(ThermalStateCfg()); imtqHandler->enableThermalModule(ThermalStateCfg());
@ -978,8 +979,8 @@ void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enable
#endif #endif
} }
void ObjectFactory::createBpxBatteryComponent(bool enableHkSets) { void ObjectFactory::createBpxBatteryComponent(bool enableHkSets, const char* i2cDev) {
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_PS_EIVE); I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, i2cDev);
BpxBatteryHandler* bpxHandler = new BpxBatteryHandler( BpxBatteryHandler* bpxHandler = new BpxBatteryHandler(
objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie, enableHkSets); objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie, enableHkSets);
bpxHandler->setStartUpImmediately(); bpxHandler->setStartUpImmediately();

View File

@ -58,7 +58,8 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
bool enableHkSets); bool enableHkSets);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler); PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler);
void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd); void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd,
const char* i2cDev);
void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF); void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF);
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler); ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
void createAcsBoardGpios(GpioCookie& cookie); void createAcsBoardGpios(GpioCookie& cookie);
@ -67,8 +68,8 @@ void createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF* gpioComIF, Ser
adis1650x::Type adisType); adis1650x::Type adisType);
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable, void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable,
HeaterHandler*& heaterHandler); HeaterHandler*& heaterHandler);
void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets); void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets, const char* i2cDev);
void createBpxBatteryComponent(bool enableHkSets); void createBpxBatteryComponent(bool enableHkSets, const char* i2cDev);
void createStrComponents(PowerSwitchIF* pwrSwitcher); void createStrComponents(PowerSwitchIF* pwrSwitcher);
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF); void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher); void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);