Update EIVE OBSW #114

Merged
meierj merged 8 commits from mueller/update-sw into develop 2021-12-14 18:36:32 +01:00
26 changed files with 287 additions and 244 deletions

View File

@ -177,6 +177,7 @@ endif()
if(NOT EIVE_BUILD_WATCHDOG)
if(NOT EIVE_BUILD_UNITTESTS)
if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LIB_ARCSEC_PATH})
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${BSP_PATH})
@ -192,7 +193,6 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
add_subdirectory(${FSFW_PATH})
add_subdirectory(${MISSION_PATH})
add_subdirectory(${TEST_PATH})
add_subdirectory(${LIB_ARCSEC_PATH})
endif()
if(EIVE_BUILD_UNITTESTS)

View File

@ -1,8 +1,6 @@
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
#include <linux/gpio/GpioIF.h>
namespace gpioIds {
enum gpioId_t {
HEATER_0,

View File

@ -133,8 +133,15 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::SPI_READ_FAILURE;
}
if(idx == 0) {
if(byteRead != FLAG_BYTE) {
sif::error << "Invalid data, expected start marker" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::NO_START_MARKER;
}
}
if (byteRead != 0x7E) {
if (byteRead != FLAG_BYTE) {
break;
}
@ -145,6 +152,10 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
}
}
#if FSFW_HAL_SPI_WIRETAPPING == 1
sif::info << "RW start marker detected" << std::endl;
#endif
size_t decodedFrameLen = 0;
while(decodedFrameLen < replyBufferSize) {
@ -158,7 +169,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
}
}
if (byteRead == 0x7E) {
if (byteRead == FLAG_BYTE) {
/** Reached end of frame */
break;
}

View File

@ -8,6 +8,9 @@
namespace rwSpiCallback {
//! This is the end and start marker of the frame datalinklayer
static constexpr uint8_t FLAG_BYTE = 0x7E;
/**
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
* receive the replies.

View File

@ -22,7 +22,7 @@
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR", false, false, true);
ServiceInterfaceStream sif::error("ERROR");
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);

View File

@ -19,12 +19,15 @@
#include "bsp_q7s/callbacks/rwSpiCallback.h"
#include "bsp_q7s/callbacks/gnssCallback.h"
#include "linux/devices/HeaterHandler.h"
#include "linux/devices/StarTrackerHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h"
#include "linux/devices/devicedefinitions/SusDefinitions.h"
#include "linux/devices/SusHandler.h"
#include "linux/csp/CspCookie.h"
#include "linux/csp/CspComIF.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/devices/HeaterHandler.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/PDU1Handler.h"
#include "mission/devices/PDU2Handler.h"
@ -33,20 +36,19 @@
#include "mission/devices/P60DockHandler.h"
#include "mission/devices/Tmp1075Handler.h"
#include "mission/devices/Max31865PT1000Handler.h"
#include "mission/devices/GyroADIS16507Handler.h"
#include "mission/devices/GyroADIS1650XHandler.h"
#include "mission/devices/IMTQHandler.h"
#include "mission/devices/SyrlinksHkHandler.h"
#include "mission/devices/PlocMPSoCHandler.h"
#include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h"
#include "mission/devices/StarTrackerHandler.h"
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
#include "mission/devices/devicedefinitions/RwDefinitions.h"
#include "mission/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/devices/GPSHyperionHandler.h"
#include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/VirtualChannel.h"
@ -264,7 +266,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
std::stringstream consumer;
consumer << "0x" << std::hex << objects::RAD_SENSOR;
GpiodRegularByLineName* gpio = new GpiodRegularByLineName(
q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::OUT, gpio::HIGH);
q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::DIR_OUT, gpio::HIGH);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
gpioComIF->addGpios(gpioCookieRadSensor);
@ -278,43 +280,43 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr;
susgpio = new GpioCallback("Chip select SUS 1", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
susgpio = new GpioCallback("Chip select SUS 2", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 2", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
susgpio = new GpioCallback("Chip select SUS 3", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 3", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
susgpio = new GpioCallback("Chip select SUS 4", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 4", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
susgpio = new GpioCallback("Chip select SUS 5", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 5", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
susgpio = new GpioCallback("Chip select SUS 6", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 6", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
susgpio = new GpioCallback("Chip select SUS 7", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 7", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
susgpio = new GpioCallback("Chip select SUS 8", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 8", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
susgpio = new GpioCallback("Chip select SUS 9", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 9", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
susgpio = new GpioCallback("Chip select SUS 10", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 10", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
susgpio = new GpioCallback("Chip select SUS 11", gpio::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 11", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
susgpio = new GpioCallback("Chip select SUS 12", gpio::OUT, gpio::HIGH,
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::OUT, gpio::HIGH,
susgpio = new GpioCallback("Chip select SUS 13", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
@ -395,61 +397,61 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(),
gpio::OUT, gpio::HIGH);
gpio::DIR_OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_1_L3G_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_3_L3G_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_0_LIS3_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_1_RM3100_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(),
gpio::OUT, gpio::HIGH);
gpio::DIR_OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_3_RM3100_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GPS0_HANDLER;
// GNSS reset pins are active low
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GPS1_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
@ -457,12 +459,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
// Enable pins must be pulled low for regular operations
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(),
gpio::OUT, gpio::LOW);
gpio::DIR_OUT, gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
@ -509,10 +511,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
// Commented until ACS board V2 in in clean room again
// Gyro 0 Side A
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
spi::DEFAULT_ADIS16507_SPEED);
auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie);
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately();
// Gyro 1 Side A
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
@ -525,10 +527,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
#endif
// Gyro 2 Side B
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
spi::DEFAULT_ADIS16507_SPEED);
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie);
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately();
// Gyro 3 Side B
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
@ -576,37 +578,37 @@ void ObjectFactory::createHeaterComponents() {
std::stringstream consumer;
consumer << "0x" << std::hex << objects::HEATER_HANDLER;
/* Pin H2-11 on stack connector */
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpio);
/* Pin H2-12 on stack connector */
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpio);
/* Pin H2-13 on stack connector */
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(),
gpio::OUT, gpio::LOW);
gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(),
gpio::OUT, gpio::LOW);
gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(),
gpio::OUT, gpio::LOW);
gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(),
gpio::OUT, gpio::LOW);
gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(),
gpio::OUT, gpio::LOW);
gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
@ -620,9 +622,9 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
std::stringstream consumer;
consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0,
consumer.str(), gpio::OUT, gpio::LOW);
consumer.str(), gpio::DIR_OUT, gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio);
@ -644,52 +646,52 @@ void ObjectFactory::createSyrlinksComponents() {
void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
GpioCookie* rtdGpioCookie = new GpioCookie;
GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc0);
GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc1);
GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc2);
GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc3);
GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc4);
GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc5);
GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc6);
GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc7);
GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc8);
GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc9);
GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc10);
GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc11);
GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc12);
GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc13);
GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc14);
GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", gpio::OUT, gpio::HIGH,
GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15);
@ -737,7 +739,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::RTD_SPEED);
Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF,
Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF,
spiRtdIc0);
Max31865PT1000Handler* rtdIc1 = new Max31865PT1000Handler(objects::RTD_IC_4, objects::SPI_COM_IF,
spiRtdIc1);
@ -794,38 +796,38 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRw = new GpioCookie;
GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT, gpio::HIGH,
GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1);
GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT, gpio::HIGH,
GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2);
GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT, gpio::HIGH,
GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3);
GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT, gpio::HIGH,
GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::RW1;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW2;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW3;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW4;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
@ -835,7 +837,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
* Per default the PS SPI is selected (EMIO = 0).
*/
gpio = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_SELECT,
"SPI Reaction Wheel Callback ", gpio::OUT, gpio::LOW);
"SPI Reaction Wheel Callback ", gpio::DIR_OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::SPI_MUX, gpio);
gpioComIF->addGpios(gpioCookieRw);
@ -943,7 +945,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
consumer.str("");
consumer << "ptme rate setter";
// Init to low -> default bit rate is low bit rate (200 kbps in downlink with syrlinks)
gpio = new GpiodRegularByLineName(q7s::gpioNames::BIT_RATE_SEL, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::BIT_RATE_SEL, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRateSetter->addGpio(gpioIds::BIT_RATE_SEL, gpio);
gpioComIF->addGpios(gpioCookieRateSetter);
@ -968,7 +970,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
consumer.str("");
consumer << "0x" << std::hex << objects::PDEC_HANDLER;
// GPIO also low after linux boot (specified by device-tree)
gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
@ -981,18 +983,18 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
#if BOARD_TE0720 == 0
GpioCookie* gpioRS485Chip = new GpioCookie;
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
gpio::Direction::OUT, gpio::LOW);
gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_CLOCK, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver",
gpio::Direction::OUT, gpio::LOW);
gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio);
// Default configuration enables RX channels (RXEN = LOW)
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver",
gpio::Direction::OUT, gpio::LOW);
gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_CLOCK, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver",
gpio::Direction::OUT, gpio::LOW);
gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
gpioComIF->addGpios(gpioRS485Chip);
@ -1008,10 +1010,10 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0);
GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::DIR_OUT, 0, "/amba_pl/gpio@41200000", 0);
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
GpiodRegularByLineName* testGpio = new GpiodRegularByLineName("test-name", "gpio-test",
gpio::OUT, 0);
gpio::DIR_OUT, 0);
#else
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
@ -1024,7 +1026,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS_HANDLER == 1
GpioCookie* gpioCookieSus = new GpioCookie;
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
std::string("Chip Select Sus Sensor"), gpio::OUT, 1);
std::string("Chip Select Sus Sensor"), gpio::DIR_OUT, 1);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus);
gpioComIF->addGpios(gpioCookieSus);
@ -1052,7 +1054,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
std::string("Chip select radiation sensor"), gpio::OUT, 1);
std::string("Chip select radiation sensor"), gpio::DIR_OUT, 1);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor);

View File

@ -27,13 +27,15 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
GpiodRegularByLineName* spiMuxBit = nullptr;
/** 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",
gpio::OUT, gpio::HIGH);
gpio::DIR_OUT, gpio::HIGH);
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);
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 */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3",
gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1",
@ -47,14 +49,17 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
/** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4",
gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 5", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 5",
gpio::DIR_OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6", gpio::OUT, gpio::LOW);
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 = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS,
"EN_RW_CS", gpio::OUT, gpio::HIGH);
"EN_RW_CS", gpio::DIR_OUT, gpio::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios);

2
fsfw

@ -1 +1 @@
Subproject commit ceb87b5abb2992a18266328e0ea34d9af15db7af
Subproject commit bda02b464a2ad00b1a8e373d4c6b80b0a7c8de95

View File

@ -297,65 +297,65 @@ void SpiTestClass::acsInit() {
GpiodRegularByChip* gpio = nullptr;
std::string rpiGpioName = "gpiochip0";
gpio = new GpiodRegularByChip(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegularByChip(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegularByChip(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegularByChip(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegularByChip(rpiGpioName, gyro3L3gd20ChipSelect, "GYRO_2_L3G",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegularByChip(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegularByChip(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100",
gpio::Direction::OUT, 1);
gpio::DIR_OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
#elif defined(XIPHOS_Q7S)
GpiodRegularByLineName* gpio = nullptr;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, "MGM_0_LIS3", gpio::Direction::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, "MGM_0_LIS3", gpio::DIR_OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_1_RM3100", gpio::Direction::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_1_RM3100", gpio::DIR_OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, "MGM_2_LIS3", gpio::Direction::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, "MGM_2_LIS3", gpio::DIR_OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_3_RM3100", gpio::Direction::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_3_RM3100", gpio::DIR_OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, "GYRO_0_ADIS",
gpio::Direction::OUT, gpio::HIGH);
gpio::DIR_OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, "GYRO_1_L3G", gpio::Direction::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, "GYRO_1_L3G", gpio::DIR_OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, "GYRO_2_ADIS",
gpio::Direction::OUT, gpio::HIGH);
gpio::DIR_OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, "GYRO_3_L3G", gpio::Direction::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, "GYRO_3_L3G", gpio::DIR_OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
// Enable pins must be pulled low for regular operations
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_0_ENABLE", gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_0_ENABLE", gpio::DIR_OUT,
gpio::LOW);
gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_2_ENABLE", gpio::OUT,
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_2_ENABLE", gpio::DIR_OUT,
gpio::LOW);
gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
#endif

View File

@ -1,5 +1,5 @@
target_sources(${TARGET_NAME} PRIVATE
HeaterHandler.cpp
SolarArrayDeploymentHandler.cpp
SusHandler.cpp
StarTrackerHandler.cpp
)

View File

@ -2,7 +2,7 @@
#define MISSION_DEVICES_STARTRACKERHANDLER_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/devices/devicedefinitions/StarTrackerDefinitions.h>
#include <linux/devices/devicedefinitions/StarTrackerDefinitions.h>
#include <thirdparty/arcsec_star_tracker/common/SLIP.h>
/**

View File

@ -78,6 +78,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
#define FSFW_HAL_RM3100_MGM_DEBUG 0
#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0
#define FSFW_HAL_ADIS16507_GYRO_DEBUG 0
#define FSFW_HAL_ADIS1650X_GYRO_DEBUG 0
#endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -19,7 +19,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.1176904738" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.PE64" id="cdt.managedbuild.target.gnu.platform.mingw.base.1087094604" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/>
<builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Debug-Host}" command="cmake" id="cdt.managedbuild.builder.gnu.cross.1026777292" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<builder arguments="--build . -j" buildPath="${workspace_loc:/eive-obsw/build-Debug-Host}" command="cmake" id="cdt.managedbuild.builder.gnu.cross.1026777292" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.813737526" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.596367416" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
@ -406,6 +406,9 @@
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.autotools.core.ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">

View File

@ -18,7 +18,7 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Host/eive_obsw.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Host/eive-obsw.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive-obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443"/>

View File

@ -10,11 +10,11 @@ target_sources(${TARGET_NAME} PUBLIC
SyrlinksHkHandler.cpp
Max31865PT1000Handler.cpp
IMTQHandler.cpp
HeaterHandler.cpp
PlocMPSoCHandler.cpp
RadiationSensorHandler.cpp
GyroADIS16507Handler.cpp
GyroADIS1650XHandler.cpp
RwHandler.cpp
StarTrackerHandler.cpp
)

View File

@ -1,8 +1,8 @@
#include "GyroADIS16507Handler.h"
#include "GyroADIS1650XHandler.h"
#include <fsfw/action/HasActionsIF.h>
#include <fsfw/datapool/PoolReadGuard.h>
#if OBSW_ADIS16507_LINUX_COM_IF == 1
#if OBSW_ADIS1650X_LINUX_COM_IF == 1
#include "fsfw_hal/linux/utility.h"
#include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw_hal/linux/spi/SpiComIF.h"
@ -11,15 +11,15 @@
#include <unistd.h>
#endif
GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
object_id_t deviceCommunication, CookieIF * comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this),
configDataset(this), breakCountdown() {
#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1
GyroADIS1650XHandler::GyroADIS1650XHandler(object_id_t objectId,
object_id_t deviceCommunication, CookieIF * comCookie, ADIS1650X::Type type):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), adisType(type),
primaryDataset(this), configDataset(this), breakCountdown() {
#if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1
debugDivider = new PeriodicOperationDivider(5);
#endif
#if OBSW_ADIS16507_LINUX_COM_IF == 1
#if OBSW_ADIS1650X_LINUX_COM_IF == 1
SpiCookie* cookie = dynamic_cast<SpiCookie*>(comCookie);
if(cookie != nullptr) {
cookie->setCallbackMode(&spiSendCallback, this);
@ -27,11 +27,11 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
#endif
}
void GyroADIS16507Handler::doStartUp() {
void GyroADIS1650XHandler::doStartUp() {
// Initial 310 ms start up time after power-up
if(internalState == InternalState::STARTUP) {
if(not commandExecuted) {
breakCountdown.setTimeout(ADIS16507::START_UP_TIME);
breakCountdown.setTimeout(ADIS1650X::START_UP_TIME);
commandExecuted = true;
}
if(breakCountdown.hasTimedOut()) {
@ -54,20 +54,20 @@ void GyroADIS16507Handler::doStartUp() {
}
}
void GyroADIS16507Handler::doShutDown() {
void GyroADIS1650XHandler::doShutDown() {
commandExecuted = false;
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t GyroADIS16507Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
*id = ADIS16507::READ_SENSOR_DATA;
ReturnValue_t GyroADIS1650XHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
*id = ADIS1650X::READ_SENSOR_DATA;
return buildCommandFromCommand(*id, nullptr, 0);
}
ReturnValue_t GyroADIS16507Handler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t GyroADIS1650XHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
switch(internalState) {
case(InternalState::CONFIG): {
*id = ADIS16507::READ_OUT_CONFIG;
*id = ADIS1650X::READ_OUT_CONFIG;
buildCommandFromCommand(*id, nullptr, 0);
break;
}
@ -85,79 +85,79 @@ ReturnValue_t GyroADIS16507Handler::buildTransitionDeviceCommand(DeviceCommandId
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
ReturnValue_t GyroADIS1650XHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
switch(deviceCommand) {
case(ADIS16507::READ_OUT_CONFIG): {
this->rawPacketLen = ADIS16507::CONFIG_READOUT_SIZE;
case(ADIS1650X::READ_OUT_CONFIG): {
this->rawPacketLen = ADIS1650X::CONFIG_READOUT_SIZE;
uint8_t regList[5];
regList[0] = ADIS16507::DIAG_STAT_REG;
regList[1] = ADIS16507::FILTER_CTRL_REG;
regList[2] = ADIS16507::MSC_CTRL_REG;
regList[3] = ADIS16507::DEC_RATE_REG;
regList[4] = ADIS16507::PROD_ID_REG;
regList[0] = ADIS1650X::DIAG_STAT_REG;
regList[1] = ADIS1650X::FILTER_CTRL_REG;
regList[2] = ADIS1650X::MSC_CTRL_REG;
regList[3] = ADIS1650X::DEC_RATE_REG;
regList[4] = ADIS1650X::PROD_ID_REG;
prepareReadCommand(regList, sizeof(regList));
this->rawPacket = commandBuffer.data();
break;
}
case(ADIS16507::READ_SENSOR_DATA): {
case(ADIS1650X::READ_SENSOR_DATA): {
if(breakCountdown.isBusy()) {
// A glob command is pending and sensor data can't be read currently
return NO_REPLY_EXPECTED;
}
std::memcpy(commandBuffer.data(), ADIS16507::BURST_READ_ENABLE.data(),
ADIS16507::BURST_READ_ENABLE.size());
std::memcpy(commandBuffer.data(), ADIS1650X::BURST_READ_ENABLE.data(),
ADIS1650X::BURST_READ_ENABLE.size());
std::memset(commandBuffer.data() + 2, 0, 10 * 2);
this->rawPacketLen = ADIS16507::SENSOR_READOUT_SIZE;
this->rawPacketLen = ADIS1650X::SENSOR_READOUT_SIZE;
this->rawPacket = commandBuffer.data();
break;
}
case(ADIS16507::SELF_TEST_SENSORS): {
case(ADIS1650X::SELF_TEST_SENSORS): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::SENSOR_SELF_TEST, 0x00);
breakCountdown.setTimeout(ADIS16507::SELF_TEST_BREAK);
prepareWriteCommand(ADIS1650X::GLOB_CMD, ADIS1650X::GlobCmds::SENSOR_SELF_TEST, 0x00);
breakCountdown.setTimeout(ADIS1650X::SELF_TEST_BREAK);
break;
}
case(ADIS16507::SELF_TEST_MEMORY): {
case(ADIS1650X::SELF_TEST_MEMORY): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FLASH_MEMORY_TEST, 0x00);
breakCountdown.setTimeout(ADIS16507::FLASH_MEMORY_TEST_BREAK);
prepareWriteCommand(ADIS1650X::GLOB_CMD, ADIS1650X::GlobCmds::FLASH_MEMORY_TEST, 0x00);
breakCountdown.setTimeout(ADIS1650X::FLASH_MEMORY_TEST_BREAK);
break;
}
case(ADIS16507::UPDATE_NV_CONFIGURATION): {
case(ADIS1650X::UPDATE_NV_CONFIGURATION): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FLASH_MEMORY_UPDATE, 0x00);
breakCountdown.setTimeout(ADIS16507::FLASH_MEMORY_UPDATE_BREAK);
prepareWriteCommand(ADIS1650X::GLOB_CMD, ADIS1650X::GlobCmds::FLASH_MEMORY_UPDATE, 0x00);
breakCountdown.setTimeout(ADIS1650X::FLASH_MEMORY_UPDATE_BREAK);
break;
}
case(ADIS16507::RESET_SENSOR_CONFIGURATION): {
case(ADIS1650X::RESET_SENSOR_CONFIGURATION): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FACTORY_CALIBRATION, 0x00);
breakCountdown.setTimeout(ADIS16507::FACTORY_CALIBRATION_BREAK);
prepareWriteCommand(ADIS1650X::GLOB_CMD, ADIS1650X::GlobCmds::FACTORY_CALIBRATION, 0x00);
breakCountdown.setTimeout(ADIS1650X::FACTORY_CALIBRATION_BREAK);
break;
}
case(ADIS16507::SW_RESET): {
case(ADIS1650X::SW_RESET): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::SOFTWARE_RESET, 0x00);
breakCountdown.setTimeout(ADIS16507::SW_RESET_BREAK);
prepareWriteCommand(ADIS1650X::GLOB_CMD, ADIS1650X::GlobCmds::SOFTWARE_RESET, 0x00);
breakCountdown.setTimeout(ADIS1650X::SW_RESET_BREAK);
break;
}
case(ADIS16507::PRINT_CURRENT_CONFIGURATION): {
case(ADIS1650X::PRINT_CURRENT_CONFIGURATION): {
#if OBSW_VERBOSE_LEVEL >= 1
PoolReadGuard pg(&configDataset);
sif::info << "ADIS16507 Sensor configuration: DIAG_STAT: 0x" << std::hex << std::setw(4) <<
@ -172,18 +172,18 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
return HasReturnvaluesIF::RETURN_OK;
}
void GyroADIS16507Handler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(ADIS16507::READ_SENSOR_DATA, 1, &primaryDataset);
insertInCommandAndReplyMap(ADIS16507::READ_OUT_CONFIG, 1, &configDataset);
insertInCommandAndReplyMap(ADIS16507::SELF_TEST_SENSORS, 1);
insertInCommandAndReplyMap(ADIS16507::SELF_TEST_MEMORY, 1);
insertInCommandAndReplyMap(ADIS16507::UPDATE_NV_CONFIGURATION, 1);
insertInCommandAndReplyMap(ADIS16507::RESET_SENSOR_CONFIGURATION, 1);
insertInCommandAndReplyMap(ADIS16507::SW_RESET, 1);
insertInCommandAndReplyMap(ADIS16507::PRINT_CURRENT_CONFIGURATION, 1);
void GyroADIS1650XHandler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(ADIS1650X::READ_SENSOR_DATA, 1, &primaryDataset);
insertInCommandAndReplyMap(ADIS1650X::READ_OUT_CONFIG, 1, &configDataset);
insertInCommandAndReplyMap(ADIS1650X::SELF_TEST_SENSORS, 1);
insertInCommandAndReplyMap(ADIS1650X::SELF_TEST_MEMORY, 1);
insertInCommandAndReplyMap(ADIS1650X::UPDATE_NV_CONFIGURATION, 1);
insertInCommandAndReplyMap(ADIS1650X::RESET_SENSOR_CONFIGURATION, 1);
insertInCommandAndReplyMap(ADIS1650X::SW_RESET, 1);
insertInCommandAndReplyMap(ADIS1650X::PRINT_CURRENT_CONFIGURATION, 1);
}
ReturnValue_t GyroADIS16507Handler::scanForReply(const uint8_t *start, size_t remainingSize,
ReturnValue_t GyroADIS1650XHandler::scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) {
/* For SPI, the ID will always be the one of the last sent command. */
*foundId = this->getPendingCommand();
@ -192,16 +192,19 @@ ReturnValue_t GyroADIS16507Handler::scanForReply(const uint8_t *start, size_t re
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id,
ReturnValue_t GyroADIS1650XHandler::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) {
switch(id) {
case(ADIS16507::READ_OUT_CONFIG): {
case(ADIS1650X::READ_OUT_CONFIG): {
PoolReadGuard rg(&configDataset);
uint16_t readProdId = packet[10] << 8 | packet[11];
if (readProdId != ADIS16507::PROD_ID) {
if(((adisType == ADIS1650X::Type::ADIS16507) and
(readProdId != ADIS1650X::PROD_ID_16507)) or
((adisType == ADIS1650X::Type::ADIS16505) and
(readProdId != ADIS1650X::PROD_ID_16505))) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID!"
<< std::endl;
sif::warning << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID "
<< readProdId << std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
@ -215,7 +218,7 @@ ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id,
}
break;
}
case(ADIS16507::READ_SENSOR_DATA): {
case(ADIS1650X::READ_SENSOR_DATA): {
return handleSensorData(packet);
}
@ -224,7 +227,7 @@ ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id,
}
ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) {
ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) {
BurstModes burstMode = getBurstMode();
switch(burstMode) {
case(BurstModes::BURST_16_BURST_SEL_1):
@ -260,23 +263,32 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) {
PoolReadGuard pg(&primaryDataset);
int16_t angVelocXRaw = packet[4] << 8 | packet[5];
primaryDataset.angVelocX.value = static_cast<float>(angVelocXRaw) / INT16_MAX *
ADIS16507::GYRO_RANGE;
ADIS1650X::GYRO_RANGE;
int16_t angVelocYRaw = packet[6] << 8 | packet[7];
primaryDataset.angVelocY.value = static_cast<float>(angVelocYRaw) / INT16_MAX *
ADIS16507::GYRO_RANGE;
ADIS1650X::GYRO_RANGE;
int16_t angVelocZRaw = packet[8] << 8 | packet[9];
primaryDataset.angVelocZ.value = static_cast<float>(angVelocZRaw) / INT16_MAX *
ADIS16507::GYRO_RANGE;
ADIS1650X::GYRO_RANGE;
float accelScaling = 0;
if(adisType == ADIS1650X::Type::ADIS16507) {
accelScaling = ADIS1650X::ACCELEROMETER_RANGE_16507;
} else if(adisType == ADIS1650X::Type::ADIS16505) {
accelScaling = ADIS1650X::ACCELEROMETER_RANGE_16505;
} else {
sif::warning << "GyroADIS16507Handler::handleSensorData: "
"Unknown ADIS type" << std::endl;
}
int16_t accelXRaw = packet[10] << 8 | packet[11];
primaryDataset.accelX.value = static_cast<float>(accelXRaw) / INT16_MAX *
ADIS16507::ACCELEROMETER_RANGE;
accelScaling;
int16_t accelYRaw = packet[12] << 8 | packet[13];
primaryDataset.accelY.value = static_cast<float>(accelYRaw) / INT16_MAX *
ADIS16507::ACCELEROMETER_RANGE;
accelScaling;
int16_t accelZRaw = packet[14] << 8 | packet[15];
primaryDataset.accelZ.value = static_cast<float>(accelZRaw) / INT16_MAX *
ADIS16507::ACCELEROMETER_RANGE;
accelScaling;
int16_t temperatureRaw = packet[16] << 8 | packet[17];
primaryDataset.temperature.value = static_cast<float>(temperatureRaw) * 0.1;
@ -284,7 +296,7 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) {
primaryDataset.setValidity(true, true);
}
#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1
#if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1
if(debugDivider->checkAndIncrement()) {
sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl;
sif::info << "X: " << primaryDataset.angVelocX.value << std::endl;
@ -306,15 +318,15 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) {
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t GyroADIS16507Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
uint32_t GyroADIS1650XHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
return 5000;
}
void GyroADIS16507Handler::prepareWriteCommand(uint8_t startReg, uint8_t valueOne,
void GyroADIS1650XHandler::prepareWriteCommand(uint8_t startReg, uint8_t valueOne,
uint8_t valueTwo) {
uint8_t secondReg = startReg + 1;
startReg |= ADIS16507::WRITE_MASK;
secondReg |= ADIS16507::WRITE_MASK;
startReg |= ADIS1650X::WRITE_MASK;
secondReg |= ADIS1650X::WRITE_MASK;
commandBuffer[0] = startReg;
commandBuffer[1] = valueOne;
commandBuffer[2] = secondReg;
@ -323,7 +335,7 @@ void GyroADIS16507Handler::prepareWriteCommand(uint8_t startReg, uint8_t valueOn
this->rawPacket = commandBuffer.data();
}
void GyroADIS16507Handler::prepareReadCommand(uint8_t *regList, size_t len) {
void GyroADIS1650XHandler::prepareReadCommand(uint8_t *regList, size_t len) {
for(size_t idx = 0; idx < len; idx++) {
commandBuffer[idx * 2] = regList[idx];
commandBuffer[idx * 2 + 1] = 0x00;
@ -332,29 +344,29 @@ void GyroADIS16507Handler::prepareReadCommand(uint8_t *regList, size_t len) {
commandBuffer[len * 2 + 1] = 0x00;
}
ReturnValue_t GyroADIS16507Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
ReturnValue_t GyroADIS1650XHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(ADIS16507::ANG_VELOC_X, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS16507::ANG_VELOC_Y, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS16507::ANG_VELOC_Z, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS16507::ACCELERATION_X, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS16507::ACCELERATION_Y, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS16507::ACCELERATION_Z, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS16507::TEMPERATURE, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(ADIS1650X::ANG_VELOC_X, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS1650X::ANG_VELOC_Y, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS1650X::ANG_VELOC_Z, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS1650X::ACCELERATION_X, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS1650X::ACCELERATION_Y, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS1650X::ACCELERATION_Z, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(ADIS1650X::TEMPERATURE, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(ADIS16507::DIAG_STAT_REGISTER, new PoolEntry<uint16_t>());
localDataPoolMap.emplace(ADIS16507::FILTER_SETTINGS, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(ADIS16507::MSC_CTRL_REGISTER, new PoolEntry<uint16_t>());
localDataPoolMap.emplace(ADIS16507::DEC_RATE_REGISTER, new PoolEntry<uint16_t>());
localDataPoolMap.emplace(ADIS1650X::DIAG_STAT_REGISTER, new PoolEntry<uint16_t>());
localDataPoolMap.emplace(ADIS1650X::FILTER_SETTINGS, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(ADIS1650X::MSC_CTRL_REGISTER, new PoolEntry<uint16_t>());
localDataPoolMap.emplace(ADIS1650X::DEC_RATE_REGISTER, new PoolEntry<uint16_t>());
return HasReturnvaluesIF::RETURN_OK;
}
GyroADIS16507Handler::BurstModes GyroADIS16507Handler::getBurstMode() {
GyroADIS1650XHandler::BurstModes GyroADIS1650XHandler::getBurstMode() {
configDataset.mscCtrlReg.read();
uint16_t currentCtrlReg = configDataset.mscCtrlReg.value;
configDataset.mscCtrlReg.commit();
if((currentCtrlReg & ADIS16507::BURST_32_BIT) == ADIS16507::BURST_32_BIT) {
if((currentCtrlReg & ADIS16507::BURST_SEL_BIT) == ADIS16507::BURST_SEL_BIT) {
if((currentCtrlReg & ADIS1650X::BURST_32_BIT) == ADIS1650X::BURST_32_BIT) {
if((currentCtrlReg & ADIS1650X::BURST_SEL_BIT) == ADIS1650X::BURST_SEL_BIT) {
return BurstModes::BURST_32_BURST_SEL_1;
}
else {
@ -362,7 +374,7 @@ GyroADIS16507Handler::BurstModes GyroADIS16507Handler::getBurstMode() {
}
}
else {
if((currentCtrlReg & ADIS16507::BURST_SEL_BIT) == ADIS16507::BURST_SEL_BIT) {
if((currentCtrlReg & ADIS1650X::BURST_SEL_BIT) == ADIS1650X::BURST_SEL_BIT) {
return BurstModes::BURST_16_BURST_SEL_1;
}
else {
@ -371,11 +383,11 @@ GyroADIS16507Handler::BurstModes GyroADIS16507Handler::getBurstMode() {
}
}
#if OBSW_ADIS16507_LINUX_COM_IF == 1
#if OBSW_ADIS1650X_LINUX_COM_IF == 1
ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *cookie,
ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *cookie,
const uint8_t *sendData, size_t sendLen, void *args) {
GyroADIS16507Handler* handler = reinterpret_cast<GyroADIS16507Handler*>(args);
GyroADIS1650XHandler* handler = reinterpret_cast<GyroADIS1650XHandler*>(args);
if(handler == nullptr) {
sif::error << "GyroADIS16507Handler::spiSendCallback: Passed handler pointer is invalid!"
<< std::endl;
@ -383,10 +395,10 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *
}
DeviceCommandId_t currentCommand = handler->getPendingCommand();
switch(currentCommand) {
case(ADIS16507::READ_SENSOR_DATA): {
case(ADIS1650X::READ_SENSOR_DATA): {
return comIf->performRegularSendOperation(cookie, sendData, sendLen);
}
case(ADIS16507::READ_OUT_CONFIG):
case(ADIS1650X::READ_OUT_CONFIG):
default: {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
int retval = 0;
@ -451,7 +463,7 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *
idx += 2;
if(idx < sendLen) {
usleep(ADIS16507::STALL_TIME_MICROSECONDS);
usleep(ADIS1650X::STALL_TIME_MICROSECONDS);
}
spi_ioc_transfer* transferStruct = cookie->getTransferStructHandle();
transferStruct->tx_buf += 2;
@ -466,4 +478,4 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *
return HasReturnvaluesIF::RETURN_OK;
}
#endif /* OBSW_ADIS16507_LINUX_COM_IF == 1 */
#endif /* OBSW_ADIS1650X_LINUX_COM_IF == 1 */

View File

@ -3,7 +3,7 @@
#include "OBSWConfig.h"
#include "FSFWConfig.h"
#include "devicedefinitions/GyroADIS16507Definitions.h"
#include "devicedefinitions/GyroADIS1650XDefinitions.h"
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
@ -19,10 +19,10 @@ class SpiCookie;
* Flight manual:
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/ADIS16507_Gyro
*/
class GyroADIS16507Handler: public DeviceHandlerBase {
class GyroADIS1650XHandler: public DeviceHandlerBase {
public:
GyroADIS16507Handler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF * comCookie);
GyroADIS1650XHandler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie, ADIS1650X::Type type);
/* DeviceHandlerBase abstract function implementation */
void doStartUp() override;
@ -42,7 +42,7 @@ public:
private:
std::array<uint8_t, 32> commandBuffer;
ADIS1650X::Type adisType;
AdisGyroPrimaryDataset primaryDataset;
AdisGyroConfigDataset configDataset;
@ -71,7 +71,7 @@ private:
const uint8_t *sendData, size_t sendLen, void* args);
#endif
#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1
#if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1
PeriodicOperationDivider* debugDivider;
#endif
Countdown breakCountdown;

View File

@ -197,7 +197,7 @@ ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize
ReturnValue_t RwHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
/** Check result code */
if (*(packet + 1) == RwDefinitions::ERROR) {
if (*(packet + 1) == RwDefinitions::STATE_ERROR) {
sif::error << "RwHandler::interpretDeviceReply: Command execution failed. Command id: "
<< id << std::endl;
return EXECUTION_FAILED;
@ -369,7 +369,7 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
offset += 1;
statusSet.clcMode = *(packet + offset);
if (statusSet.state == RwDefinitions::ERROR) {
if (statusSet.state == RwDefinitions::STATE_ERROR) {
/**
* This requires the commanding of the init reaction wheel controller command to recover
* form error state which must be handled by the FDIR instance.

View File

@ -46,6 +46,8 @@ public:
static const ReturnValue_t MISSING_END_SIGN = MAKE_RETURN_CODE(0xB4);
//! [EXPORT] : [COMMENT] Reaction wheel only responds with empty frames.
static const ReturnValue_t NO_REPLY = MAKE_RETURN_CODE(0xB5);
//! [EXPORT] : [COMMENT] Expected a start marker as first byte
static const ReturnValue_t NO_START_MARKER = MAKE_RETURN_CODE(0xB6);
protected:
void doStartUp() override;

View File

@ -6,17 +6,24 @@
#include <cstddef>
namespace ADIS16507 {
namespace ADIS1650X {
enum class Type {
ADIS16505,
ADIS16507
};
static constexpr size_t MAXIMUM_REPLY_SIZE = 64;
static constexpr uint8_t WRITE_MASK = 0b1000'0000;
static constexpr uint32_t GYRO_RANGE = 125;
static constexpr uint32_t ACCELEROMETER_RANGE = 392;
static constexpr uint32_t ACCELEROMETER_RANGE_16507 = 392;
static constexpr float ACCELEROMETER_RANGE_16505 = 78.4;
static constexpr uint32_t STALL_TIME_MICROSECONDS = 16;
static constexpr uint16_t PROD_ID = 16507;
static constexpr uint16_t PROD_ID_16507 = 16507;
static constexpr uint16_t PROD_ID_16505 = 16505;
static constexpr std::array<uint8_t, 2> BURST_READ_ENABLE = {0x68, 0x00};
@ -95,31 +102,31 @@ public:
/** Constructor for data users like controllers */
AdisGyroPrimaryDataset(object_id_t adisId):
StaticLocalDataSet(sid_t(adisId, ADIS16507::ADIS_DATASET_ID)) {
StaticLocalDataSet(sid_t(adisId, ADIS1650X::ADIS_DATASET_ID)) {
setAllVariablesReadOnly();
}
/* Angular velocities in degrees per second (DPS) */
lp_var_t<double> angVelocX = lp_var_t<double>(sid.objectId,
ADIS16507::ANG_VELOC_X, this);
ADIS1650X::ANG_VELOC_X, this);
lp_var_t<double> angVelocY = lp_var_t<double>(sid.objectId,
ADIS16507::ANG_VELOC_Y, this);
ADIS1650X::ANG_VELOC_Y, this);
lp_var_t<double> angVelocZ = lp_var_t<double>(sid.objectId,
ADIS16507::ANG_VELOC_Z, this);
ADIS1650X::ANG_VELOC_Z, this);
lp_var_t<double> accelX = lp_var_t<double>(sid.objectId,
ADIS16507::ACCELERATION_X, this);
ADIS1650X::ACCELERATION_X, this);
lp_var_t<double> accelY = lp_var_t<double>(sid.objectId,
ADIS16507::ACCELERATION_Y, this);
ADIS1650X::ACCELERATION_Y, this);
lp_var_t<double> accelZ = lp_var_t<double>(sid.objectId,
ADIS16507::ACCELERATION_Z, this);
ADIS1650X::ACCELERATION_Z, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId,
ADIS16507::TEMPERATURE, this);
ADIS1650X::TEMPERATURE, this);
private:
friend class GyroADIS16507Handler;
friend class GyroADIS1650XHandler;
/** Constructor for the data creator */
AdisGyroPrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, ADIS16507::ADIS_DATASET_ID) {}
StaticLocalDataSet(hkOwner, ADIS1650X::ADIS_DATASET_ID) {}
};
class AdisGyroConfigDataset: public StaticLocalDataSet<5> {
@ -127,20 +134,20 @@ public:
/** Constructor for data users like controllers */
AdisGyroConfigDataset(object_id_t adisId):
StaticLocalDataSet(sid_t(adisId, ADIS16507::ADIS_CFG_DATASET_ID)) {
StaticLocalDataSet(sid_t(adisId, ADIS1650X::ADIS_CFG_DATASET_ID)) {
setAllVariablesReadOnly();
}
lp_var_t<uint16_t> diagStatReg = lp_var_t<uint16_t>(sid.objectId,
ADIS16507::DIAG_STAT_REGISTER);
lp_var_t<uint8_t> filterSetting = lp_var_t<uint8_t>(sid.objectId, ADIS16507::FILTER_SETTINGS);
lp_var_t<uint16_t> mscCtrlReg = lp_var_t<uint16_t>(sid.objectId, ADIS16507::MSC_CTRL_REGISTER);
lp_var_t<uint16_t> decRateReg = lp_var_t<uint16_t>(sid.objectId, ADIS16507::DEC_RATE_REGISTER);
ADIS1650X::DIAG_STAT_REGISTER);
lp_var_t<uint8_t> filterSetting = lp_var_t<uint8_t>(sid.objectId, ADIS1650X::FILTER_SETTINGS);
lp_var_t<uint16_t> mscCtrlReg = lp_var_t<uint16_t>(sid.objectId, ADIS1650X::MSC_CTRL_REGISTER);
lp_var_t<uint16_t> decRateReg = lp_var_t<uint16_t>(sid.objectId, ADIS1650X::DEC_RATE_REGISTER);
private:
friend class GyroADIS16507Handler;
friend class GyroADIS1650XHandler;
/** Constructor for the data creator */
AdisGyroConfigDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, ADIS16507::ADIS_CFG_DATASET_ID) {}
StaticLocalDataSet(hkOwner, ADIS1650X::ADIS_CFG_DATASET_ID) {}
};
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ */

View File

@ -46,7 +46,7 @@ enum PoolIds: lp_id_t {
};
enum States: uint8_t {
ERROR,
STATE_ERROR,
IDLE,
COASTING,
RUNNING_SPEED_STABLE,