meier/syrlinks #199

Merged
muellerr merged 11 commits from meier/syrlinks into develop 2022-04-06 12:09:51 +02:00
36 changed files with 1189 additions and 994 deletions
Showing only changes of commit d48ec92d09 - Show all commits

View File

@ -1,6 +1,7 @@
target_sources(${OBSW_NAME} PUBLIC target_sources(${OBSW_NAME} PUBLIC
InitMission.cpp InitMission.cpp
main.cpp main.cpp
gpioInit.cpp
ObjectFactory.cpp ObjectFactory.cpp
) )

View File

@ -192,7 +192,7 @@ void initmission::createPstTasks(TaskFactory& factory,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if OBSW_ADD_SPI_TEST_CODE == 0 #if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc); "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstSpi(spiPst); result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;

View File

@ -5,10 +5,13 @@
#include "devices/addresses.h" #include "devices/addresses.h"
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/power/DummyPowerSwitcher.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/CommandingServiceBase.h"
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "gpioInit.h"
#include "linux/ObjectFactory.h"
#include "linux/boardtest/LibgpiodTest.h" #include "linux/boardtest/LibgpiodTest.h"
#include "linux/boardtest/SpiTestClass.h" #include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h" #include "linux/boardtest/UartTestClass.h"
@ -64,37 +67,55 @@ void ObjectFactory::produce(void* args) {
GpioCookie* gpioCookie = nullptr; GpioCookie* gpioCookie = nullptr;
static_cast<void>(gpioCookie); static_cast<void>(gpioCookie);
new SpiComIF(objects::SPI_COM_IF, gpioIF); SpiComIF* spiComIF = new SpiComIF(objects::SPI_COM_IF, gpioIF);
static_cast<void>(spiComIF);
auto pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
static_cast<void>(pwrSwitcher);
std::string spiDev; #if OBSW_ADD_ACS_BOARD == 1 && defined(RASPBERRY_PI)
SpiCookie* spiCookie = nullptr; createRpiAcsBoard(gpioIF, spiDev);
static_cast<void>(spiCookie); #endif
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_SUN_SENSORS == 1 || defined(OBSW_ADD_RTD_DEVICES)
if (gpioCookie == nullptr) { #ifdef RASPBERRY_PI
gpioCookie = new GpioCookie(); rpi::gpio::initSpiCsDecoder(gpioIF);
} #endif
#endif
#if OBSW_ADD_SUN_SENSORS == 1
createSunSensorComponents(gpioIF, spiComIF, pwrSwitcher, spi::DEV);
#endif
#if OBSW_ADD_RTD_DEVICES == 1
createRtdComponents(spi::DEV, gpioIF, pwrSwitcher);
#endif
#if OBSW_ADD_TEST_CODE == 1
createTestTasks();
#endif /* OBSW_ADD_TEST_CODE == 1 */
}
void ObjectFactory::createRpiAcsBoard(GpioIF* gpioIF, std::string spiDev) {
GpioCookie* gpioCookie = new GpioCookie();
// TODO: Missing pin for Gyro 2 // TODO: Missing pin for Gyro 2
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3", gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3",
gpio::Direction::OUT, 1); gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
"MGM_1_RM3100", gpio::Direction::OUT, 1); "MGM_1_RM3100", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3", gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3",
gpio::Direction::OUT, 1); gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
"MGM_3_RM3100", gpio::Direction::OUT, 1); "MGM_3_RM3100", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1); "GYRO_0_ADIS", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G", gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G",
gpio::Direction::OUT, 1); gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN, gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_ADIS", gpio::Direction::OUT, 1); "GYRO_2_ADIS", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G", gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G",
gpio::Direction::OUT, 1); gpio::Direction::OUT, gpio::Levels::HIGH);
gpioIF->addGpios(gpioCookie); gpioIF->addGpios(gpioCookie);
SpiCookie* spiCookie =
spiDev = "/dev/spidev0.1";
spiCookie =
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = auto mgmLis3Handler =
@ -136,9 +157,9 @@ void ObjectFactory::produce(void* args) {
spiCookie = spiCookie =
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto adisHandler = auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately(); adisHandler->setStartUpImmediately();
spiCookie = spiCookie =
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
@ -152,9 +173,9 @@ void ObjectFactory::produce(void* args) {
spiCookie = spiCookie =
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
adisHandler = adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately(); adisHandler->setStartUpImmediately();
spiCookie = spiCookie =
@ -166,12 +187,6 @@ void ObjectFactory::produce(void* args) {
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
gyroL3gHandler->setToGoToNormalMode(true); gyroL3gHandler->setToGoToNormalMode(true);
#endif #endif
#endif /* RPI_TEST_ACS_BOARD == 1 */
#if OBSW_ADD_TEST_CODE == 1
createTestTasks();
#endif /* OBSW_ADD_TEST_CODE == 1 */
} }
void ObjectFactory::createTestTasks() { void ObjectFactory::createTestTasks() {

View File

@ -1,10 +1,15 @@
#ifndef BSP_LINUX_OBJECTFACTORY_H_ #ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_ #define BSP_LINUX_OBJECTFACTORY_H_
#include <string>
class GpioIF;
namespace ObjectFactory { namespace ObjectFactory {
void setStatics(); void setStatics();
void produce(void* args); void produce(void* args);
void createRpiAcsBoard(GpioIF* gpioIF, std::string spiDev);
void createTestTasks(); void createTestTasks();
}; // namespace ObjectFactory }; // namespace ObjectFactory

View File

@ -17,16 +17,4 @@
#define RPI_ADD_UART_TEST 0 #define RPI_ADD_UART_TEST 0
/* Adapt these values accordingly */
namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 17;
static constexpr uint8_t MGM_1_BCM_PIN = 27;
static constexpr uint8_t MGM_2_BCM_PIN = 22;
static constexpr uint8_t MGM_3_BCM_PIN = 23;
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
static constexpr uint8_t GYRO_2_BCM_PIN = 13;
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
}
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */ #endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */

View File

@ -0,0 +1,37 @@
#ifndef BSP_LINUX_BOARD_DEFINITIONS_H_
#define BSP_LINUX_BOARD_DEFINITIONS_H_
#include <cstdint>
#include "OBSWConfig.h"
#ifdef RASPBERRY_PI
namespace spi {
static constexpr char DEV[] = "/dev/spidev0.1";
}
/* Adapt these values accordingly */
namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 17;
static constexpr uint8_t MGM_1_BCM_PIN = 27;
static constexpr uint8_t MGM_2_BCM_PIN = 22;
static constexpr uint8_t MGM_3_BCM_PIN = 23;
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
static constexpr uint8_t GYRO_2_BCM_PIN = 13;
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
static constexpr uint8_t SPI_MUX_0_BCM = 17;
static constexpr uint8_t SPI_MUX_1_BCM = 27;
static constexpr uint8_t SPI_MUX_2_BCM = 22;
static constexpr uint8_t SPI_MUX_3_BCM = 23;
static constexpr uint8_t SPI_MUX_4_BCM = 5;
static constexpr uint8_t SPI_MUX_5_BCM = 6;
} // namespace gpio
#endif
#endif /* BSP_LINUX_BOARD_DEFINITIONS_H_ */

View File

@ -0,0 +1,56 @@
#include "gpioInit.h"
#include <devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include "definitions.h"
#include "fsfw_hal/linux/rpi/GpioRPi.h"
#ifdef RASPBERRY_PI
struct MuxInfo {
MuxInfo(gpioId_t gpioId, int bcmNum, std::string consumer)
: gpioId(gpioId), bcmNum(bcmNum), consumer(consumer) {}
gpioId_t gpioId;
int bcmNum;
std::string consumer;
};
void rpi::gpio::initSpiCsDecoder(GpioIF* gpioComIF) {
using namespace ::gpio;
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
std::array<::MuxInfo, 6> muxInfo{
MuxInfo(gpioIds::SPI_MUX_BIT_0, SPI_MUX_0_BCM, "SPI_MUX_0"),
MuxInfo(gpioIds::SPI_MUX_BIT_1, SPI_MUX_1_BCM, "SPI_MUX_1"),
MuxInfo(gpioIds::SPI_MUX_BIT_2, SPI_MUX_2_BCM, "SPI_MUX_2"),
MuxInfo(gpioIds::SPI_MUX_BIT_3, SPI_MUX_3_BCM, "SPI_MUX_3"),
MuxInfo(gpioIds::SPI_MUX_BIT_4, SPI_MUX_4_BCM, "SPI_MUX_4"),
MuxInfo(gpioIds::SPI_MUX_BIT_5, SPI_MUX_5_BCM, "SPI_MUX_5"),
};
GpioCookie* spiMuxGpios = new GpioCookie;
for (const auto& info : muxInfo) {
result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer,
Direction::OUT, Levels::LOW);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl;
return;
}
}
result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}
#endif

View File

@ -0,0 +1,20 @@
#pragma once
#include "OBSWConfig.h"
class GpioIF;
#ifdef RASPBERRY_PI
namespace rpi {
namespace gpio {
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
} // namespace gpio
} // namespace rpi
#endif

View File

@ -22,7 +22,7 @@ int main(void) {
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl; std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "." std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
<< SW_REVISION << ", FSFW v" << fsfw::FSFW_VERSION << "--" << std::endl; << SW_REVISION << ", FSFW v" << fsfw::FSFW_VERSION << " --" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission(); initmission::initMission();

View File

@ -2,5 +2,5 @@ target_sources(${OBSW_NAME} PRIVATE
rwSpiCallback.cpp rwSpiCallback.cpp
gnssCallback.cpp gnssCallback.cpp
pcduSwitchCb.cpp pcduSwitchCb.cpp
gpioCallbacks.cpp q7sGpioCallbacks.cpp
) )

View File

@ -1,487 +0,0 @@
#include "gpioCallbacks.h"
#include <devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include "busConf.h"
namespace gpioCallbacks {
GpioIF* gpioComInterface;
void initSpiCsDecoder(GpioIF* gpioComIF) {
using namespace gpio;
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
gpioComInterface = gpioComIF;
GpioCookie* spiMuxGpios = new GpioCookie;
GpiodRegularByLineName* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
/** Setting mux bit 2 to low disables IC1 on the TCS board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
/** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
void* args) {
using namespace gpio;
if (gpioComInterface == nullptr) {
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl;
return;
}
/* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) {
return;
}
if (value == Levels::HIGH) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_4): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_5): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_6): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_7): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_8): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_9): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_10): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_11): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_12): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_13): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_14): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_15): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_16): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_17): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_18): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::CS_SUS_0): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_1): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_2): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_3): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_4): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_5): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_6): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_7): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_8): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_9): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_10): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_11): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_RW1): {
disableRwDecoder();
break;
}
case (gpioIds::CS_RW2): {
disableRwDecoder();
break;
}
case (gpioIds::CS_RW3): {
disableRwDecoder();
break;
}
case (gpioIds::CS_RW4): {
disableRwDecoder();
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else if (value == Levels::LOW) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
selectY7();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_4): {
selectY6();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_5): {
selectY5();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_6): {
selectY4();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_7): {
selectY3();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_8): {
selectY2();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_9): {
selectY1();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_10): {
selectY0();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_11): {
selectY7();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_12): {
selectY6();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_13): {
selectY5();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_14): {
selectY4();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_15): {
selectY3();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_16): {
selectY2();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_17): {
selectY1();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_18): {
selectY0();
enableDecoderTcsIc2();
break;
}
case (gpioIds::CS_SUS_0): {
selectY0();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_1): {
selectY1();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_2): {
selectY2();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_3): {
selectY3();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_4): {
selectY4();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_5): {
selectY5();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_6): {
selectY0();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_7): {
selectY1();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_8): {
selectY2();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_9): {
selectY3();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_10): {
selectY4();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_11): {
selectY5();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_RW1): {
selectY0();
enableRwDecoder();
break;
}
case (gpioIds::CS_RW2): {
selectY1();
enableRwDecoder();
break;
}
case (gpioIds::CS_RW3): {
selectY2();
enableRwDecoder();
break;
}
case (gpioIds::CS_RW4): {
selectY3();
enableRwDecoder();
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else {
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
}
}
void enableDecoderTcsIc1() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void enableDecoderTcsIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void enableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void enableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderTcsIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderTcsIc2() {
// DO NOT CHANGE THE ORDER HERE
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void disableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
void selectY0() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY2() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY3() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY4() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void selectY5() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void selectY6() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void selectY7() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void disableAllDecoder() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
}
} // namespace gpioCallbacks

View File

@ -0,0 +1,54 @@
#include "q7sGpioCallbacks.h"
#include <devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include "busConf.h"
void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
using namespace gpio;
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
GpioCookie* spiMuxGpios = new GpioCookie;
GpiodRegularByLineName* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
/** Setting mux bit 2 to low disables IC1 on the TCS board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
/** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}

View File

@ -0,0 +1,15 @@
#pragma once
class GpioIF;
namespace q7s {
namespace gpioCallbacks {
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
} // namespace gpioCallbacks
} // namespace q7s

View File

@ -127,12 +127,14 @@ void initmission::initTasks() {
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
result = sysTask->addComponent(objects::ACS_BOARD_ASS); result = sysTask->addComponent(objects::ACS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ACS_ASS", objects::ACS_BOARD_ASS); initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
} }
#if OBSW_ADD_SUS_BOARD_ASS == 1
result = sysTask->addComponent(objects::SUS_BOARD_ASS); result = sysTask->addComponent(objects::SUS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SUS_ASS", objects::SUS_BOARD_ASS); initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
} }
#endif
result = sysTask->addComponent(objects::TCS_BOARD_ASS); result = sysTask->addComponent(objects::TCS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS); initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);

View File

@ -1,22 +1,10 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <fsfw/ipc/QueueFactory.h>
#include <linux/obc/AxiPtmeConfig.h>
#include <linux/obc/PapbVcInterface.h>
#include <linux/obc/PdecHandler.h>
#include <linux/obc/Ptme.h>
#include <linux/obc/PtmeConfig.h>
#include <mission/system/AcsBoardFdir.h>
#include <mission/system/RtdFdir.h>
#include <mission/system/SusAssembly.h>
#include <mission/system/SusFdir.h>
#include <mission/system/TcsBoardAssembly.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/callbacks/gnssCallback.h" #include "bsp_q7s/callbacks/gnssCallback.h"
#include "bsp_q7s/callbacks/gpioCallbacks.h"
#include "bsp_q7s/callbacks/pcduSwitchCb.h" #include "bsp_q7s/callbacks/pcduSwitchCb.h"
#include "bsp_q7s/callbacks/q7sGpioCallbacks.h"
#include "bsp_q7s/callbacks/rwSpiCallback.h" #include "bsp_q7s/callbacks/rwSpiCallback.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/memory/FileSystemHandler.h" #include "bsp_q7s/memory/FileSystemHandler.h"
@ -26,9 +14,12 @@
#include "devices/addresses.h" #include "devices/addresses.h"
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
#include "fsfw/ipc/QueueFactory.h"
#include "linux/ObjectFactory.h"
#include "linux/boardtest/I2cTestClass.h" #include "linux/boardtest/I2cTestClass.h"
#include "linux/boardtest/SpiTestClass.h" #include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h" #include "linux/boardtest/UartTestClass.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "linux/csp/CspComIF.h" #include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h" #include "linux/csp/CspCookie.h"
#include "linux/devices/GPSHyperionLinuxController.h" #include "linux/devices/GPSHyperionLinuxController.h"
@ -41,6 +32,16 @@
#include "linux/devices/ploc/PlocUpdater.h" #include "linux/devices/ploc/PlocUpdater.h"
#include "linux/devices/startracker/StarTrackerHandler.h" #include "linux/devices/startracker/StarTrackerHandler.h"
#include "linux/devices/startracker/StrHelper.h" #include "linux/devices/startracker/StrHelper.h"
#include "linux/obc/AxiPtmeConfig.h"
#include "linux/obc/PapbVcInterface.h"
#include "linux/obc/PdecHandler.h"
#include "linux/obc/Ptme.h"
#include "linux/obc/PtmeConfig.h"
#include "mission/system/AcsBoardFdir.h"
#include "mission/system/RtdFdir.h"
#include "mission/system/SusAssembly.h"
#include "mission/system/SusFdir.h"
#include "mission/system/TcsBoardAssembly.h"
#include "tmtc/apid.h" #include "tmtc/apid.h"
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
@ -138,10 +139,10 @@ void ObjectFactory::produce(void* args) {
createTmpComponents(); createTmpComponents();
new CoreController(objects::CORE_CONTROLLER); new CoreController(objects::CORE_CONTROLLER);
gpioCallbacks::disableAllDecoder(); gpioCallbacks::disableAllDecoder(gpioComIF);
createPcduComponents(gpioComIF, &pwrSwitcher); createPcduComponents(gpioComIF, &pwrSwitcher);
createRadSensorComponent(gpioComIF); createRadSensorComponent(gpioComIF);
createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher); createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher); createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
@ -153,7 +154,7 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(); createSyrlinksComponents();
#endif /* OBSW_ADD_SYRLINKS == 1 */ #endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(gpioComIF, pwrSwitcher); createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher);
createPayloadComponents(gpioComIF); createPayloadComponents(gpioComIF);
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
@ -238,7 +239,7 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF); *spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
/* Adding gpios for chip select decoding to the gpioComIf */ /* Adding gpios for chip select decoding to the gpioComIf */
gpioCallbacks::initSpiCsDecoder(*gpioComIF); q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
} }
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) { void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
@ -251,10 +252,8 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie);
PDU1Handler* pdu1handler = PDU1Handler* pdu1handler =
new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie);
pdu1handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF);
PDU2Handler* pdu2handler = PDU2Handler* pdu2handler =
new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie);
pdu2handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie);
auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50);
@ -299,161 +298,6 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
#endif #endif
} }
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher) {
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);
gpioComIF->addGpios(gpioCookieSus);
SusFdir* fdir = nullptr;
std::array<SusHandler*, 12> susHandlers = {};
#if OBSW_ADD_SUN_SENSORS == 1
SpiCookie* spiCookie =
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[0] = new SusHandler(objects::SUS_0, 0, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_0);
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
susHandlers[0]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[1] = new SusHandler(objects::SUS_1, 1, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_1);
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
susHandlers[1]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[2] = new SusHandler(objects::SUS_2, 2, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_2);
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
susHandlers[2]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[3] = new SusHandler(objects::SUS_3, 3, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_3);
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
susHandlers[3]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[4] = new SusHandler(objects::SUS_4, 4, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_4);
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
susHandlers[4]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[5] = new SusHandler(objects::SUS_5, 5, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_5);
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
susHandlers[5]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[6] = new SusHandler(objects::SUS_6, 6, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_6);
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
susHandlers[6]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[7] = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_7);
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
susHandlers[7]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[8] = new SusHandler(objects::SUS_8, 8, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_8);
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
susHandlers[8]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[9] = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_9);
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
susHandlers[9]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[10] = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_10);
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
susHandlers[10]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV,
SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[11] = new SusHandler(objects::SUS_11, 11, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_11);
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
}
}
std::array<object_id_t, 12> susIds = {objects::SUS_0, objects::SUS_1, objects::SUS_2,
objects::SUS_3, objects::SUS_4, objects::SUS_5,
objects::SUS_6, objects::SUS_7, objects::SUS_8,
objects::SUS_9, objects::SUS_10, objects::SUS_11};
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 */
}
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF, void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
PowerSwitchIF* pwrSwitcher) { PowerSwitchIF* pwrSwitcher) {
using namespace gpio; using namespace gpio;
@ -712,15 +556,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
acsBoardHelper, gpioComIF); acsBoardHelper, gpioComIF);
static_cast<void>(acsAss); static_cast<void>(acsAss);
#if OBSW_TEST_ACS_BOARD_ASS == 1
CommandMessage msg;
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
duallane::A_SIDE);
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Sending mode command failed" << std::endl;
}
#endif
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */ #endif /* OBSW_ADD_ACS_HANDLERS == 1 */
} }
@ -800,116 +635,6 @@ void ObjectFactory::createSyrlinksComponents() {
pcduSwitches::PDU1_CH1_SYRLINKS_12V); pcduSwitches::PDU1_CH1_SYRLINKS_12V);
} }
void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher) {
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);
gpioComIF->addGpios(rtdGpioCookie);
static constexpr uint8_t NUMBER_RTDS = 16;
#if OBSW_ADD_RTD_DEVICES == 1
std::array<std::pair<address_t, gpioId_t>, NUMBER_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},
{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},
}};
std::array<object_id_t, NUMBER_RTDS> rtdIds = {
objects::RTD_IC_3, objects::RTD_IC_4, objects::RTD_IC_5, objects::RTD_IC_6,
objects::RTD_IC_7, objects::RTD_IC_8, objects::RTD_IC_9, objects::RTD_IC_10,
objects::RTD_IC_11, objects::RTD_IC_12, objects::RTD_IC_13, objects::RTD_IC_14,
objects::RTD_IC_15, objects::RTD_IC_16, objects::RTD_IC_17, objects::RTD_IC_18};
std::array<SpiCookie*, NUMBER_RTDS> rtdCookies = {};
std::array<Max31865PT1000Handler*, NUMBER_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
rtdCookies[idx] =
new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second, q7s::SPI_DEFAULT_DEV,
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
rtds[idx] = new Max31865PT1000Handler(rtdIds[idx], objects::SPI_COM_IF, rtdCookies[idx]);
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
rtdFdir = new RtdFdir(rtdIds[idx]);
rtds[idx]->setCustomFdir(rtdFdir);
rtds[idx]->setDeviceIdx(idx + 3);
}
#if OBSW_TEST_RTD == 1
for (auto& rtd : rtds) {
if (rtd != nullptr) {
rtd->setStartUpImmediately();
rtd->setInstantNormal(true);
}
}
#endif // OBSW_TEST_RTD == 1
TcsBoardHelper helper(rtdIds);
TcsBoardAssembly* tcsBoardAss =
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
pcduSwitches::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
static_cast<void>(tcsBoardAss);
#endif // OBSW_ADD_RTD_DEVICES == 1
}
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
using namespace gpio; using namespace gpio;
std::stringstream consumer; std::stringstream consumer;
@ -937,9 +662,9 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
auto supvGpioCookie = new GpioCookie; auto supvGpioCookie = new GpioCookie;
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv); supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
gpioComIF->addGpios(supvGpioCookie); gpioComIF->addGpios(supvGpioCookie);
auto supervisorCookie = new UartCookie( auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20); uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20);
supervisorCookie->setNoFixedSizeReply(); supervisorCookie->setNoFixedSizeReply();
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
@ -1226,3 +951,13 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
new UartTestClass(objects::UART_TEST); new UartTestClass(objects::UART_TEST);
#endif #endif
} }
void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
CommandMessage msg;
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
duallane::A_SIDE);
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Sending mode command failed" << std::endl;
}
}

View File

@ -6,6 +6,7 @@ class UartComIF;
class SpiComIF; class SpiComIF;
class I2cComIF; class I2cComIF;
class PowerSwitchIF; class PowerSwitchIF;
class AcsBoardAssembly;
namespace ObjectFactory { namespace ObjectFactory {
@ -19,19 +20,18 @@ void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher); PowerSwitchIF* pwrSwitcher);
void createTmpComponents(); void createTmpComponents();
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF); void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF, void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
PowerSwitchIF* pwrSwitcher); PowerSwitchIF* pwrSwitcher);
void createHeaterComponents(); void createHeaterComponents();
void createSolarArrayDeploymentComponents(); void createSolarArrayDeploymentComponents();
void createSyrlinksComponents(); void createSyrlinksComponents();
void createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF); void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF); void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
void createTestComponents(LinuxLibgpioIF* gpioComIF); void createTestComponents(LinuxLibgpioIF* gpioComIF);
void testAcsBrdAss(AcsBoardAssembly* assAss);
}; // namespace ObjectFactory }; // namespace ObjectFactory
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */ #endif /* BSP_Q7S_OBJECTFACTORY_H_ */

View File

@ -1,6 +1,11 @@
add_subdirectory(csp) add_subdirectory(csp)
add_subdirectory(utility) add_subdirectory(utility)
add_subdirectory(callbacks)
add_subdirectory(boardtest) add_subdirectory(boardtest)
add_subdirectory(devices) add_subdirectory(devices)
add_subdirectory(fsfwconfig) add_subdirectory(fsfwconfig)
add_subdirectory(obc) add_subdirectory(obc)
target_sources(${OBSW_NAME} PUBLIC
ObjectFactory.cpp
)

286
linux/ObjectFactory.cpp Normal file
View File

@ -0,0 +1,286 @@
#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>
#include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/SusHandler.h>
#include <mission/system/RtdFdir.h>
#include <mission/system/SusAssembly.h>
#include <mission/system/SusFdir.h>
#include <mission/system/TcsBoardAssembly.h>
#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);
gpioComIF->addGpios(gpioCookieSus);
#if OBSW_ADD_SUN_SENSORS == 1
SusFdir* fdir = nullptr;
std::array<SusHandler*, 12> susHandlers = {};
SpiCookie* spiCookie =
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[0] = new SusHandler(objects::SUS_0, 0, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_0);
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
susHandlers[0]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[1] = new SusHandler(objects::SUS_1, 1, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_1);
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
susHandlers[1]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[2] = new SusHandler(objects::SUS_2, 2, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_2);
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
susHandlers[2]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[3] = new SusHandler(objects::SUS_3, 3, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_3);
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
susHandlers[3]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[4] = new SusHandler(objects::SUS_4, 4, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_4);
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
susHandlers[4]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[5] = new SusHandler(objects::SUS_5, 5, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_5);
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
susHandlers[5]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[6] = new SusHandler(objects::SUS_6, 6, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_6);
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
susHandlers[6]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[7] = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_7);
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
susHandlers[7]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[8] = new SusHandler(objects::SUS_8, 8, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_8);
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
susHandlers[8]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[9] = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_9);
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
susHandlers[9]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[10] = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_10);
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
susHandlers[10]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[11] = new SusHandler(objects::SUS_11, 11, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_11);
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
}
}
std::array<object_id_t, 12> susIds = {objects::SUS_0, objects::SUS_1, objects::SUS_2,
objects::SUS_3, objects::SUS_4, objects::SUS_5,
objects::SUS_6, objects::SUS_7, objects::SUS_8,
objects::SUS_9, objects::SUS_10, objects::SUS_11};
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 */
}
void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
PowerSwitchIF* pwrSwitcher) {
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);
gpioComIF->addGpios(rtdGpioCookie);
#if OBSW_ADD_RTD_DEVICES == 1
static constexpr uint8_t NUMBER_RTDS = 16;
std::array<std::pair<address_t, gpioId_t>, NUMBER_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},
{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},
}};
std::array<object_id_t, NUMBER_RTDS> rtdIds = {
objects::RTD_IC_3, objects::RTD_IC_4, objects::RTD_IC_5, objects::RTD_IC_6,
objects::RTD_IC_7, objects::RTD_IC_8, objects::RTD_IC_9, objects::RTD_IC_10,
objects::RTD_IC_11, objects::RTD_IC_12, objects::RTD_IC_13, objects::RTD_IC_14,
objects::RTD_IC_15, objects::RTD_IC_16, objects::RTD_IC_17, objects::RTD_IC_18};
std::array<SpiCookie*, NUMBER_RTDS> rtdCookies = {};
std::array<Max31865PT1000Handler*, NUMBER_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
rtdCookies[idx] =
new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second, spiDev,
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
rtds[idx] = new Max31865PT1000Handler(rtdIds[idx], objects::SPI_COM_IF, rtdCookies[idx]);
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
rtdFdir = new RtdFdir(rtdIds[idx]);
rtds[idx]->setCustomFdir(rtdFdir);
rtds[idx]->setDeviceIdx(idx + 3);
}
#if OBSW_TEST_RTD == 1
for (auto& rtd : rtds) {
if (rtd != nullptr) {
rtd->setStartUpImmediately();
rtd->setInstantNormal(true);
}
}
#endif // OBSW_TEST_RTD == 1
TcsBoardHelper helper(rtdIds);
TcsBoardAssembly* tcsBoardAss =
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
pcduSwitches::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
static_cast<void>(tcsBoardAss);
#endif // OBSW_ADD_RTD_DEVICES == 1
}

15
linux/ObjectFactory.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <string>
class GpioIF;
class SpiComIF;
class PowerSwitchIF;
namespace ObjectFactory {
void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher,
std::string spiDev);
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
} // namespace ObjectFactory

View File

@ -3,9 +3,14 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#if defined(XIPHOS_Q7S) #ifdef XIPHOS_Q7S
#include "busConf.h" #include "busConf.h"
#endif #endif
#ifdef RASPBERRY_PI
#include <bsp_linux_board/definitions.h>
#endif
#include <fsfw_hal/common/gpio/GpioIF.h> #include <fsfw_hal/common/gpio/GpioIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h> #include <fsfw_hal/linux/spi/SpiCookie.h>
#include <test/testtasks/TestTask.h> #include <test/testtasks/TestTask.h>

View File

@ -0,0 +1,3 @@
target_sources(${OBSW_NAME} PRIVATE
gpioCallbacks.cpp
)

View File

@ -0,0 +1,431 @@
#include "gpioCallbacks.h"
#include "devices/gpioIds.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/common/gpio/GpioIF.h"
void gpioCallbacks::spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp,
gpio::Levels value, void* args) {
GpioIF* gpioIF = reinterpret_cast<GpioIF*>(args);
if (gpioIF == nullptr) {
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl;
return;
}
/* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) {
return;
}
if (value == gpio::Levels::HIGH) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_4): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_5): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_6): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_7): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_8): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_9): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_10): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_11): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_12): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_13): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_14): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_15): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_16): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_17): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_18): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_0): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_1): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_2): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_3): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_4): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_5): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_6): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_7): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_8): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_9): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_10): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_11): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_RW1): {
disableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW2): {
disableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW3): {
disableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW4): {
disableRwDecoder(gpioIF);
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else if (value == gpio::Levels::LOW) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
selectY7(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_4): {
selectY6(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_5): {
selectY5(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_6): {
selectY4(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_7): {
selectY3(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_8): {
selectY2(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_9): {
selectY1(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_10): {
selectY0(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_11): {
selectY7(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_12): {
selectY6(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_13): {
selectY5(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_14): {
selectY4(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_15): {
selectY3(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_16): {
selectY2(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_17): {
selectY1(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_18): {
selectY0(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_0): {
selectY0(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_1): {
selectY1(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_2): {
selectY2(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_3): {
selectY3(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_4): {
selectY4(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_5): {
selectY5(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_6): {
selectY0(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_7): {
selectY1(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_8): {
selectY2(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_9): {
selectY3(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_10): {
selectY4(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_11): {
selectY5(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_RW1): {
selectY0(gpioIF);
enableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW2): {
selectY1(gpioIF);
enableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW3): {
selectY2(gpioIF);
enableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW4): {
selectY3(gpioIF);
enableRwDecoder(gpioIF);
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else {
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
}
}
void gpioCallbacks::enableDecoderTcsIc1(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::enableDecoderTcsIc2(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void gpioCallbacks::enableDecoderInterfaceBoardIc1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::enableDecoderInterfaceBoardIc2(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::disableDecoderTcsIc1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::disableDecoderTcsIc2(GpioIF* gpioIF) {
// DO NOT CHANGE THE ORDER HERE
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void gpioCallbacks::disableDecoderInterfaceBoardIc1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::disableDecoderInterfaceBoardIc2(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::enableRwDecoder(GpioIF* gpioIF) { gpioIF->pullHigh(gpioIds::EN_RW_CS); }
void gpioCallbacks::disableRwDecoder(GpioIF* gpioIF) { gpioIF->pullLow(gpioIds::EN_RW_CS); }
void gpioCallbacks::selectY0(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY2(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY3(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY4(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY5(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY6(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY7(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::disableAllDecoder(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::EN_RW_CS);
}

View File

@ -1,16 +1,10 @@
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_ #pragma once
#define LINUX_GPIO_GPIOCALLBACKS_H_
#include <fsfw_hal/common/gpio/GpioIF.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h> #include <fsfw_hal/common/gpio/gpioDefinitions.h>
namespace gpioCallbacks { class GpioIF;
/** namespace gpioCallbacks {
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
/** /**
* @brief This function implements the decoding to multiply gpios by using the decoder * @brief This function implements the decoding to multiply gpios by using the decoder
@ -23,51 +17,50 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder * @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the TCS board which is named to IC1 in the schematic. * on the TCS board which is named to IC1 in the schematic.
*/ */
void enableDecoderTcsIc1(); void enableDecoderTcsIc1(GpioIF* gpioIF);
/** /**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder * @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the TCS board which is named to IC2 in the schematic. * on the TCS board which is named to IC2 in the schematic.
*/ */
void enableDecoderTcsIc2(); void enableDecoderTcsIc2(GpioIF* gpioIF);
/** /**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder * @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC21 in the schematic. * on the inteface board board which is named to IC21 in the schematic.
*/ */
void enableDecoderInterfaceBoardIc1(); void enableDecoderInterfaceBoardIc1(GpioIF* gpioIF);
/** /**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder * @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC22 in the schematic. * on the inteface board board which is named to IC22 in the schematic.
*/ */
void enableDecoderInterfaceBoardIc2(); void enableDecoderInterfaceBoardIc2(GpioIF* gpioIF);
void disableDecoderTcsIc1(); void disableDecoderTcsIc1(GpioIF* gpioIF);
void disableDecoderTcsIc2(); void disableDecoderTcsIc2(GpioIF* gpioIF);
void disableDecoderInterfaceBoardIc1(); void disableDecoderInterfaceBoardIc1(GpioIF* gpioIF);
void disableDecoderInterfaceBoardIc2(); void disableDecoderInterfaceBoardIc2(GpioIF* gpioIF);
/** /**
* @brief Enables the reaction wheel chip select decoder (IC3). * @brief Enables the reaction wheel chip select decoder (IC3).
*/ */
void enableRwDecoder(); void enableRwDecoder(GpioIF* gpioIF);
void disableRwDecoder(); void disableRwDecoder(GpioIF* gpioIF);
/** /**
* @brief This function disables all decoder. * @brief This function disables all decoder.
*/ */
void disableAllDecoder(); void disableAllDecoder(GpioIF* gpioIF);
/** The following functions enable the appropriate channel of the currently enabled decoder */ /** The following functions enable the appropriate channel of the currently enabled decoder */
void selectY0(); void selectY0(GpioIF* gpioIF);
void selectY1(); void selectY1(GpioIF* gpioIF);
void selectY2(); void selectY2(GpioIF* gpioIF);
void selectY3(); void selectY3(GpioIF* gpioIF);
void selectY4(); void selectY4(GpioIF* gpioIF);
void selectY5(); void selectY5(GpioIF* gpioIF);
void selectY6(); void selectY6(GpioIF* gpioIF);
void selectY7(); void selectY7(GpioIF* gpioIF);
} // namespace gpioCallbacks
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */ } // namespace gpioCallbacks

View File

@ -1541,6 +1541,6 @@ class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
lp_var_t<uint32_t> isSet = lp_var_t<uint32_t> isSet =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this); lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this);
}; };
} // namespace PLOC_SPV } // namespace supv
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */

View File

@ -1,9 +1,9 @@
#include "PlocMPSoCHandler.h" #include "PlocMPSoCHandler.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper, CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
@ -87,8 +87,8 @@ void PlocMPSoCHandler::performOperationHook() {
} }
} }
CommandMessage message; CommandMessage message;
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == RETURN_OK; for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
result = commandActionHelperQueue->receiveMessage(&message)) { result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) {
result = commandActionHelper.handleReply(&message); result = commandActionHelper.handleReply(&message);
if (result == RETURN_OK) { if (result == RETURN_OK) {
continue; continue;
@ -133,31 +133,31 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
} }
void PlocMPSoCHandler::doStartUp() { void PlocMPSoCHandler::doStartUp() {
switch(powerState) { switch (powerState) {
case PowerState::OFF: case PowerState::OFF:
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
powerState = PowerState::BOOTING; powerState = PowerState::BOOTING;
break; break;
case PowerState::ON: case PowerState::ON:
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh(); uartIsolatorSwitch.pullHigh();
break; break;
default: default:
break; break;
} }
} }
void PlocMPSoCHandler::doShutDown() { void PlocMPSoCHandler::doShutDown() {
switch(powerState) { switch (powerState) {
case PowerState::ON: case PowerState::ON:
uartIsolatorSwitch.pullLow(); uartIsolatorSwitch.pullLow();
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC); commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
powerState = PowerState::SHUTDOWN; powerState = PowerState::SHUTDOWN;
break; break;
case PowerState::OFF: case PowerState::OFF:
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
break; break;
default: default:
break; break;
} }
} }
@ -703,64 +703,57 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
return replyLen; return replyLen;
} }
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
return commandActionHelperQueue;
}
void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { return; }
return;
}
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step, void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
ReturnValue_t returnCode) { ReturnValue_t returnCode) {
switch (actionId) { switch (actionId) {
case supv::START_MPSOC: case supv::START_MPSOC:
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl;
<< std::endl; powerState = PowerState::OFF;
powerState = PowerState::OFF; break;
break; case supv::SHUTDOWN_MPSOC:
case supv::SHUTDOWN_MPSOC: triggerEvent(MPSOC_SHUTDOWN_FAILED);
triggerEvent(MPSOC_SHUTDOWN_FAILED); sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl;
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" // TODO: Setting state to on or off here?
<< std::endl; powerState = PowerState::ON;
// TODO: Setting state to on or off here? break;
powerState = PowerState::ON; default:
break; sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
default: << std::endl;
sif::debug break;
<< "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply" }
<< std::endl;
break;
}
} }
void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
return; return;
} }
void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) { void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) {
if (actionId != supv::EXE_REPORT) { if (actionId != supv::EXE_REPORT) {
sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action " sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action "
<< "ID" << std::endl; << "ID" << std::endl;
return; return;
} }
switch(powerState) { switch (powerState) {
case PowerState::BOOTING: { case PowerState::BOOTING: {
powerState = PowerState::ON; powerState = PowerState::ON;
break; break;
} }
case PowerState::SHUTDOWN: { case PowerState::SHUTDOWN: {
powerState = PowerState::OFF; powerState = PowerState::OFF;
break; break;
} }
default: { default: {
break; break;
} }
} }
} }
void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) { void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
handleActionCommandFailure(actionId); handleActionCommandFailure(actionId);
} }
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
@ -862,27 +855,27 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
switch (actionId) { switch (actionId) {
case supv::ACK_REPORT: case supv::ACK_REPORT:
case supv::EXE_REPORT: case supv::EXE_REPORT:
break; break;
default: default:
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID " sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID "
<< std::endl; << std::endl;
return; return;
} }
switch(powerState) { switch (powerState) {
case PowerState::BOOTING: { case PowerState::BOOTING: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC" sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
<< std::endl; << std::endl;
powerState = PowerState::OFF; powerState = PowerState::OFF;
break; break;
} }
case PowerState::SHUTDOWN: { case PowerState::SHUTDOWN: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC" sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
<< std::endl; << std::endl;
powerState = PowerState::ON; powerState = PowerState::ON;
break; break;
} }
default: default:
break; break;
} }
return; return;
} }

View File

@ -384,7 +384,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches, ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches,
uint8_t* numberOfSwitches) { uint8_t* numberOfSwitches) {
if (powerSwitch == power::NO_SWITCH) { if (powerSwitch == power::NO_SWITCH) {
return DeviceHandlerBase::NO_SWITCH; return DeviceHandlerBase::NO_SWITCH;
} }
*numberOfSwitches = 1; *numberOfSwitches = 1;
*switches = &powerSwitch; *switches = &powerSwitch;
@ -489,8 +489,8 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
switch (command->first) { switch (command->first) {
case supv::GET_HK_REPORT: { case supv::GET_HK_REPORT: {
enabledReplies = 3; enabledReplies = 3;
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, result =
supv::HK_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::HK_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
<< supv::HK_REPORT << " not in replyMap" << std::endl; << supv::HK_REPORT << " not in replyMap" << std::endl;
@ -589,15 +589,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
result = result =
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::ACK_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::ACK_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::ACK_REPORT
<< supv::ACK_REPORT << " not in replyMap" << std::endl; << " not in replyMap" << std::endl;
} }
result = result =
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::EXE_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::EXE_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::EXE_REPORT
<< supv::EXE_REPORT << " not in replyMap" << std::endl; << " not in replyMap" << std::endl;
} }
return RETURN_OK; return RETURN_OK;
@ -1013,7 +1013,7 @@ void PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) {
void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) { void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) {
supv::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2), supv::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2),
*(commandData + 3)); *(commandData + 3));
packetToOutBuffer(packet.getWholeData(), packet.getFullSize()); packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
} }
@ -1459,9 +1459,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
return MRAM_FILE_NOT_EXISTS; return MRAM_FILE_NOT_EXISTS;
} }
std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out); std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out);
file.write( file.write(reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH),
reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), packetLen - 1);
packetLen - 1);
file.close(); file.close();
return RETURN_OK; return RETURN_OK;
} }

View File

@ -262,12 +262,11 @@ void PlocUpdater::commandUpdateAvailable() {
calcImageCrc(); calcImageCrc();
supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image), supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
numOfUpdatePackets);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, result =
supv::UPDATE_AVAILABLE, packet.getWholeData(), commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_AVAILABLE,
packet.getFullSize()); packet.getWholeData(), packet.getFullSize());
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available" sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
<< " packet to supervisor handler" << std::endl; << " packet to supervisor handler" << std::endl;
@ -311,9 +310,9 @@ void PlocUpdater::commandUpdatePacket() {
} }
packet.makeCrc(); packet.makeCrc();
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, result =
supv::UPDATE_IMAGE_DATA, packet.getWholeData(), commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_IMAGE_DATA,
packet.getFullSize()); packet.getWholeData(), packet.getFullSize());
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update" sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
@ -335,12 +334,10 @@ void PlocUpdater::commandUpdateVerify() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast<uint8_t>(image), supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
numOfUpdatePackets);
result = result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY,
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());
packet.getWholeData(), packet.getFullSize());
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available" sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
<< " packet to supervisor handler" << std::endl; << " packet to supervisor handler" << std::endl;

View File

@ -7,12 +7,12 @@
#include "ArcsecJsonParamBase.h" #include "ArcsecJsonParamBase.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "StrHelper.h" #include "StrHelper.h"
#include "devices/powerSwitcherList.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/src/fsfw/serialize/SerializeAdapter.h" #include "fsfw/src/fsfw/serialize/SerializeAdapter.h"
#include "fsfw/timemanager/Countdown.h" #include "fsfw/timemanager/Countdown.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" #include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "thirdparty/arcsec_star_tracker/common/SLIP.h" #include "thirdparty/arcsec_star_tracker/common/SLIP.h"
#include "devices/powerSwitcherList.h"
/** /**
* @brief This is the device handler for the star tracker from arcsec. * @brief This is the device handler for the star tracker from arcsec.

View File

@ -44,6 +44,7 @@ debugging. */
#define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_PLOC_MPSOC 0
#define OBSW_ADD_SUN_SENSORS 1 #define OBSW_ADD_SUN_SENSORS 1
#define OBSW_ADD_SUS_BOARD_ASS 1
#define OBSW_ADD_ACS_BOARD 1 #define OBSW_ADD_ACS_BOARD 1
#define OBSW_ADD_ACS_HANDLERS 1 #define OBSW_ADD_ACS_HANDLERS 1
#define OBSW_ADD_RW 0 #define OBSW_ADD_RW 0
@ -115,7 +116,6 @@ debugging. */
#define OBSW_ADD_UART_TEST_CODE 0 #define OBSW_ADD_UART_TEST_CODE 0
#define OBSW_TEST_ACS 0 #define OBSW_TEST_ACS 0
#define OBSW_TEST_ACS_BOARD_ASS 0
#define OBSW_DEBUG_ACS 0 #define OBSW_DEBUG_ACS 0
#define OBSW_TEST_SUS 0 #define OBSW_TEST_SUS 0
#define OBSW_DEBUG_SUS 0 #define OBSW_DEBUG_SUS 0
@ -170,6 +170,7 @@ debugging. */
#define OBSW_ADD_SUN_SENSORS 0 #define OBSW_ADD_SUN_SENSORS 0
#define OBSW_ADD_MGT 0 #define OBSW_ADD_MGT 0
#define OBSW_ADD_ACS_BOARD 0 #define OBSW_ADD_ACS_BOARD 0
#define OBSW_ADD_ACS_HANDLERS 0
#define OBSW_ADD_GPS_0 0 #define OBSW_ADD_GPS_0 0
#define OBSW_ADD_GPS_1 0 #define OBSW_ADD_GPS_1 0
#define OBSW_ADD_RW 0 #define OBSW_ADD_RW 0

View File

@ -339,9 +339,7 @@ gpioId_t HeaterHandler::getGpioIdFromSwitchNr(int switchNr) {
MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); }
ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; }
return RETURN_OK;
}
ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return 0; } ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return 0; }

View File

@ -350,9 +350,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO
return result; return result;
} }
ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; }
return RETURN_OK;
}
ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
if (switchNr >= pcduSwitches::NUMBER_OF_SWITCHES) { if (switchNr >= pcduSwitches::NUMBER_OF_SWITCHES) {

View File

@ -92,15 +92,15 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
return RETURN_OK; return RETURN_OK;
} }
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: { case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: {
printPeriodicData = true; printPeriodicData = true;
rawPacketLen = 0; rawPacketLen = 0;
return RETURN_OK; return RETURN_OK;
} }
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: { case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: {
rawPacketLen = 0; rawPacketLen = 0;
printPeriodicData = false; printPeriodicData = false;
return RETURN_OK; return RETURN_OK;
} }
default: default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
} }
@ -123,7 +123,7 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
switch (*foundId) { switch (*foundId) {
case RAD_SENSOR::START_CONVERSION: case RAD_SENSOR::START_CONVERSION:
case RAD_SENSOR::WRITE_SETUP: case RAD_SENSOR::WRITE_SETUP:
*foundLen = remainingSize; *foundLen = remainingSize;
return IGNORE_REPLY_DATA; return IGNORE_REPLY_DATA;
case RAD_SENSOR::READ_CONVERSIONS: { case RAD_SENSOR::READ_CONVERSIONS: {
ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET); ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET);
@ -138,8 +138,8 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
} }
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: case RAD_SENSOR::ENABLE_DEBUG_OUTPUT:
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: case RAD_SENSOR::DISABLE_DEBUG_OUTPUT:
sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl; sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl;
break; break;
default: default:
break; break;
} }

View File

@ -32,7 +32,10 @@ void SusHandler::doStartUp() {
} }
} }
void SusHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } void SusHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
comState = ComStates::IDLE;
}
ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
switch (comState) { switch (comState) {
@ -191,7 +194,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 2000; } uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 3000; }
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {

View File

@ -142,12 +142,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A); cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A);
cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A); cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A);
if (gpsUsable) { if (gpsUsable) {
if (gpioIF->pullLow(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { gpioHandler(gpioIds::GNSS_0_NRESET, true,
#if OBSW_VERBOSE_LEVEL >= 1 "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low" "of GNSS 0 high (used GNSS)");
<< std::endl; gpioHandler(gpioIds::GNSS_1_NRESET, false,
#endif "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
} "of GNSS 1 low (unused GNSS)");
gpioHandler(gpioIds::GNSS_SELECT, false,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low");
} }
break; break;
} }
@ -165,12 +167,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B); cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B);
cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B);
if (gpsUsable) { if (gpsUsable) {
if (gpioIF->pullHigh(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { gpioHandler(gpioIds::GNSS_0_NRESET, false,
#if OBSW_VERBOSE_LEVEL >= 1 "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high" "of GNSS 0 low (unused GNSS)");
<< std::endl; gpioHandler(gpioIds::GNSS_1_NRESET, true,
#endif "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
} "of GNSS 1 high (used GNSS)");
gpioHandler(gpioIds::GNSS_SELECT, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high");
} }
break; break;
} }
@ -186,6 +190,12 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B);
ReturnValue_t status = RETURN_OK; ReturnValue_t status = RETURN_OK;
if (gpsUsable) { if (gpsUsable) {
gpioHandler(gpioIds::GNSS_0_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 0 high (used GNSS)");
gpioHandler(gpioIds::GNSS_1_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 1 high (used GNSS)");
if (defaultSubmode == Submodes::A_SIDE) { if (defaultSubmode == Submodes::A_SIDE) {
status = gpioIF->pullLow(gpioIds::GNSS_SELECT); status = gpioIF->pullLow(gpioIds::GNSS_SELECT);
} else { } else {
@ -233,6 +243,20 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) {
} }
} }
void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) {
ReturnValue_t result = RETURN_OK;
if (high) {
result = gpioIF->pullHigh(gpio);
} else {
result = gpioIF->pullLow(gpio);
}
if (result != HasReturnvaluesIF::RETURN_OK) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::error << error << std::endl;
#endif
}
}
void AcsBoardAssembly::refreshHelperModes() { void AcsBoardAssembly::refreshHelperModes() {
try { try {
helper.gyro0SideAMode = childrenMap.at(helper.gyro0AdisIdSideA).mode; helper.gyro0SideAMode = childrenMap.at(helper.gyro0AdisIdSideA).mode;

View File

@ -4,6 +4,7 @@
#include <common/config/commonSubsystemIds.h> #include <common/config/commonSubsystemIds.h>
#include <devices/powerSwitcherList.h> #include <devices/powerSwitcherList.h>
#include <fsfw/objectmanager/frameworkObjects.h> #include <fsfw/objectmanager/frameworkObjects.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include "DualLaneAssemblyBase.h" #include "DualLaneAssemblyBase.h"
#include "DualLanePowerStateMachine.h" #include "DualLanePowerStateMachine.h"
@ -115,6 +116,7 @@ class AcsBoardAssembly : public DualLaneAssemblyBase {
GpioIF* gpioIF = nullptr; GpioIF* gpioIF = nullptr;
FixedArrayList<ModeListEntry, NUMBER_DEVICES_MODE_TABLE> modeTable; FixedArrayList<ModeListEntry, NUMBER_DEVICES_MODE_TABLE> modeTable;
void gpioHandler(gpioId_t gpio, bool high, std::string error);
ReturnValue_t initialize() override; ReturnValue_t initialize() override;

View File

@ -50,6 +50,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
* @return * @return
*/ */
bool isUseable(object_id_t object, Mode_t mode); bool isUseable(object_id_t object, Mode_t mode);
/** /**
* Thin wrapper function which is required because the helper class * Thin wrapper function which is required because the helper class
* can not access protected member functions. * can not access protected member functions.