PL PCDU Preparation + Update for new Devicetree #153

Merged
meierj merged 3 commits from mueller/pl-pcdu-prep into develop 2022-02-25 11:12:10 +01:00
20 changed files with 1096 additions and 576 deletions

View File

@ -16,6 +16,7 @@ set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(EIVE_BUILD_UNITTESTS "Build Catch2 unittests" OFF) option(EIVE_BUILD_UNITTESTS "Build Catch2 unittests" OFF)
option(EIVE_ADD_ETL_LIB "Add ETL library" ON) option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON) option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF) option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON) option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)

View File

@ -11,19 +11,15 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE") target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
add_subdirectory(simple) add_subdirectory(simple)
target_sources(${OBSW_NAME} PUBLIC target_sources(${OBSW_NAME} PUBLIC
main.cpp main.cpp
) )
add_subdirectory(boardtest) add_subdirectory(boardtest)
add_subdirectory(boardconfig) add_subdirectory(boardconfig)
add_subdirectory(comIF) add_subdirectory(comIF)
add_subdirectory(gpio)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(memory) add_subdirectory(memory)
add_subdirectory(callbacks) add_subdirectory(callbacks)
add_subdirectory(devices) add_subdirectory(devices)

View File

@ -29,6 +29,7 @@ static const int PTME_CONFIG = 4;
} // namespace uiomapids } // namespace uiomapids
namespace gpioNames { namespace gpioNames {
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select"; static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select"; static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select"; static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select";
@ -44,6 +45,8 @@ static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0"; static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2"; static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
static constexpr char GNSS_SELECT[] = "gnss_mux_select"; static constexpr char GNSS_SELECT[] = "gnss_mux_select";
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
static constexpr char HEATER_0[] = "heater0"; static constexpr char HEATER_0[] = "heater0";
static constexpr char HEATER_1[] = "heater1"; static constexpr char HEATER_1[] = "heater1";
static constexpr char HEATER_2[] = "heater2"; static constexpr char HEATER_2[] = "heater2";
@ -54,18 +57,18 @@ static constexpr char HEATER_6[] = "heater6";
static constexpr char HEATER_7[] = "heater7"; static constexpr char HEATER_7[] = "heater7";
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0"; static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1"; static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_0";
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1"; static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2"; static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3"; static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4"; static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5"; static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
static constexpr char SPI_MUX_BIT_6_PIN[] = "spi_mux_bit_6";
static constexpr char EN_RW_CS[] = "en_rw_cs"; static constexpr char EN_RW_CS[] = "en_rw_cs";
static constexpr char EN_RW_1[] = "enable_rw_1"; static constexpr char EN_RW_1[] = "enable_rw_1";
static constexpr char EN_RW_2[] = "enable_rw_2"; static constexpr char EN_RW_2[] = "enable_rw_2";
static constexpr char EN_RW_3[] = "enable_rw_3"; static constexpr char EN_RW_3[] = "enable_rw_3";
static constexpr char EN_RW_4[] = "enable_rw_4"; static constexpr char EN_RW_4[] = "enable_rw_4";
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select"; static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
static constexpr char ENABLE_RADFET[] = "enable_radfet"; static constexpr char ENABLE_RADFET[] = "enable_radfet";
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0"; static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
@ -81,6 +84,16 @@ static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872"; static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872"; static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
static constexpr char PDEC_RESET[] = "pdec_reset"; static constexpr char PDEC_RESET[] = "pdec_reset";
static constexpr char PL_PCDU_ENABLE_VBAT0[] = "enable_plpcdu_vbat0";
static constexpr char PL_PCDU_ENABLE_VBAT1[] = "enable_plpcdu_vbat1";
static constexpr char PL_PCDU_ENABLE_DRO[] = "enable_plpcdu_dro";
static constexpr char PL_PCDU_ENABLE_X8[] = "enable_plpcdu_x8";
static constexpr char PL_PCDU_ENABLE_TX[] = "enable_plpcdu_tx";
static constexpr char PL_PCDU_ENABLE_HPA[] = "enable_plpcdu_hpa";
static constexpr char PL_PCDU_ENABLE_MPA[] = "enable_plpcdu_mpa";
static constexpr char PL_PCDU_ADC_CS[] = "plpcdu_adc_chip_select";
} // namespace gpioNames } // namespace gpioNames
} // namespace q7s } // namespace q7s

View File

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

View File

@ -25,38 +25,28 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
GpiodRegularByLineName* spiMuxBit = nullptr; GpiodRegularByLineName* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */ /** Setting mux bit 1 to low will disable IC21 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1", spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
gpio::DIR_OUT, gpio::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",
gpio::DIR_OUT, gpio::HIGH); gpio::DIR_OUT, gpio::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
/** Setting mux bit 2 to low disables IC1 on the TCS board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2",
gpio::DIR_OUT, gpio::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ /** 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_3_PIN, "SPI Mux Bit 3", spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
gpio::DIR_OUT, gpio::LOW); gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1",
// gpio::OUT, gpio::LOW);
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
// /** Setting mux bit 2 to low disables IC1 on the TCS board */
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2",
// gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, 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_3_PIN, "SPI Mux Bit
// 3", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
/** The following gpios can take arbitrary initial values */ /** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4", spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
gpio::DIR_OUT, gpio::LOW); gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 5", spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
gpio::DIR_OUT, gpio::LOW); gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6",
gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
GpiodRegularByLineName* enRwDecoder = GpiodRegularByLineName* enRwDecoder =
new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS, "EN_RW_CS", gpio::DIR_OUT, gpio::HIGH); new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS, "EN_RW_CS", gpio::DIR_OUT, gpio::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
@ -147,6 +137,10 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
disableDecoderTcsIc2(); disableDecoderTcsIc2();
break; break;
} }
case (gpioIds::CS_SUS_0): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_1): { case (gpioIds::CS_SUS_1): {
disableDecoderInterfaceBoardIc1(); disableDecoderInterfaceBoardIc1();
break; break;
@ -156,23 +150,23 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
break; break;
} }
case (gpioIds::CS_SUS_3): { case (gpioIds::CS_SUS_3): {
disableDecoderInterfaceBoardIc2(); disableDecoderInterfaceBoardIc1();
break; break;
} }
case (gpioIds::CS_SUS_4): { case (gpioIds::CS_SUS_4): {
disableDecoderInterfaceBoardIc2(); disableDecoderInterfaceBoardIc1();
break; break;
} }
case (gpioIds::CS_SUS_5): { case (gpioIds::CS_SUS_5): {
disableDecoderInterfaceBoardIc2(); disableDecoderInterfaceBoardIc1();
break; break;
} }
case (gpioIds::CS_SUS_6): { case (gpioIds::CS_SUS_6): {
disableDecoderInterfaceBoardIc1(); disableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_7): { case (gpioIds::CS_SUS_7): {
disableDecoderInterfaceBoardIc1(); disableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_8): { case (gpioIds::CS_SUS_8): {
@ -180,25 +174,17 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
break; break;
} }
case (gpioIds::CS_SUS_9): { case (gpioIds::CS_SUS_9): {
disableDecoderInterfaceBoardIc1(); disableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_10): { case (gpioIds::CS_SUS_10): {
disableDecoderInterfaceBoardIc1(); disableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_11): { case (gpioIds::CS_SUS_11): {
disableDecoderInterfaceBoardIc2(); disableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_12): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_13): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_RW1): { case (gpioIds::CS_RW1): {
disableRwDecoder(); disableRwDecoder();
break; break;
@ -300,71 +286,66 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
enableDecoderTcsIc2(); enableDecoderTcsIc2();
break; break;
} }
case (gpioIds::CS_SUS_1): { case (gpioIds::CS_SUS_0): {
selectY0(); selectY0();
enableDecoderInterfaceBoardIc1(); enableDecoderInterfaceBoardIc1();
break; break;
} }
case (gpioIds::CS_SUS_1): {
selectY1();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_2): { case (gpioIds::CS_SUS_2): {
selectY1(); selectY2();
enableDecoderInterfaceBoardIc1(); enableDecoderInterfaceBoardIc1();
break; break;
} }
case (gpioIds::CS_SUS_3): { 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(); selectY0();
enableDecoderInterfaceBoardIc2(); enableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_4): { case (gpioIds::CS_SUS_7): {
selectY1(); selectY1();
enableDecoderInterfaceBoardIc2(); enableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_5): {
selectY2();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_6): {
selectY2();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_7): {
selectY3();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_8): { case (gpioIds::CS_SUS_8): {
selectY3(); selectY2();
enableDecoderInterfaceBoardIc2(); enableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_9): { case (gpioIds::CS_SUS_9): {
selectY4(); selectY3();
enableDecoderInterfaceBoardIc1(); enableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_10): { case (gpioIds::CS_SUS_10): {
selectY5();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_11): {
selectY4(); selectY4();
enableDecoderInterfaceBoardIc2(); enableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_12): { case (gpioIds::CS_SUS_11): {
selectY5(); selectY5();
enableDecoderInterfaceBoardIc2(); enableDecoderInterfaceBoardIc2();
break; break;
} }
case (gpioIds::CS_SUS_13): {
selectY6();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_RW1): { case (gpioIds::CS_RW1): {
selectY0(); selectY0();
enableRwDecoder(); enableRwDecoder();
@ -394,52 +375,52 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
} }
void enableDecoderTcsIc1() { void enableDecoderTcsIc1() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
} }
void enableDecoderTcsIc2() { void enableDecoderTcsIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); 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->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
} }
void enableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
}
void enableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderTcsIc1() { void disableDecoderTcsIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
} }
void disableDecoderTcsIc2() { 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); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
} }
void disableDecoderInterfaceBoardIc1() { void disableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
} }
void disableDecoderInterfaceBoardIc2() { void disableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
} }
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); } void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
@ -447,57 +428,57 @@ void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); } void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
void selectY0() { void selectY0() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
} }
void selectY1() { void selectY1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
} }
void selectY2() { void selectY2() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
} }
void selectY3() { void selectY3() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
} }
void selectY4() { void selectY4() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
} }
void selectY5() { void selectY5() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
} }
void selectY6() { void selectY6() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
} }
void selectY7() { void selectY7() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
} }
void disableAllDecoder() { void disableAllDecoder() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); 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); gpioComInterface->pullLow(gpioIds::EN_RW_CS);
} }

View File

@ -1,13 +1,15 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <linux/boardtest/I2cTestClass.h> #include <linux/obc/AxiPtmeConfig.h>
#include <linux/boardtest/UartTestClass.h> #include <linux/obc/PapbVcInterface.h>
#include <linux/obc/PdecHandler.h>
#include <sstream> #include <linux/obc/Ptme.h>
#include <linux/obc/PtmeConfig.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/rwSpiCallback.h" #include "bsp_q7s/callbacks/rwSpiCallback.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
@ -17,7 +19,6 @@
#include "bsp_q7s/devices/startracker/StarTrackerDefinitions.h" #include "bsp_q7s/devices/startracker/StarTrackerDefinitions.h"
#include "bsp_q7s/devices/startracker/StarTrackerHandler.h" #include "bsp_q7s/devices/startracker/StarTrackerHandler.h"
#include "bsp_q7s/devices/startracker/StrHelper.h" #include "bsp_q7s/devices/startracker/StrHelper.h"
#include "bsp_q7s/gpio/gpioCallbacks.h"
#include "bsp_q7s/memory/FileSystemHandler.h" #include "bsp_q7s/memory/FileSystemHandler.h"
#include "busConf.h" #include "busConf.h"
#include "ccsdsConfig.h" #include "ccsdsConfig.h"
@ -25,6 +26,20 @@
#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 "linux/boardtest/I2cTestClass.h"
#include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h"
#include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h"
#include "linux/devices/SolarArrayDeploymentHandler.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
#endif
#include <sstream>
#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/CommandingServiceBase.h"
@ -40,12 +55,6 @@
#include "fsfw_hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h" #include "fsfw_hal/linux/uart/UartCookie.h"
#include "linux/boardtest/SpiTestClass.h"
#include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h"
#include "linux/devices/SolarArrayDeploymentHandler.h"
#include "mission/devices/SusHandler.h"
#include "mission/devices/devicedefinitions/SusDefinitions.h"
#include "mission/core/GenericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/devices/ACUHandler.h" #include "mission/devices/ACUHandler.h"
#include "mission/devices/BpxBatteryHandler.h" #include "mission/devices/BpxBatteryHandler.h"
@ -61,6 +70,7 @@
#include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/PlocMPSoCHandler.h"
#include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h" #include "mission/devices/RwHandler.h"
#include "mission/devices/SusHandler.h"
#include "mission/devices/SyrlinksHkHandler.h" #include "mission/devices/SyrlinksHkHandler.h"
#include "mission/devices/Tmp1075Handler.h" #include "mission/devices/Tmp1075Handler.h"
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" #include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
@ -68,22 +78,11 @@
#include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h" #include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
#include "mission/devices/devicedefinitions/RwDefinitions.h" #include "mission/devices/devicedefinitions/RwDefinitions.h"
#include "mission/devices/devicedefinitions/SusDefinitions.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "mission/tmtc/CCSDSHandler.h" #include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/VirtualChannel.h" #include "mission/tmtc/VirtualChannel.h"
#include "mission/utility/TmFunnel.h" #include "mission/utility/TmFunnel.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
#endif
#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>
ResetArgs resetArgsGnss0; ResetArgs resetArgsGnss0;
ResetArgs resetArgsGnss1; ResetArgs resetArgsGnss1;
@ -127,6 +126,7 @@ void ObjectFactory::produce(void* args) {
#if BOARD_TE0720 == 0 #if BOARD_TE0720 == 0
new CoreController(objects::CORE_CONTROLLER); new CoreController(objects::CORE_CONTROLLER);
gpioCallbacks::disableAllDecoder();
createPcduComponents(gpioComIF); createPcduComponents(gpioComIF);
createRadSensorComponent(gpioComIF); createRadSensorComponent(gpioComIF);
createSunSensorComponents(gpioComIF, spiComIF); createSunSensorComponents(gpioComIF, spiComIF);
@ -137,13 +137,11 @@ void ObjectFactory::produce(void* args) {
createHeaterComponents(); createHeaterComponents();
createSolarArrayDeploymentComponents(); createSolarArrayDeploymentComponents();
createPlPcduComponents(gpioComIF, spiComIF);
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(); createSyrlinksComponents();
#endif /* OBSW_ADD_SYRLINKS == 1 */ #endif /* OBSW_ADD_SYRLINKS == 1 */
#if OBSW_ADD_RTD_DEVICES == 1
createRtdComponents(gpioComIF); createRtdComponents(gpioComIF);
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
I2cCookie* imtqI2cCookie = I2cCookie* imtqI2cCookie =
@ -251,9 +249,7 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
new CspComIF(objects::CSP_COM_IF); new CspComIF(objects::CSP_COM_IF);
*i2cComIF = new I2cComIF(objects::I2C_COM_IF); *i2cComIF = new I2cComIF(objects::I2C_COM_IF);
*uartComIF = new UartComIF(objects::UART_COM_IF); *uartComIF = new UartComIF(objects::UART_COM_IF);
#if OBSW_ADD_SPI_TEST_CODE == 0
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF); *spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
#endif /* Q7S_ADD_SPI_TEST_CODE == 0 */
#if BOARD_TE0720 == 0 #if BOARD_TE0720 == 0
/* Adding gpios for chip select decoding to the gpioComIf */ /* Adding gpios for chip select decoding to the gpioComIf */
@ -316,6 +312,9 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
GpioCookie* gpioCookieSus = new GpioCookie(); GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr; GpioCallback* susgpio = nullptr;
susgpio = new GpioCallback("Chip select SUS 0", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_0, susgpio);
susgpio = new GpioCallback("Chip select SUS 1", gpio::DIR_OUT, gpio::HIGH, susgpio = new GpioCallback("Chip select SUS 1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
@ -349,68 +348,124 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
susgpio = new GpioCallback("Chip select SUS 11", gpio::DIR_OUT, gpio::HIGH, susgpio = new GpioCallback("Chip select SUS 11", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
susgpio = new GpioCallback("Chip select SUS 12", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio);
susgpio = new GpioCallback("Chip select SUS 13", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
gpioComIF->addGpios(gpioCookieSus); gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus1 = #if OBSW_ADD_SUN_SENSORS == 1
new SpiCookie(addresses::SUS_1, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV), SpiCookie* spiCookie =
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ); new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
SpiCookie* spiCookieSus2 = spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
new SpiCookie(addresses::SUS_2, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV), SusHandler* susHandler0 = new SusHandler(objects::SUS_0, 0, objects::SPI_COM_IF, spiCookie);
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus3 =
new SpiCookie(addresses::SUS_3, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus4 =
new SpiCookie(addresses::SUS_4, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus5 =
new SpiCookie(addresses::SUS_5, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus6 =
new SpiCookie(addresses::SUS_6, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus7 =
new SpiCookie(addresses::SUS_7, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus8 =
new SpiCookie(addresses::SUS_8, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus9 =
new SpiCookie(addresses::SUS_9, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus10 =
new SpiCookie(addresses::SUS_10, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus11 =
new SpiCookie(addresses::SUS_11, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus12 =
new SpiCookie(addresses::SUS_12, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus13 =
new SpiCookie(addresses::SUS_13, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
new SusHandler(objects::SUS_1, 0, objects::SPI_COM_IF, spiCookieSus1); spiCookie =
new SusHandler(objects::SUS_2, 1, objects::SPI_COM_IF, spiCookieSus2); new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
new SusHandler(objects::SUS_3, 2, objects::SPI_COM_IF, spiCookieSus3); spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
new SusHandler(objects::SUS_4, 3, objects::SPI_COM_IF, spiCookieSus4); SusHandler* susHandler1 = new SusHandler(objects::SUS_1, 1, objects::SPI_COM_IF, spiCookie);
new SusHandler(objects::SUS_5, 4, objects::SPI_COM_IF, spiCookieSus5);
new SusHandler(objects::SUS_6, 5, objects::SPI_COM_IF, spiCookieSus6); spiCookie =
new SusHandler(objects::SUS_7, 6, objects::SPI_COM_IF, spiCookieSus7); new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
new SusHandler(objects::SUS_8, 7, objects::SPI_COM_IF, spiCookieSus8); spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
new SusHandler(objects::SUS_9, 8, objects::SPI_COM_IF, spiCookieSus9); SusHandler* susHandler2 = new SusHandler(objects::SUS_2, 2, objects::SPI_COM_IF, spiCookie);
new SusHandler(objects::SUS_10, 9, objects::SPI_COM_IF, spiCookieSus10);
new SusHandler(objects::SUS_11, 10, objects::SPI_COM_IF, spiCookieSus11); spiCookie =
new SusHandler(objects::SUS_12, 11, objects::SPI_COM_IF, spiCookieSus12); new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string(q7s::SPI_DEFAULT_DEV),
new SusHandler(objects::SUS_13, 12, objects::SPI_COM_IF, spiCookieSus13); SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler3 = new SusHandler(objects::SUS_3, 3, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler4 = new SusHandler(objects::SUS_4, 4, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string(q7s::SPI_DEFAULT_DEV),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler5 = new SusHandler(objects::SUS_5, 5, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler6 = new SusHandler(objects::SUS_6, 6, objects::SPI_COM_IF, spiCookie,
gpioComIF, gpioIds::CS_SUS_6);
spiCookie =
new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler7 = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler8 = new SusHandler(objects::SUS_8, 8, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler9 = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler10 = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie);
spiCookie =
new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
SusHandler* susHandler11 = new SusHandler(objects::SUS_11, 11, objects::SPI_COM_IF, spiCookie);
static_cast<void>(susHandler0);
static_cast<void>(susHandler1);
static_cast<void>(susHandler2);
static_cast<void>(susHandler3);
static_cast<void>(susHandler4);
static_cast<void>(susHandler5);
static_cast<void>(susHandler6);
static_cast<void>(susHandler7);
static_cast<void>(susHandler8);
static_cast<void>(susHandler9);
static_cast<void>(susHandler10);
static_cast<void>(susHandler11);
#if OBSW_TEST_SUS == 1
susHandler0->setStartUpImmediately();
susHandler1->setStartUpImmediately();
susHandler2->setStartUpImmediately();
susHandler3->setStartUpImmediately();
susHandler4->setStartUpImmediately();
susHandler5->setStartUpImmediately();
susHandler6->setStartUpImmediately();
susHandler7->setStartUpImmediately();
susHandler8->setStartUpImmediately();
susHandler9->setStartUpImmediately();
susHandler10->setStartUpImmediately();
susHandler11->setStartUpImmediately();
susHandler0->setToGoToNormalMode(true);
susHandler1->setToGoToNormalMode(true);
susHandler2->setToGoToNormalMode(true);
susHandler3->setToGoToNormalMode(true);
susHandler4->setToGoToNormalMode(true);
susHandler5->setToGoToNormalMode(true);
susHandler6->setToGoToNormalMode(true);
susHandler7->setToGoToNormalMode(true);
susHandler8->setToGoToNormalMode(true);
susHandler9->setToGoToNormalMode(true);
susHandler10->setToGoToNormalMode(true);
susHandler11->setToGoToNormalMode(true);
#if OBSW_DEBUG_SUS == 1
susHandler0->enablePeriodicPrintout(true, 3);
susHandler1->enablePeriodicPrintout(true, 3);
susHandler2->enablePeriodicPrintout(true, 3);
susHandler3->enablePeriodicPrintout(true, 3);
susHandler4->enablePeriodicPrintout(true, 3);
susHandler5->enablePeriodicPrintout(true, 3);
susHandler6->enablePeriodicPrintout(true, 3);
susHandler7->enablePeriodicPrintout(true, 3);
susHandler8->enablePeriodicPrintout(true, 3);
susHandler9->enablePeriodicPrintout(true, 3);
susHandler10->enablePeriodicPrintout(true, 3);
susHandler11->enablePeriodicPrintout(true, 3);
#endif
#endif
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
} }
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF) { void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF) {
@ -519,9 +574,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
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 = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::LIS3_TRANSITION_DELAY); spiCookie, spi::LIS3_TRANSITION_DELAY);
#if OBSW_TEST_ACS == 1
mgmLis3Handler->setStartUpImmediately(); mgmLis3Handler->setStartUpImmediately();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
mgmLis3Handler->setToGoToNormalMode(true); mgmLis3Handler->setToGoToNormalMode(true);
#if OBSW_DEBUG_ACS == 1
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
spiCookie = spiCookie =
@ -529,9 +587,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::RM3100_TRANSITION_DELAY); spiCookie, spi::RM3100_TRANSITION_DELAY);
#if OBSW_TEST_ACS == 1
mgmRm3100Handler->setStartUpImmediately(); mgmRm3100Handler->setStartUpImmediately();
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
mgmRm3100Handler->setToGoToNormalMode(true); mgmRm3100Handler->setToGoToNormalMode(true);
#if OBSW_DEBUG_ACS == 1
mgmRm3100Handler->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
spiCookie = spiCookie =
@ -539,9 +600,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
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 mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::LIS3_TRANSITION_DELAY); spiCookie, spi::LIS3_TRANSITION_DELAY);
#if OBSW_TEST_ACS == 1
mgmLis3Handler2->setStartUpImmediately(); mgmLis3Handler2->setStartUpImmediately();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
mgmLis3Handler2->setToGoToNormalMode(true); mgmLis3Handler2->setToGoToNormalMode(true);
#if OBSW_DEBUG_ACS == 1
mgmLis3Handler2->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
spiCookie = spiCookie =
@ -549,9 +613,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::RM3100_TRANSITION_DELAY); spiCookie, spi::RM3100_TRANSITION_DELAY);
#if OBSW_TEST_ACS == 1
mgmRm3100Handler->setStartUpImmediately(); mgmRm3100Handler->setStartUpImmediately();
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
mgmRm3100Handler->setToGoToNormalMode(true); mgmRm3100Handler->setToGoToNormalMode(true);
#if OBSW_DEBUG_ACS == 1
mgmRm3100Handler->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
// Commented until ACS board V2 in in clean room again // Commented until ACS board V2 in in clean room again
@ -561,9 +628,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spi::DEFAULT_ADIS16507_SPEED); spi::DEFAULT_ADIS16507_SPEED);
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie, ADIS1650X::Type::ADIS16505); spiCookie, ADIS1650X::Type::ADIS16505);
#if OBSW_TEST_ACS == 1
adisHandler->setStartUpImmediately(); adisHandler->setStartUpImmediately();
#if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1
adisHandler->setToGoToNormalModeImmediately(); adisHandler->setToGoToNormalModeImmediately();
#if OBSW_DEBUG_ACS == 1
adisHandler->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
// Gyro 1 Side A // Gyro 1 Side A
@ -572,9 +642,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::L3G_TRANSITION_DELAY); spiCookie, spi::L3G_TRANSITION_DELAY);
#if OBSW_TEST_ACS == 1
gyroL3gHandler->setStartUpImmediately(); gyroL3gHandler->setStartUpImmediately();
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
gyroL3gHandler->setToGoToNormalMode(true); gyroL3gHandler->setToGoToNormalMode(true);
#if OBSW_DEBUG_ACS == 1
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
// Gyro 2 Side B // Gyro 2 Side B
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
@ -582,8 +655,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spi::DEFAULT_ADIS16507_SPEED); spi::DEFAULT_ADIS16507_SPEED);
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie, ADIS1650X::Type::ADIS16505); spiCookie, ADIS1650X::Type::ADIS16505);
#if OBSW_TEST_ACS == 1
adisHandler->setStartUpImmediately(); adisHandler->setStartUpImmediately();
#if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1
adisHandler->setToGoToNormalModeImmediately(); adisHandler->setToGoToNormalModeImmediately();
#endif #endif
// Gyro 3 Side B // Gyro 3 Side B
@ -592,9 +665,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::L3G_TRANSITION_DELAY); spiCookie, spi::L3G_TRANSITION_DELAY);
#if OBSW_TEST_ACS == 1
gyroL3gHandler->setStartUpImmediately(); gyroL3gHandler->setStartUpImmediately();
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
gyroL3gHandler->setToGoToNormalMode(true); gyroL3gHandler->setToGoToNormalMode(true);
#if OBSW_DEBUG_ACS == 1
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
#endif
#endif #endif
bool debugGps = false; bool debugGps = false;
@ -740,6 +816,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) {
gpioComIF->addGpios(rtdGpioCookie); gpioComIF->addGpios(rtdGpioCookie);
#if OBSW_ADD_RTD_DEVICES == 1
SpiCookie* spiRtdIc0 = SpiCookie* spiRtdIc0 =
new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV, new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV,
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED); Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
@ -822,13 +899,40 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) {
Max31865PT1000Handler* rtdIc15 = Max31865PT1000Handler* rtdIc15 =
new Max31865PT1000Handler(objects::RTD_IC_18, objects::SPI_COM_IF, spiRtdIc15); new Max31865PT1000Handler(objects::RTD_IC_18, objects::SPI_COM_IF, spiRtdIc15);
#if OBSW_TEST_RTD == 1
rtdIc0->setStartUpImmediately(); rtdIc0->setStartUpImmediately();
rtdIc1->setStartUpImmediately(); rtdIc1->setStartUpImmediately();
rtdIc2->setStartUpImmediately(); rtdIc2->setStartUpImmediately();
#if OBSW_DEBUG_RTD == 1 rtdIc3->setStartUpImmediately();
rtdIc4->setStartUpImmediately();
rtdIc5->setStartUpImmediately();
rtdIc6->setStartUpImmediately();
rtdIc7->setStartUpImmediately();
rtdIc8->setStartUpImmediately();
rtdIc9->setStartUpImmediately();
rtdIc10->setStartUpImmediately();
rtdIc11->setStartUpImmediately();
rtdIc12->setStartUpImmediately();
rtdIc13->setStartUpImmediately();
rtdIc14->setStartUpImmediately();
rtdIc15->setStartUpImmediately();
rtdIc0->setInstantNormal(true); rtdIc0->setInstantNormal(true);
rtdIc1->setInstantNormal(true); rtdIc1->setInstantNormal(true);
rtdIc2->setInstantNormal(true); rtdIc2->setInstantNormal(true);
rtdIc3->setInstantNormal(true);
rtdIc4->setInstantNormal(true);
rtdIc5->setInstantNormal(true);
rtdIc6->setInstantNormal(true);
rtdIc7->setInstantNormal(true);
rtdIc8->setInstantNormal(true);
rtdIc9->setInstantNormal(true);
rtdIc10->setInstantNormal(true);
rtdIc11->setInstantNormal(true);
rtdIc12->setInstantNormal(true);
rtdIc13->setInstantNormal(true);
rtdIc14->setInstantNormal(true);
rtdIc15->setInstantNormal(true);
#endif #endif
static_cast<void>(rtdIc0); static_cast<void>(rtdIc0);
@ -847,6 +951,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) {
static_cast<void>(rtdIc13); static_cast<void>(rtdIc13);
static_cast<void>(rtdIc14); static_cast<void>(rtdIc14);
static_cast<void>(rtdIc15); static_cast<void>(rtdIc15);
#endif
} }
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
@ -888,6 +993,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
gpioComIF->addGpios(gpioCookieRw); gpioComIF->addGpios(gpioCookieRw);
#if OBSW_ADD_RW == 1
auto rw1SpiCookie = auto rw1SpiCookie =
new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE, new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr); spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
@ -929,6 +1035,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
rwHandler4->setStartUpImmediately(); rwHandler4->setStartUpImmediately();
#endif #endif
rw4SpiCookie->setCallbackArgs(rwHandler4); rw4SpiCookie->setCallbackArgs(rwHandler4);
#endif /* OBSW_ADD_RW == 1 */
} }
void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
@ -1039,6 +1147,50 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
#endif /* BOARD_TE0720 == 0 */ #endif /* BOARD_TE0720 == 0 */
} }
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF) {
// Create all GPIO components first
GpioCookie* plPcduGpios = new GpioCookie;
GpiodRegularByLineName* gpio = nullptr;
std::string consumer;
// Switch pins are active high
consumer = "PLPCDU_ENB_VBAT_0";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT0, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT0, gpio);
consumer = "PLPCDU_ENB_VBAT_1";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT1, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT1, gpio);
consumer = "PLPCDU_ENB_DRO";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_DRO, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_DRO, gpio);
consumer = "PLPCDU_ENB_HPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
consumer = "PLPCDU_ENB_MPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
consumer = "PLPCDU_ENB_X8";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_X8, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_X8, gpio);
consumer = "PLPCDU_ENB_TX";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_TX, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_TX, gpio);
// Chip select pin is active low
consumer = "PLPCDU_ADC_CS";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, gpio::DIR_OUT,
gpio::Levels::HIGH);
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
gpioComIF->addGpios(plPcduGpios);
}
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 0 #if BOARD_TE0720 == 0
new Q7STestTask(objects::TEST_TASK); new Q7STestTask(objects::TEST_TASK);
@ -1060,18 +1212,18 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#endif #endif
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS_HANDLER == 1 #if BOARD_TE0720 == 1 && OBSW_TEST_SUS == 1
GpioCookie* gpioCookieSus = new GpioCookie; GpioCookie* gpioCookieSus = new GpioCookie;
GpiodRegular* chipSelectSus = new GpiodRegular( GpiodRegular* chipSelectSus = new GpiodRegular(
std::string("gpiochip1"), 9, std::string("Chip Select Sus Sensor"), gpio::DIR_OUT, 1); std::string("gpiochip1"), 9, std::string("Chip Select Sus Sensor"), gpio::DIR_OUT, 1);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus); gpioCookieSus->addGpio(gpioIds::CS_SUS_0, chipSelectSus);
gpioComIF->addGpios(gpioCookieSus); gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus = SpiCookie* spiCookieSus =
new SpiCookie(addresses::SUS_1, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, new SpiCookie(addresses::SUS_0, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_1); new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_0);
#endif #endif
#if BOARD_TE0720 == 1 && OBSW_TEST_CCSDS_BRIDGE == 1 #if BOARD_TE0720 == 1 && OBSW_TEST_CCSDS_BRIDGE == 1
@ -1089,7 +1241,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY); gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
#endif #endif
#if BOARD_TE0720 == 1 && OBSW_TEST_RADIATION_SENSOR_HANDLER == 1 #if BOARD_TE0720 == 1 && OBSW_TEST_RAD_SENSOR == 1
GpioCookie* gpioCookieRadSensor = new GpioCookie; GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular( GpiodRegular* chipSelectRadSensor = new GpiodRegular(
std::string("gpiochip1"), 0, std::string("Chip select radiation sensor"), gpio::DIR_OUT, 1); std::string("gpiochip1"), 0, std::string("Chip select radiation sensor"), gpio::DIR_OUT, 1);

View File

@ -13,6 +13,8 @@ void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF, void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
SpiComIF** spiComIF, I2cComIF** i2cComIF); SpiComIF** spiComIF, I2cComIF** i2cComIF);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
void createTmpComponents(); void createTmpComponents();
void createPcduComponents(LinuxLibgpioIF* gpioComIF); void createPcduComponents(LinuxLibgpioIF* gpioComIF);
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF); void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);

View File

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

View File

@ -11,6 +11,7 @@ enum commonObjects: uint32_t {
TMTC_BRIDGE = 0x50000300, TMTC_BRIDGE = 0x50000300,
TMTC_POLLING_TASK = 0x50000400, TMTC_POLLING_TASK = 0x50000400,
FILE_SYSTEM_HANDLER = 0x50000500, FILE_SYSTEM_HANDLER = 0x50000500,
SDC_MANAGER = 0x50000550,
PTME = 0x50000600, PTME = 0x50000600,
PDEC_HANDLER = 0x50000700, PDEC_HANDLER = 0x50000700,
CCSDS_HANDLER = 0x50000800, CCSDS_HANDLER = 0x50000800,
@ -36,6 +37,7 @@ enum commonObjects: uint32_t {
GYRO_1_L3G_HANDLER = 0x44120111, GYRO_1_L3G_HANDLER = 0x44120111,
GYRO_2_ADIS_HANDLER = 0x44120212, GYRO_2_ADIS_HANDLER = 0x44120212,
GYRO_3_L3G_HANDLER = 0x44120313, GYRO_3_L3G_HANDLER = 0x44120313,
PLPCDU_HANDLER = 0x44300000,
IMTQ_HANDLER = 0x44140014, IMTQ_HANDLER = 0x44140014,
PLOC_MPSOC_HANDLER = 0x44330015, PLOC_MPSOC_HANDLER = 0x44330015,
@ -62,19 +64,18 @@ enum commonObjects: uint32_t {
RTD_IC_17 = 0x44420030, RTD_IC_17 = 0x44420030,
RTD_IC_18 = 0x44420031, RTD_IC_18 = 0x44420031,
SUS_1 = 0x44120032, SUS_0 = 0x44120032,
SUS_2 = 0x44120033, SUS_1 = 0x44120033,
SUS_3 = 0x44120034, SUS_2 = 0x44120034,
SUS_4 = 0x44120035, SUS_3 = 0x44120035,
SUS_5 = 0x44120036, SUS_4 = 0x44120036,
SUS_6 = 0x44120037, SUS_5 = 0x44120037,
SUS_7 = 0x44120038, SUS_6 = 0x44120038,
SUS_8 = 0x44120039, SUS_7 = 0x44120039,
SUS_9 = 0x44120040, SUS_8 = 0x44120040,
SUS_10 = 0x44120041, SUS_9 = 0x44120041,
SUS_11 = 0x44120042, SUS_10 = 0x44120042,
SUS_12 = 0x44120043, SUS_11 = 0x44120043,
SUS_13 = 0x44120044,
GPS_CONTROLLER = 0x44130045, GPS_CONTROLLER = 0x44130045,

View File

@ -4,19 +4,18 @@
0x43400001;THERMAL_CONTROLLER 0x43400001;THERMAL_CONTROLLER
0x44120006;MGM_0_LIS3_HANDLER 0x44120006;MGM_0_LIS3_HANDLER
0x44120010;GYRO_0_ADIS_HANDLER 0x44120010;GYRO_0_ADIS_HANDLER
0x44120032;SUS_1 0x44120032;SUS_0
0x44120033;SUS_2 0x44120033;SUS_1
0x44120034;SUS_3 0x44120034;SUS_2
0x44120035;SUS_4 0x44120035;SUS_3
0x44120036;SUS_5 0x44120036;SUS_4
0x44120037;SUS_6 0x44120037;SUS_5
0x44120038;SUS_7 0x44120038;SUS_6
0x44120039;SUS_8 0x44120039;SUS_7
0x44120040;SUS_9 0x44120040;SUS_8
0x44120041;SUS_10 0x44120041;SUS_9
0x44120042;SUS_11 0x44120042;SUS_10
0x44120043;SUS_12 0x44120043;SUS_11
0x44120044;SUS_13
0x44120047;RW1 0x44120047;RW1
0x44120107;MGM_1_RM3100_HANDLER 0x44120107;MGM_1_RM3100_HANDLER
0x44120111;GYRO_1_L3G_HANDLER 0x44120111;GYRO_1_L3G_HANDLER
@ -36,6 +35,7 @@
0x44250002;PDU2_HANDLER 0x44250002;PDU2_HANDLER
0x44250003;ACU_HANDLER 0x44250003;ACU_HANDLER
0x44260000;BPX_BATT_HANDLER 0x44260000;BPX_BATT_HANDLER
0x44300000;PLPCDU_HANDLER
0x443200A5;RAD_SENSOR 0x443200A5;RAD_SENSOR
0x44330000;PLOC_UPDATER 0x44330000;PLOC_UPDATER
0x44330001;PLOC_MEMORY_DUMPER 0x44330001;PLOC_MEMORY_DUMPER
@ -101,6 +101,7 @@
0x53ffffff;FSFW_OBJECTS_END 0x53ffffff;FSFW_OBJECTS_END
0x54000010;SPI_TEST 0x54000010;SPI_TEST
0x54000020;UART_TEST 0x54000020;UART_TEST
0x54000030;I2C_TEST
0x5400AFFE;DUMMY_HANDLER 0x5400AFFE;DUMMY_HANDLER
0x5400CAFE;DUMMY_INTERFACE 0x5400CAFE;DUMMY_INTERFACE
0x54123456;LIBGPIOD_TEST 0x54123456;LIBGPIOD_TEST

1 0x00005060 P60DOCK_TEST_TASK
4 0x43400001 THERMAL_CONTROLLER
5 0x44120006 MGM_0_LIS3_HANDLER
6 0x44120010 GYRO_0_ADIS_HANDLER
7 0x44120032 SUS_1 SUS_0
8 0x44120033 SUS_2 SUS_1
9 0x44120034 SUS_3 SUS_2
10 0x44120035 SUS_4 SUS_3
11 0x44120036 SUS_5 SUS_4
12 0x44120037 SUS_6 SUS_5
13 0x44120038 SUS_7 SUS_6
14 0x44120039 SUS_8 SUS_7
15 0x44120040 SUS_9 SUS_8
16 0x44120041 SUS_10 SUS_9
17 0x44120042 SUS_11 SUS_10
18 0x44120043 SUS_12 SUS_11
0x44120044 SUS_13
19 0x44120047 RW1
20 0x44120107 MGM_1_RM3100_HANDLER
21 0x44120111 GYRO_1_L3G_HANDLER
35 0x44250002 PDU2_HANDLER
36 0x44250003 ACU_HANDLER
37 0x44260000 BPX_BATT_HANDLER
38 0x44300000 PLPCDU_HANDLER
39 0x443200A5 RAD_SENSOR
40 0x44330000 PLOC_UPDATER
41 0x44330001 PLOC_MEMORY_DUMPER
101 0x53ffffff FSFW_OBJECTS_END
102 0x54000010 SPI_TEST
103 0x54000020 UART_TEST
104 0x54000030 I2C_TEST
105 0x5400AFFE DUMMY_HANDLER
106 0x5400CAFE DUMMY_INTERFACE
107 0x54123456 LIBGPIOD_TEST

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 110 translations. * Contains 111 translations.
* Generated on: 2022-02-03 12:01:36 * Generated on: 2022-02-21 17:31:37
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER"; const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
const char *SUS_0_STRING = "SUS_0";
const char *SUS_1_STRING = "SUS_1"; const char *SUS_1_STRING = "SUS_1";
const char *SUS_2_STRING = "SUS_2"; const char *SUS_2_STRING = "SUS_2";
const char *SUS_3_STRING = "SUS_3"; const char *SUS_3_STRING = "SUS_3";
@ -23,8 +24,6 @@ const char *SUS_8_STRING = "SUS_8";
const char *SUS_9_STRING = "SUS_9"; const char *SUS_9_STRING = "SUS_9";
const char *SUS_10_STRING = "SUS_10"; const char *SUS_10_STRING = "SUS_10";
const char *SUS_11_STRING = "SUS_11"; const char *SUS_11_STRING = "SUS_11";
const char *SUS_12_STRING = "SUS_12";
const char *SUS_13_STRING = "SUS_13";
const char *RW1_STRING = "RW1"; const char *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER"; const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER"; const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
@ -44,6 +43,7 @@ const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER"; const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER"; const char *ACU_HANDLER_STRING = "ACU_HANDLER";
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER"; const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
const char *RAD_SENSOR_STRING = "RAD_SENSOR"; const char *RAD_SENSOR_STRING = "RAD_SENSOR";
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER"; const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER"; const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
@ -109,6 +109,7 @@ const char *TIME_STAMPER_STRING = "TIME_STAMPER";
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END"; const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *SPI_TEST_STRING = "SPI_TEST"; const char *SPI_TEST_STRING = "SPI_TEST";
const char *UART_TEST_STRING = "UART_TEST"; const char *UART_TEST_STRING = "UART_TEST";
const char *I2C_TEST_STRING = "I2C_TEST";
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER"; const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE"; const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST"; const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
@ -132,31 +133,29 @@ const char* translateObject(object_id_t object) {
case 0x44120010: case 0x44120010:
return GYRO_0_ADIS_HANDLER_STRING; return GYRO_0_ADIS_HANDLER_STRING;
case 0x44120032: case 0x44120032:
return SUS_1_STRING; return SUS_0_STRING;
case 0x44120033: case 0x44120033:
return SUS_2_STRING; return SUS_1_STRING;
case 0x44120034: case 0x44120034:
return SUS_3_STRING; return SUS_2_STRING;
case 0x44120035: case 0x44120035:
return SUS_4_STRING; return SUS_3_STRING;
case 0x44120036: case 0x44120036:
return SUS_5_STRING; return SUS_4_STRING;
case 0x44120037: case 0x44120037:
return SUS_6_STRING; return SUS_5_STRING;
case 0x44120038: case 0x44120038:
return SUS_7_STRING; return SUS_6_STRING;
case 0x44120039: case 0x44120039:
return SUS_8_STRING; return SUS_7_STRING;
case 0x44120040: case 0x44120040:
return SUS_9_STRING; return SUS_8_STRING;
case 0x44120041: case 0x44120041:
return SUS_10_STRING; return SUS_9_STRING;
case 0x44120042: case 0x44120042:
return SUS_11_STRING; return SUS_10_STRING;
case 0x44120043: case 0x44120043:
return SUS_12_STRING; return SUS_11_STRING;
case 0x44120044:
return SUS_13_STRING;
case 0x44120047: case 0x44120047:
return RW1_STRING; return RW1_STRING;
case 0x44120107: case 0x44120107:
@ -195,6 +194,8 @@ const char* translateObject(object_id_t object) {
return ACU_HANDLER_STRING; return ACU_HANDLER_STRING;
case 0x44260000: case 0x44260000:
return BPX_BATT_HANDLER_STRING; return BPX_BATT_HANDLER_STRING;
case 0x44300000:
return PLPCDU_HANDLER_STRING;
case 0x443200A5: case 0x443200A5:
return RAD_SENSOR_STRING; return RAD_SENSOR_STRING;
case 0x44330000: case 0x44330000:
@ -325,6 +326,8 @@ const char* translateObject(object_id_t object) {
return SPI_TEST_STRING; return SPI_TEST_STRING;
case 0x54000020: case 0x54000020:
return UART_TEST_STRING; return UART_TEST_STRING;
case 0x54000030:
return I2C_TEST_STRING;
case 0x5400AFFE: case 0x5400AFFE:
return DUMMY_HANDLER_STRING; return DUMMY_HANDLER_STRING;
case 0x5400CAFE: case 0x5400CAFE:

View File

@ -15,16 +15,20 @@
#include <bitset> #include <bitset>
#if defined(XIPHOS_Q7S)
#include "busConf.h"
#endif
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "mission/devices/max1227.h"
SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF *gpioIF) SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF *gpioIF)
: TestTask(objectId), gpioIF(gpioIF) { : TestTask(objectId), gpioIF(gpioIF) {
if (gpioIF == nullptr) { if (gpioIF == nullptr) {
sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl;
} }
testMode = TestModes::MGM_LIS3MDL; testMode = TestModes::MAX1227;
spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct[0].rx_buf = reinterpret_cast<__u64>(recvBuffer.data());
spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); setSendBuffer();
} }
ReturnValue_t SpiTestClass::performOneShotAction() { ReturnValue_t SpiTestClass::performOneShotAction() {
@ -44,11 +48,25 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
performL3gTest(gyro1L3gd20ChipSelect); performL3gTest(gyro1L3gd20ChipSelect);
break; break;
} }
case (TestModes::MAX1227): {
performOneShotMax1227Test();
break;
}
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t SpiTestClass::performPeriodicAction() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t SpiTestClass::performPeriodicAction() {
switch (testMode) {
case (TestModes::MAX1227): {
performPeriodicMax1227Test();
break;
}
default:
break;
}
return HasReturnvaluesIF::RETURN_OK;
}
void SpiTestClass::performRm3100Test(uint8_t mgmId) { void SpiTestClass::performRm3100Test(uint8_t mgmId) {
/* Configure all SPI chip selects and pull them high */ /* Configure all SPI chip selects and pull them high */
@ -180,7 +198,7 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
return; return;
} }
setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
spiTransferStruct.delay_usecs = 0; spiTransferStruct[0].delay_usecs = 0;
uint8_t whoAmIRegVal = readStmRegister(fileDescriptor, currentGpioId, whoAmIReg, false); uint8_t whoAmIRegVal = readStmRegister(fileDescriptor, currentGpioId, whoAmIReg, false);
sif::info << "SpiTestClass::performLis3MdlTest: WHO AM I register 0b" sif::info << "SpiTestClass::performLis3MdlTest: WHO AM I register 0b"
@ -273,6 +291,352 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
sif::info << "Z: " << angVelocZ << std::endl; sif::info << "Z: " << angVelocZ << std::endl;
} }
void SpiTestClass::performOneShotMax1227Test() {
using namespace max1227;
adcCfg.testRadSensorExtConvWithDelay = false;
adcCfg.testRadSensorIntConv = false;
bool setAllSusOn = false;
bool susIntConv = false;
bool susExtConv = false;
if (setAllSusOn) {
for (uint8_t idx = 0; idx < 12; idx++) {
adcCfg.testSus[idx].doTest = true;
}
} else {
for (uint8_t idx = 0; idx < 12; idx++) {
adcCfg.testSus[idx].doTest = false;
}
}
if (susIntConv) {
for (uint8_t idx = 0; idx < 12; idx++) {
adcCfg.testSus[idx].intConv = true;
}
}
if (susExtConv) {
for (uint8_t idx = 0; idx < 12; idx++) {
adcCfg.testSus[idx].extConv = true;
}
}
adcCfg.plPcduAdcExtConv = true;
adcCfg.plPcduAdcIntConv = false;
// Is problematic, don't know why
adcCfg.plPcduAdcExtConvAsOne = false;
performMax1227Test();
}
void SpiTestClass::performPeriodicMax1227Test() {
using namespace max1227;
performMax1227Test();
}
void SpiTestClass::performMax1227Test() {
#ifdef XIPHOS_Q7S
std::string deviceName = q7s::SPI_DEFAULT_DEV;
#elif defined(RASPBERRY_PI)
std::string deviceName = "";
#endif
int fd = 0;
UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface");
if (fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl;
return;
}
uint32_t spiSpeed = 976'000;
spi::SpiModes spiMode = spi::SpiModes::MODE_3;
setSpiSpeedAndMode(fd, spiMode, spiSpeed);
max1227RadSensorTest(fd);
int idx = 0;
bool firstTest = true;
for (auto &susCfg : adcCfg.testSus) {
if (susCfg.doTest) {
if (firstTest) {
firstTest = false;
sif::info << "---------- SUS ADC Values -----------" << std::endl;
}
sif::info << "SUS " << std::setw(2) << idx << ": ";
max1227SusTest(fd, susCfg);
}
idx++;
}
max1227PlPcduTest(fd);
}
void SpiTestClass::max1227RadSensorTest(int fd) {
using namespace max1227;
if (adcCfg.testRadSensorExtConvWithDelay) {
sendBuffer[0] = max1227::buildResetByte(true);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(200);
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_WITH_WAKEUP,
DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 7, spiTransferStruct[0].len);
size_t tmpLen = spiTransferStruct[0].len;
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, tmpLen - 1);
spiTransferStruct[0].len = tmpLen - 1;
usleep(65);
transfer(fd, gpioIds::CS_RAD_SENSOR);
arrayprinter::print(recvBuffer.data(), 13, OutputType::HEX);
uint16_t adcRaw[8] = {};
adcRaw[0] = (recvBuffer[0] << 8) | recvBuffer[1];
adcRaw[1] = (recvBuffer[2] << 8) | recvBuffer[3];
adcRaw[2] = (recvBuffer[4] << 8) | recvBuffer[5];
adcRaw[3] = (recvBuffer[6] << 8) | recvBuffer[7];
adcRaw[4] = (recvBuffer[8] << 8) | recvBuffer[9];
adcRaw[5] = (recvBuffer[10] << 8) | recvBuffer[11];
adcRaw[6] = (recvBuffer[12] << 8) | recvBuffer[13];
adcRaw[7] = (recvBuffer[14] << 8) | recvBuffer[15];
arrayprinter::print(recvBuffer.data(), 17, OutputType::HEX);
for (int idx = 0; idx < 8; idx++) {
sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl;
}
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), spiTransferStruct[0].len);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(65);
spiTransferStruct[0].len = 24;
std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, 24);
transfer(fd, gpioIds::CS_RAD_SENSOR);
int16_t tempRaw = ((recvBuffer[22] & 0x0f) << 8) | recvBuffer[23];
float temp = max1227::getTemperature(tempRaw);
sif::info << "Temperature: " << temp << std::endl;
}
if (adcCfg.testRadSensorIntConv) {
sendBuffer[0] = max1227::buildResetByte(false);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(5);
// Now use internal conversion
sendBuffer[0] = max1227::buildSetupByte(ClkSel::INT_CONV_INT_TIMED_CNVST_AS_AIN,
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(10);
sendBuffer[0] = buildConvByte(ScanModes::CHANNELS_0_TO_N, 7, true);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(65);
spiTransferStruct[0].len = 18;
// Shift out zeros
shiftOutZeros();
transfer(fd, gpioIds::CS_RAD_SENSOR);
setSendBuffer();
arrayprinter::print(recvBuffer.data(), 14);
uint16_t adcRaw[8] = {};
int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1];
sif::info << "Temperature: " << tempRaw * 0.125 << " C" << std::endl;
adcRaw[0] = (recvBuffer[2] << 8) | recvBuffer[3];
adcRaw[1] = (recvBuffer[4] << 8) | recvBuffer[5];
adcRaw[2] = (recvBuffer[6] << 8) | recvBuffer[7];
adcRaw[3] = (recvBuffer[8] << 8) | recvBuffer[9];
adcRaw[4] = (recvBuffer[10] << 8) | recvBuffer[11];
adcRaw[5] = (recvBuffer[12] << 8) | recvBuffer[13];
adcRaw[6] = (recvBuffer[14] << 8) | recvBuffer[15];
adcRaw[7] = (recvBuffer[16] << 8) | recvBuffer[17];
for (int idx = 0; idx < 8; idx++) {
sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl;
}
}
}
void SpiTestClass::max1227SusTest(int fd, SusTestCfg &cfg) {
using namespace max1227;
if (cfg.extConv) {
sendBuffer[0] = max1227::buildResetByte(false);
spiTransferStruct[0].len = 1;
transfer(fd, cfg.gpioId);
usleep(65);
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP,
DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, cfg.gpioId);
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 5, spiTransferStruct[0].len);
transfer(fd, cfg.gpioId);
uint16_t adcRaw[6] = {};
adcRaw[0] = (recvBuffer[1] << 8) | recvBuffer[2];
adcRaw[1] = (recvBuffer[3] << 8) | recvBuffer[4];
adcRaw[2] = (recvBuffer[5] << 8) | recvBuffer[6];
adcRaw[3] = (recvBuffer[7] << 8) | recvBuffer[8];
adcRaw[4] = (recvBuffer[9] << 8) | recvBuffer[10];
adcRaw[5] = (recvBuffer[11] << 8) | recvBuffer[12];
sif::info << "Ext Conv [" << std::hex << std::setw(3);
for (int idx = 0; idx < 5; idx++) {
sif::info << adcRaw[idx];
if (idx < 6) {
sif::info << ",";
}
}
sif::info << std::dec << "]" << std::endl; // | Temperature: " << temp << " C" << std::endl;
}
if (cfg.intConv) {
sendBuffer[0] = max1227::buildResetByte(false);
spiTransferStruct[0].len = 1;
transfer(fd, cfg.gpioId);
usleep(65);
// Now use internal conversion
sendBuffer[0] = max1227::buildSetupByte(ClkSel::INT_CONV_INT_TIMED_CNVST_AS_AIN,
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, cfg.gpioId);
usleep(10);
sendBuffer[0] = buildConvByte(ScanModes::CHANNELS_0_TO_N, 5, true);
spiTransferStruct[0].len = 1;
transfer(fd, cfg.gpioId);
usleep(65);
spiTransferStruct[0].len = 14;
// Shift out zeros
shiftOutZeros();
transfer(fd, cfg.gpioId);
setSendBuffer();
// arrayprinter::print(recvBuffer.data(), 14);
float temp = static_cast<int16_t>(((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1]) * 0.125;
uint16_t adcRaw[6] = {};
adcRaw[0] = (recvBuffer[2] << 8) | recvBuffer[3];
adcRaw[1] = (recvBuffer[4] << 8) | recvBuffer[5];
adcRaw[2] = (recvBuffer[6] << 8) | recvBuffer[7];
adcRaw[3] = (recvBuffer[8] << 8) | recvBuffer[9];
adcRaw[4] = (recvBuffer[10] << 8) | recvBuffer[11];
adcRaw[5] = (recvBuffer[12] << 8) | recvBuffer[13];
sif::info << "Int Conv [" << std::hex << std::setw(3);
for (int idx = 0; idx < 6; idx++) {
sif::info << adcRaw[idx];
if (idx < 5) {
sif::info << ",";
}
}
sif::info << std::dec << "] | T[C] " << temp << std::endl;
}
}
void SpiTestClass::max1227PlPcduTest(int fd) {
using namespace max1227;
if ((adcCfg.plPcduAdcExtConv or adcCfg.plPcduAdcIntConv or adcCfg.plPcduAdcExtConvAsOne) and
adcCfg.vbatSwitch) {
// This enables the ADC
ReturnValue_t result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
if (result != HasReturnvaluesIF::RETURN_OK) {
return;
}
result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
if (result != HasReturnvaluesIF::RETURN_OK) {
return;
}
adcCfg.vbatSwitch = false;
// Takes a bit of time until the ADC is usable
TaskFactory::delayTask(50);
sendBuffer[0] = max1227::buildResetByte(false);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
}
if (adcCfg.plPcduAdcExtConv) {
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP,
DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint8_t n = 11;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len);
size_t dummy = 0;
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len,
dummy);
// + 1 to account for temp conversion byte
spiTransferStruct[0].len += 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint16_t adcRaw[n + 1] = {};
for (uint8_t idx = 0; idx < n + 1; idx++) {
adcRaw[idx] = (recvBuffer[idx * 2 + 1] << 8) | recvBuffer[idx * 2 + 2];
}
spiTransferStruct[0].len = 24;
// Shift out zeros
shiftOutZeros();
transfer(fd, gpioIds::PLPCDU_ADC_CS);
setSendBuffer();
int16_t tempRaw = ((recvBuffer[22] & 0x0f) << 8) | recvBuffer[23];
sif::info << "PL PCDU ADC ext conv [" << std::hex << std::setfill('0');
for (int idx = 0; idx < n + 1; idx++) {
sif::info << std::setw(3) << adcRaw[idx];
if (idx < n) {
sif::info << ",";
}
}
sif::info << "]" << std::endl;
sif::info << "Temperature: " << max1227::getTemperature(tempRaw) << " C" << std::endl;
}
if (adcCfg.plPcduAdcExtConvAsOne) {
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP,
DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint8_t n = 11;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len);
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len,
spiTransferStruct[0].len);
transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint16_t adcRaw[n + 1] = {};
for (uint8_t idx = 0; idx < n + 1; idx++) {
adcRaw[idx] = (recvBuffer[idx * 2 + 1] << 8) | recvBuffer[idx * 2 + 2];
}
int16_t tempRaw = ((recvBuffer[spiTransferStruct[0].len - 2] & 0x0f) << 8) |
recvBuffer[spiTransferStruct[0].len - 1];
sif::info << "PL PCDU ADC ext conv [" << std::hex << std::setfill('0');
for (int idx = 0; idx < n + 1; idx++) {
sif::info << std::setw(3) << adcRaw[idx];
if (idx < n) {
sif::info << ",";
}
}
sif::info << "]" << std::endl;
sif::info << "Temperature: " << max1227::getTemperature(tempRaw) << " C" << std::endl;
}
if (adcCfg.plPcduAdcIntConv) {
sendBuffer[0] = max1227::buildResetByte(true);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
// Now use internal conversion
sendBuffer[0] = max1227::buildSetupByte(ClkSel::INT_CONV_INT_TIMED_CNVST_AS_AIN,
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
usleep(10);
uint8_t n = 11;
sendBuffer[0] = buildConvByte(ScanModes::CHANNELS_0_TO_N, n, true);
spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS);
usleep(65);
spiTransferStruct[0].len = 26;
// Shift out zeros
shiftOutZeros();
transfer(fd, gpioIds::PLPCDU_ADC_CS);
setSendBuffer();
uint16_t adcRaw[n + 1] = {};
int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1];
sif::info << "PL PCDU ADC int conv [" << std::hex << std::setfill('0');
for (int idx = 0; idx < n + 1; idx++) {
adcRaw[idx] = (recvBuffer[idx * 2 + 2] << 8) | recvBuffer[idx * 2 + 3];
sif::info << std::setw(3) << adcRaw[idx];
if (idx < n) {
sif::info << ",";
}
}
sif::info << "]" << std::endl;
sif::info << "Temperature: " << max1227::getTemperature(tempRaw) << " C" << std::endl;
}
}
void SpiTestClass::acsInit() { void SpiTestClass::acsInit() {
GpioCookie *gpioCookie = new GpioCookie(); GpioCookie *gpioCookie = new GpioCookie();
@ -348,8 +712,27 @@ void SpiTestClass::acsInit() {
} }
void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) {
int mode_test = SPI_MODE_3; int modeUnix = 0;
int retval = ioctl(spiFd, SPI_IOC_WR_MODE, &mode_test); // reinterpret_cast<uint8_t*>(&mode)); switch (mode) {
case (spi::SpiModes::MODE_0): {
modeUnix = SPI_MODE_0;
break;
}
case (spi::SpiModes::MODE_1): {
modeUnix = SPI_MODE_1;
break;
}
case (spi::SpiModes::MODE_2): {
modeUnix = SPI_MODE_2;
break;
}
case (spi::SpiModes::MODE_3): {
modeUnix = SPI_MODE_3;
break;
}
}
int retval = ioctl(spiFd, SPI_IOC_WR_MODE, &modeUnix); // reinterpret_cast<uint8_t*>(&mode));
if (retval != 0) { if (retval != 0) {
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!");
} }
@ -361,7 +744,7 @@ void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t sp
} }
void SpiTestClass::writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value) { void SpiTestClass::writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value) {
spiTransferStruct.len = 2; spiTransferStruct[0].len = 2;
sendBuffer[0] = reg; sendBuffer[0] = reg;
sendBuffer[1] = value; sendBuffer[1] = value;
@ -405,7 +788,7 @@ void SpiTestClass::writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t r
sendBuffer[0] = reg; sendBuffer[0] = reg;
std::memcpy(sendBuffer.data() + 1, values, len); std::memcpy(sendBuffer.data() + 1, values, len);
spiTransferStruct.len = len + 1; spiTransferStruct[0].len = len + 1;
if (gpioIF != nullptr and chipSelect != gpio::NO_GPIO) { if (gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullLow(chipSelect); gpioIF->pullLow(chipSelect);
@ -429,13 +812,19 @@ void SpiTestClass::readMultipleStmRegisters(int fd, gpioId_t chipSelect, uint8_t
readMultipleRegisters(fd, chipSelect, reg, reply, len); readMultipleRegisters(fd, chipSelect, reg, reply, len);
} }
void SpiTestClass::shiftOutZeros() { spiTransferStruct[0].tx_buf = 0; }
void SpiTestClass::setSendBuffer() {
spiTransferStruct[0].tx_buf = reinterpret_cast<__u64>(sendBuffer.data());
}
void SpiTestClass::readMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply, void SpiTestClass::readMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply,
size_t len) { size_t len) {
if (reply == nullptr) { if (reply == nullptr) {
return; return;
} }
spiTransferStruct.len = len + 1; spiTransferStruct[0].len = len + 1;
sendBuffer[0] = reg | STM_READ_MASK; sendBuffer[0] = reg | STM_READ_MASK;
for (uint8_t idx = 0; idx < len; idx++) { for (uint8_t idx = 0; idx < len; idx++) {
@ -465,7 +854,7 @@ uint8_t SpiTestClass::readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg,
} }
uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) { uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) {
spiTransferStruct.len = 2; spiTransferStruct[0].len = 2;
sendBuffer[0] = reg; sendBuffer[0] = reg;
sendBuffer[1] = 0; sendBuffer[1] = 0;
@ -481,3 +870,28 @@ uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) {
} }
return recvBuffer[1]; return recvBuffer[1];
} }
ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO) {
int retval = 0;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if (chipSelect != gpio::NO_GPIO) {
result = gpioIF->pullLow(chipSelect);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if (retval < 0) {
utility::handleIoctlError("SpiTestClass::transfer: ioctl failed");
return HasReturnvaluesIF::RETURN_FAILED;
}
if (chipSelect != gpio::NO_GPIO) {
result = gpioIF->pullHigh(chipSelect);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -6,21 +6,40 @@
#if defined(XIPHOS_Q7S) #if defined(XIPHOS_Q7S)
#include "busConf.h" #include "busConf.h"
#endif #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>
#include <vector> #include <vector>
#include "devices/gpioIds.h"
struct SusTestCfg {
SusTestCfg(bool doTest, gpioId_t gpioId) : gpioId(gpioId) {}
bool doTest = false;
const gpioId_t gpioId;
bool intConv = true;
bool extConv = false;
};
struct Max1227TestCfg {
bool testRadSensorExtConvWithDelay = false;
bool testRadSensorIntConv = false;
bool plPcduAdcExtConv = false;
bool plPcduAdcExtConvAsOne = false;
bool plPcduAdcIntConv = false;
bool vbatSwitch = true;
SusTestCfg testSus[12] = {
{false, gpioIds::CS_SUS_0}, {false, gpioIds::CS_SUS_1}, {false, gpioIds::CS_SUS_2},
{false, gpioIds::CS_SUS_3}, {false, gpioIds::CS_SUS_4}, {false, gpioIds::CS_SUS_5},
{false, gpioIds::CS_SUS_6}, {false, gpioIds::CS_SUS_7}, {false, gpioIds::CS_SUS_8},
{false, gpioIds::CS_SUS_9}, {false, gpioIds::CS_SUS_10}, {false, gpioIds::CS_SUS_11},
};
};
class SpiTestClass : public TestTask { class SpiTestClass : public TestTask {
public: public:
enum TestModes { enum TestModes { NONE, MGM_LIS3MDL, MGM_RM3100, GYRO_L3GD20H, MAX1227 };
NONE,
MGM_LIS3MDL,
MGM_RM3100,
GYRO_L3GD20H,
};
TestModes testMode; TestModes testMode;
@ -31,14 +50,18 @@ class SpiTestClass : public TestTask {
private: private:
GpioIF* gpioIF; GpioIF* gpioIF;
Max1227TestCfg adcCfg = {};
std::array<uint8_t, 128> recvBuffer; std::array<uint8_t, 128> recvBuffer;
std::array<uint8_t, 128> sendBuffer; std::array<uint8_t, 128> sendBuffer;
struct spi_ioc_transfer spiTransferStruct = {}; struct spi_ioc_transfer spiTransferStruct[6] = {};
void performRm3100Test(uint8_t mgmId); void performRm3100Test(uint8_t mgmId);
void performLis3MdlTest(uint8_t lis3Id); void performLis3MdlTest(uint8_t lis3Id);
void performL3gTest(uint8_t l3gId); void performL3gTest(uint8_t l3gId);
void performOneShotMax1227Test();
void performPeriodicMax1227Test();
void performMax1227Test();
/* ACS board specific code which pulls all GPIOs high */ /* ACS board specific code which pulls all GPIOs high */
void acsInit(); void acsInit();
@ -55,6 +78,7 @@ class SpiTestClass : public TestTask {
uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN; uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN;
uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN; uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN;
#else #else
uint8_t mgm0Lis3mdlChipSelect = 0; uint8_t mgm0Lis3mdlChipSelect = 0;
uint8_t mgm1Rm3100ChipSelect = 0; uint8_t mgm1Rm3100ChipSelect = 0;
uint8_t gyro0AdisResetLine = 0; uint8_t gyro0AdisResetLine = 0;
@ -69,6 +93,13 @@ class SpiTestClass : public TestTask {
static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK; static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK;
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000; static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
void shiftOutZeros();
void setSendBuffer();
void max1227RadSensorTest(int fd);
void max1227SusTest(int fd, SusTestCfg& cfg);
void max1227PlPcduTest(int fd);
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed); void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value, void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
@ -78,6 +109,7 @@ class SpiTestClass : public TestTask {
void writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t* values, void writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t* values,
size_t len); size_t len);
void writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value); void writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value);
ReturnValue_t transfer(int fd, gpioId_t chipSelect);
uint8_t readRm3100Register(int fd, gpioId_t chipSelect, uint8_t reg); uint8_t readRm3100Register(int fd, gpioId_t chipSelect, uint8_t reg);
uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement); uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement);

View File

@ -35,9 +35,9 @@ debugging. */
#define OBSW_USE_CCSDS_IP_CORE 1 #define OBSW_USE_CCSDS_IP_CORE 1
// Set to 1 if all telemetry should be sent to the PTME IP Core // Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 1 #define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core // Set to 1 if telecommands are received via the PDEC IP Core
#define OBSW_TC_FROM_PDEC 1 #define OBSW_TC_FROM_PDEC 0
#define OBSW_ENABLE_TIMERS 1 #define OBSW_ENABLE_TIMERS 1
#define OBSW_ADD_MGT 1 #define OBSW_ADD_MGT 1
@ -52,6 +52,7 @@ debugging. */
#define OBSW_ADD_RTD_DEVICES 0 #define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_TMP_DEVICES 0 #define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_RAD_SENSORS 0 #define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_PL_PCDU 0
#define OBSW_ADD_SYRLINKS 0 #define OBSW_ADD_SYRLINKS 0
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
#define OBSW_ENABLE_PERIODIC_HK 0 #define OBSW_ENABLE_PERIODIC_HK 0
@ -62,7 +63,7 @@ debugging. */
/** All of the following flags should be disabled for mission code */ /** All of the following flags should be disabled for mission code */
/*******************************************************************/ /*******************************************************************/
//! /* Can be used to switch device to NORMAL mode immediately */ // Can be used to switch device to NORMAL mode immediately
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
@ -76,9 +77,17 @@ debugging. */
#define OBSW_ADD_I2C_TEST_CODE 0 #define OBSW_ADD_I2C_TEST_CODE 0
#define OBSW_ADD_UART_TEST_CODE 0 #define OBSW_ADD_UART_TEST_CODE 0
#define OBSW_TEST_ACS 0
#define OBSW_DEBUG_ACS 0
#define OBSW_TEST_SUS 0
#define OBSW_DEBUG_SUS 0
#define OBSW_TEST_RTD 0
#define OBSW_DEBUG_RTD 0
#define OBSW_TEST_RAD_SENSOR 0
#define OBSW_DEBUG_RAD_SENSOR 0
#define OBSW_TEST_PL_PCDU 0
#define OBSW_DEBUG_PL_PCDU 0
#define OBSW_TEST_LIBGPIOD 0 #define OBSW_TEST_LIBGPIOD 0
#define OBSW_TEST_RADIATION_SENSOR_HANDLER 0
#define OBSW_TEST_SUS_HANDLER 0
#define OBSW_TEST_PLOC_HANDLER 0 #define OBSW_TEST_PLOC_HANDLER 0
#define OBSW_TEST_BPX_BATT 0 #define OBSW_TEST_BPX_BATT 0
#define OBSW_TEST_CCSDS_BRIDGE 0 #define OBSW_TEST_CCSDS_BRIDGE 0
@ -86,7 +95,6 @@ debugging. */
#define OBSW_TEST_TE7020_HEATER 0 #define OBSW_TEST_TE7020_HEATER 0
#define OBSW_TEST_GPIO_OPEN_BY_LABEL 0 #define OBSW_TEST_GPIO_OPEN_BY_LABEL 0
#define OBSW_TEST_GPIO_OPEN_BY_LINE_NAME 0 #define OBSW_TEST_GPIO_OPEN_BY_LINE_NAME 0
#define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_P60DOCK 0
#define OBSW_DEBUG_BPX_BATT 0 #define OBSW_DEBUG_BPX_BATT 0
#define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU1 0
@ -95,9 +103,6 @@ debugging. */
#define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMTQ 0 #define OBSW_DEBUG_IMTQ 0
#define OBSW_DEBUG_RAD_SENSOR 0
#define OBSW_DEBUG_SUS 0
#define OBSW_DEBUG_RTD 0
#define OBSW_DEBUG_RW 0 #define OBSW_DEBUG_RW 0
#define OBSW_DEBUG_STARTRACKER 0 #define OBSW_DEBUG_STARTRACKER 0
#define OBSW_DEBUG_PLOC_MPSOC 0 #define OBSW_DEBUG_PLOC_MPSOC 0

View File

@ -1,7 +1 @@
/**
* \file logicalAddresses.cpp
*
* \date 06.11.2019
*/
#include "addresses.h" #include "addresses.h"

View File

@ -24,6 +24,7 @@ enum logicalAddresses : address_t {
RAD_SENSOR = objects::RAD_SENSOR, RAD_SENSOR = objects::RAD_SENSOR,
SUS_0 = objects::SUS_0,
SUS_1 = objects::SUS_1, SUS_1 = objects::SUS_1,
SUS_2 = objects::SUS_2, SUS_2 = objects::SUS_2,
SUS_3 = objects::SUS_3, SUS_3 = objects::SUS_3,
@ -35,8 +36,6 @@ enum logicalAddresses : address_t {
SUS_9 = objects::SUS_9, SUS_9 = objects::SUS_9,
SUS_10 = objects::SUS_10, SUS_10 = objects::SUS_10,
SUS_11 = objects::SUS_11, SUS_11 = objects::SUS_11,
SUS_12 = objects::SUS_12,
SUS_13 = objects::SUS_13,
/* Dummy and Test Addresses */ /* Dummy and Test Addresses */
DUMMY_ECHO = 129, DUMMY_ECHO = 129,
@ -71,7 +70,8 @@ enum spiAddresses : address_t {
RW1, RW1,
RW2, RW2,
RW3, RW3,
RW4 RW4,
PLPCDU_ADC
}; };
/* Addresses of devices supporting the CSP protocol */ /* Addresses of devices supporting the CSP protocol */

View File

@ -54,6 +54,7 @@ enum gpioId_t {
RTD_IC_17, RTD_IC_17,
RTD_IC_18, RTD_IC_18,
CS_SUS_0,
CS_SUS_1, CS_SUS_1,
CS_SUS_2, CS_SUS_2,
CS_SUS_3, CS_SUS_3,
@ -65,15 +66,13 @@ enum gpioId_t {
CS_SUS_9, CS_SUS_9,
CS_SUS_10, CS_SUS_10,
CS_SUS_11, CS_SUS_11,
CS_SUS_12,
CS_SUS_13,
SPI_MUX_BIT_0,
SPI_MUX_BIT_1, SPI_MUX_BIT_1,
SPI_MUX_BIT_2, SPI_MUX_BIT_2,
SPI_MUX_BIT_3, SPI_MUX_BIT_3,
SPI_MUX_BIT_4, SPI_MUX_BIT_4,
SPI_MUX_BIT_5, SPI_MUX_BIT_5,
SPI_MUX_BIT_6,
CS_RAD_SENSOR, CS_RAD_SENSOR,
ENABLE_RADFET, ENABLE_RADFET,
@ -111,7 +110,16 @@ enum gpioId_t {
RS485_EN_RX_DATA, RS485_EN_RX_DATA,
RS485_EN_RX_CLOCK, RS485_EN_RX_CLOCK,
BIT_RATE_SEL BIT_RATE_SEL,
PLPCDU_ENB_VBAT0,
PLPCDU_ENB_VBAT1,
PLPCDU_ENB_DRO,
PLPCDU_ENB_X8,
PLPCDU_ENB_TX,
PLPCDU_ENB_HPA,
PLPCDU_ENB_MPA,
PLPCDU_ADC_CS
}; };
} }

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 110 translations. * Contains 111 translations.
* Generated on: 2022-02-03 12:01:36 * Generated on: 2022-02-21 17:31:37
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER"; const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
const char *SUS_0_STRING = "SUS_0";
const char *SUS_1_STRING = "SUS_1"; const char *SUS_1_STRING = "SUS_1";
const char *SUS_2_STRING = "SUS_2"; const char *SUS_2_STRING = "SUS_2";
const char *SUS_3_STRING = "SUS_3"; const char *SUS_3_STRING = "SUS_3";
@ -23,8 +24,6 @@ const char *SUS_8_STRING = "SUS_8";
const char *SUS_9_STRING = "SUS_9"; const char *SUS_9_STRING = "SUS_9";
const char *SUS_10_STRING = "SUS_10"; const char *SUS_10_STRING = "SUS_10";
const char *SUS_11_STRING = "SUS_11"; const char *SUS_11_STRING = "SUS_11";
const char *SUS_12_STRING = "SUS_12";
const char *SUS_13_STRING = "SUS_13";
const char *RW1_STRING = "RW1"; const char *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER"; const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER"; const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
@ -44,6 +43,7 @@ const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER"; const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER"; const char *ACU_HANDLER_STRING = "ACU_HANDLER";
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER"; const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
const char *RAD_SENSOR_STRING = "RAD_SENSOR"; const char *RAD_SENSOR_STRING = "RAD_SENSOR";
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER"; const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER"; const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
@ -109,6 +109,7 @@ const char *TIME_STAMPER_STRING = "TIME_STAMPER";
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END"; const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *SPI_TEST_STRING = "SPI_TEST"; const char *SPI_TEST_STRING = "SPI_TEST";
const char *UART_TEST_STRING = "UART_TEST"; const char *UART_TEST_STRING = "UART_TEST";
const char *I2C_TEST_STRING = "I2C_TEST";
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER"; const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE"; const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST"; const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
@ -132,31 +133,29 @@ const char *translateObject(object_id_t object) {
case 0x44120010: case 0x44120010:
return GYRO_0_ADIS_HANDLER_STRING; return GYRO_0_ADIS_HANDLER_STRING;
case 0x44120032: case 0x44120032:
return SUS_1_STRING; return SUS_0_STRING;
case 0x44120033: case 0x44120033:
return SUS_2_STRING; return SUS_1_STRING;
case 0x44120034: case 0x44120034:
return SUS_3_STRING; return SUS_2_STRING;
case 0x44120035: case 0x44120035:
return SUS_4_STRING; return SUS_3_STRING;
case 0x44120036: case 0x44120036:
return SUS_5_STRING; return SUS_4_STRING;
case 0x44120037: case 0x44120037:
return SUS_6_STRING; return SUS_5_STRING;
case 0x44120038: case 0x44120038:
return SUS_7_STRING; return SUS_6_STRING;
case 0x44120039: case 0x44120039:
return SUS_8_STRING; return SUS_7_STRING;
case 0x44120040: case 0x44120040:
return SUS_9_STRING; return SUS_8_STRING;
case 0x44120041: case 0x44120041:
return SUS_10_STRING; return SUS_9_STRING;
case 0x44120042: case 0x44120042:
return SUS_11_STRING; return SUS_10_STRING;
case 0x44120043: case 0x44120043:
return SUS_12_STRING; return SUS_11_STRING;
case 0x44120044:
return SUS_13_STRING;
case 0x44120047: case 0x44120047:
return RW1_STRING; return RW1_STRING;
case 0x44120107: case 0x44120107:
@ -195,6 +194,8 @@ const char *translateObject(object_id_t object) {
return ACU_HANDLER_STRING; return ACU_HANDLER_STRING;
case 0x44260000: case 0x44260000:
return BPX_BATT_HANDLER_STRING; return BPX_BATT_HANDLER_STRING;
case 0x44300000:
return PLPCDU_HANDLER_STRING;
case 0x443200A5: case 0x443200A5:
return RAD_SENSOR_STRING; return RAD_SENSOR_STRING;
case 0x44330000: case 0x44330000:
@ -325,6 +326,8 @@ const char *translateObject(object_id_t object) {
return SPI_TEST_STRING; return SPI_TEST_STRING;
case 0x54000020: case 0x54000020:
return UART_TEST_STRING; return UART_TEST_STRING;
case 0x54000030:
return I2C_TEST_STRING;
case 0x5400AFFE: case 0x5400AFFE:
return DUMMY_HANDLER_STRING; return DUMMY_HANDLER_STRING;
case 0x5400CAFE: case 0x5400CAFE:

View File

@ -1,6 +1,4 @@
#include "pollingSequenceFactory.h" #include "pollingSequenceFactory.h"
#include "OBSWConfig.h"
#include "objects/systemObjectList.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
@ -151,6 +149,19 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#endif #endif
#if OBSW_ADD_SUN_SENSORS == 1 #if OBSW_ADD_SUN_SENSORS == 1
bool addSus0 = true;
bool addSus1 = true;
bool addSus2 = true;
bool addSus3 = true;
bool addSus4 = true;
bool addSus5 = true;
bool addSus6 = true;
bool addSus7 = true;
bool addSus8 = true;
bool addSus9 = true;
bool addSus10 = true;
bool addSus11 = true;
/** /**
* The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all * The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all
* requests to a sun sensor must be performed consecutively. Another reason for calling multiple * requests to a sun sensor must be performed consecutively. Another reason for calling multiple
@ -159,253 +170,157 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
* One sun sensor communication sequence also blocks the SPI bus. So other devices can not be * One sun sensor communication sequence also blocks the SPI bus. So other devices can not be
* inserted between the device handler cycles of one SUS. * inserted between the device handler cycles of one SUS.
*/ */
if (addSus0) {
/* Write setup */ /* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ); if (addSus1) {
/* Write setup */ thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE); thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); if (addSus2) {
/* Write setup */ thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ); if (addSus3) {
/* Write setup */ thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ); if (addSus4) {
/* Write setup */ thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.914, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ); if (addSus5) {
/* Start ADC conversions */ thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_READ);
/* Write setup */ if (addSus6) {
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_READ);
/* Write setup */ if (addSus7) {
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_READ);
/* Write setup */ if (addSus8) {
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ);
/* Write setup */ thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */ if (addSus9) {
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */ thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ); }
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ);
#endif if (addSus10) {
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::GET_READ);
}
if (addSus11) {
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::GET_READ);
}
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
#if OBSW_ADD_RW == 1 #if OBSW_ADD_RW == 1
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
@ -434,8 +349,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#endif #endif
#if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 #if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1
bool enableAside = true; bool enableAside = false;
bool enableBside = false; bool enableBside = true;
if (enableAside) { if (enableAside) {
// A side // A side
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
@ -450,21 +365,21 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.35, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
} }
@ -472,7 +387,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
// B side // B side
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
@ -482,21 +397,21 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ);
} }
#endif /* OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 */ #endif /* OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 */
@ -517,6 +432,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle // Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
@ -683,7 +599,7 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_TEST_RADIATION_SENSOR_HANDLER == 1 #if OBSW_TEST_RAD_SENSOR == 1
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
@ -691,7 +607,7 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_TEST_SUS_HANDLER == 1 #if OBSW_TEST_SUS == 1
/* Write setup */ /* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);