added SUS component creation to RPi
This commit is contained in:
parent
7612564a8f
commit
2410c6ccc6
@ -9,6 +9,7 @@
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||
#include "linux/ObjectFactory.h"
|
||||
#include "linux/boardtest/LibgpiodTest.h"
|
||||
#include "linux/boardtest/SpiTestClass.h"
|
||||
#include "linux/boardtest/UartTestClass.h"
|
||||
@ -63,38 +64,44 @@ void ObjectFactory::produce(void* args) {
|
||||
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||
GpioCookie* gpioCookie = nullptr;
|
||||
static_cast<void>(gpioCookie);
|
||||
|
||||
new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
||||
|
||||
std::string spiDev;
|
||||
SpiCookie* spiCookie = nullptr;
|
||||
static_cast<void>(spiCookie);
|
||||
std::string spiDev = "/dev/spidev0.1";
|
||||
SpiComIF* spiComIF = new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
||||
static_cast<void>(spiComIF);
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
if (gpioCookie == nullptr) {
|
||||
gpioCookie = new GpioCookie();
|
||||
}
|
||||
createRpiAcsBoard(gpioIF, spiDev);
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_SUN_SENSORS == 1
|
||||
createSunSensorComponents(gpioIF, spiComIF, nullptr, spiDev);
|
||||
#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
|
||||
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,
|
||||
"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::Direction::OUT, 1);
|
||||
gpio::Direction::OUT, gpio::Levels::HIGH);
|
||||
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,
|
||||
"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::Direction::OUT, 1);
|
||||
gpio::Direction::OUT, gpio::Levels::HIGH);
|
||||
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::Direction::OUT, 1);
|
||||
gpio::Direction::OUT, gpio::Levels::HIGH);
|
||||
gpioIF->addGpios(gpioCookie);
|
||||
|
||||
spiDev = "/dev/spidev0.1";
|
||||
spiCookie =
|
||||
SpiCookie* spiCookie =
|
||||
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||
auto mgmLis3Handler =
|
||||
@ -136,9 +143,9 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
spiCookie =
|
||||
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
auto adisHandler =
|
||||
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
||||
adisHandler->setStartUpImmediately();
|
||||
spiCookie =
|
||||
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||
@ -152,9 +159,9 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
spiCookie =
|
||||
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
adisHandler =
|
||||
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
||||
adisHandler->setStartUpImmediately();
|
||||
|
||||
spiCookie =
|
||||
@ -166,12 +173,6 @@ void ObjectFactory::produce(void* args) {
|
||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||
gyroL3gHandler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
createTestTasks();
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
}
|
||||
|
||||
void ObjectFactory::createTestTasks() {
|
||||
|
@ -1,10 +1,15 @@
|
||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class GpioIF;
|
||||
|
||||
namespace ObjectFactory {
|
||||
void setStatics();
|
||||
void produce(void* args);
|
||||
|
||||
void createRpiAcsBoard(GpioIF* gpioIF, std::string spiDev);
|
||||
void createTestTasks();
|
||||
}; // namespace ObjectFactory
|
||||
|
||||
|
@ -2,5 +2,5 @@ target_sources(${OBSW_NAME} PRIVATE
|
||||
rwSpiCallback.cpp
|
||||
gnssCallback.cpp
|
||||
pcduSwitchCb.cpp
|
||||
gpioCallbacks.cpp
|
||||
q7sGpioCallbacks.cpp
|
||||
)
|
||||
|
@ -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
|
54
bsp_q7s/callbacks/q7sGpioCallbacks.cpp
Normal file
54
bsp_q7s/callbacks/q7sGpioCallbacks.cpp
Normal 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;
|
||||
}
|
||||
}
|
15
bsp_q7s/callbacks/q7sGpioCallbacks.h
Normal file
15
bsp_q7s/callbacks/q7sGpioCallbacks.h
Normal 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
|
@ -1,22 +1,10 @@
|
||||
#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 "bsp_q7s/boardtest/Q7STestTask.h"
|
||||
#include "bsp_q7s/callbacks/gnssCallback.h"
|
||||
#include "bsp_q7s/callbacks/gpioCallbacks.h"
|
||||
#include "bsp_q7s/callbacks/pcduSwitchCb.h"
|
||||
#include "bsp_q7s/callbacks/q7sGpioCallbacks.h"
|
||||
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
||||
#include "bsp_q7s/core/CoreController.h"
|
||||
#include "bsp_q7s/devices/PlocMemoryDumper.h"
|
||||
@ -29,15 +17,28 @@
|
||||
#include "devices/addresses.h"
|
||||
#include "devices/gpioIds.h"
|
||||
#include "devices/powerSwitcherList.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "linux/ObjectFactory.h"
|
||||
#include "linux/boardtest/I2cTestClass.h"
|
||||
#include "linux/boardtest/SpiTestClass.h"
|
||||
#include "linux/boardtest/UartTestClass.h"
|
||||
#include "linux/callbacks/gpioCallbacks.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
#include "linux/devices/startracker/StarTrackerHandler.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/pusIds.h"
|
||||
|
||||
@ -137,10 +138,10 @@ void ObjectFactory::produce(void* args) {
|
||||
#if BOARD_TE0720 == 0
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
|
||||
gpioCallbacks::disableAllDecoder();
|
||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||
createPcduComponents(gpioComIF, &pwrSwitcher);
|
||||
createRadSensorComponent(gpioComIF);
|
||||
createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher);
|
||||
createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
||||
@ -264,7 +265,7 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
||||
q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -326,161 +327,6 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
||||
#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,
|
||||
PowerSwitchIF* pwrSwitcher) {
|
||||
using namespace gpio;
|
||||
|
@ -18,8 +18,6 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
|
||||
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
||||
void createTmpComponents();
|
||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||
PowerSwitchIF* pwrSwitcher);
|
||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
||||
PowerSwitchIF* pwrSwitcher);
|
||||
void createHeaterComponents();
|
||||
|
@ -1,6 +1,11 @@
|
||||
add_subdirectory(csp)
|
||||
add_subdirectory(utility)
|
||||
add_subdirectory(callbacks)
|
||||
add_subdirectory(boardtest)
|
||||
add_subdirectory(devices)
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(obc)
|
||||
|
||||
target_sources(${OBSW_NAME} PUBLIC
|
||||
ObjectFactory.cpp
|
||||
)
|
172
linux/ObjectFactory.cpp
Normal file
172
linux/ObjectFactory.cpp
Normal file
@ -0,0 +1,172 @@
|
||||
#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/SusHandler.h>
|
||||
#include <mission/system/SusAssembly.h>
|
||||
#include <mission/system/SusFdir.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 */
|
||||
}
|
14
linux/ObjectFactory.h
Normal file
14
linux/ObjectFactory.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class GpioIF;
|
||||
class SpiComIF;
|
||||
class PowerSwitchIF;
|
||||
|
||||
namespace ObjectFactory {
|
||||
|
||||
void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher,
|
||||
std::string spiDev);
|
||||
|
||||
}
|
3
linux/callbacks/CMakeLists.txt
Normal file
3
linux/callbacks/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
target_sources(${OBSW_NAME} PRIVATE
|
||||
gpioCallbacks.cpp
|
||||
)
|
431
linux/callbacks/gpioCallbacks.cpp
Normal file
431
linux/callbacks/gpioCallbacks.cpp
Normal 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);
|
||||
}
|
@ -1,16 +1,10 @@
|
||||
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
||||
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
||||
#pragma once
|
||||
|
||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||
|
||||
namespace gpioCallbacks {
|
||||
class GpioIF;
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
|
||||
/**
|
||||
* @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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* on the inteface board board which is named to IC22 in the schematic.
|
||||
*/
|
||||
void enableDecoderInterfaceBoardIc2();
|
||||
void enableDecoderInterfaceBoardIc2(GpioIF* gpioIF);
|
||||
|
||||
void disableDecoderTcsIc1();
|
||||
void disableDecoderTcsIc2();
|
||||
void disableDecoderInterfaceBoardIc1();
|
||||
void disableDecoderInterfaceBoardIc2();
|
||||
void disableDecoderTcsIc1(GpioIF* gpioIF);
|
||||
void disableDecoderTcsIc2(GpioIF* gpioIF);
|
||||
void disableDecoderInterfaceBoardIc1(GpioIF* gpioIF);
|
||||
void disableDecoderInterfaceBoardIc2(GpioIF* gpioIF);
|
||||
|
||||
/**
|
||||
* @brief Enables the reaction wheel chip select decoder (IC3).
|
||||
*/
|
||||
void enableRwDecoder();
|
||||
void disableRwDecoder();
|
||||
void enableRwDecoder(GpioIF* gpioIF);
|
||||
void disableRwDecoder(GpioIF* gpioIF);
|
||||
|
||||
/**
|
||||
* @brief This function disables all decoder.
|
||||
*/
|
||||
void disableAllDecoder();
|
||||
void disableAllDecoder(GpioIF* gpioIF);
|
||||
|
||||
/** The following functions enable the appropriate channel of the currently enabled decoder */
|
||||
void selectY0();
|
||||
void selectY1();
|
||||
void selectY2();
|
||||
void selectY3();
|
||||
void selectY4();
|
||||
void selectY5();
|
||||
void selectY6();
|
||||
void selectY7();
|
||||
} // namespace gpioCallbacks
|
||||
void selectY0(GpioIF* gpioIF);
|
||||
void selectY1(GpioIF* gpioIF);
|
||||
void selectY2(GpioIF* gpioIF);
|
||||
void selectY3(GpioIF* gpioIF);
|
||||
void selectY4(GpioIF* gpioIF);
|
||||
void selectY5(GpioIF* gpioIF);
|
||||
void selectY6(GpioIF* gpioIF);
|
||||
void selectY7(GpioIF* gpioIF);
|
||||
|
||||
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
||||
} // namespace gpioCallbacks
|
@ -127,6 +127,7 @@ debugging. */
|
||||
#define OBSW_ADD_SUN_SENSORS 0
|
||||
#define OBSW_ADD_MGT 0
|
||||
#define OBSW_ADD_ACS_BOARD 0
|
||||
#define OBSW_ADD_ACS_HANDLERS 0
|
||||
#define OBSW_ADD_GPS_0 0
|
||||
#define OBSW_ADD_GPS_1 0
|
||||
#define OBSW_ADD_RW 0
|
||||
|
Loading…
Reference in New Issue
Block a user