fixed merge conflicts
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
add_subdirectory(csp)
|
||||
add_subdirectory(uart)
|
||||
add_subdirectory(utility)
|
||||
add_subdirectory(boardtest)
|
||||
add_subdirectory(devices)
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(obc)
|
@ -1,15 +1,16 @@
|
||||
#include "LibgpiodTest.h"
|
||||
|
||||
#include <fsfwconfig/devices/gpioIds.h>
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
|
||||
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
|
||||
GpioCookie* gpioCookie):
|
||||
TestTask(objectId) {
|
||||
|
||||
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
|
||||
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioIfobjectId);
|
||||
if (gpioInterface == nullptr) {
|
||||
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "SpiTestClass.h"
|
||||
|
||||
#include <fsfwconfig/devices/gpioIds.h>
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
|
@ -55,6 +55,15 @@ private:
|
||||
uint8_t gyro2L3gd20ChipSelect = 3;
|
||||
uint8_t mgm2Lis3mdlChipSelect = 0;
|
||||
uint8_t mgm3Rm3100ChipSelect = 23;
|
||||
#else
|
||||
uint8_t mgm0Lis3mdlChipSelect = 0;
|
||||
uint8_t mgm1Rm3100ChipSelect = 0;
|
||||
uint8_t gyro0AdisResetLine = 0;
|
||||
uint8_t gyro0AdisChipSelect = 0;
|
||||
uint8_t gyro1L3gd20ChipSelect = 0;
|
||||
uint8_t gyro2L3gd20ChipSelect = 0;
|
||||
uint8_t mgm2Lis3mdlChipSelect = 0;
|
||||
uint8_t mgm3Rm3100ChipSelect = 0;
|
||||
#endif
|
||||
|
||||
static constexpr uint8_t STM_READ_MASK = 0b1000'0000;
|
||||
|
@ -1,8 +1,114 @@
|
||||
#include <linux/boardtest/UartTestClass.h>
|
||||
#include "UartTestClass.h"
|
||||
#if defined(RASPBERRY_PI)
|
||||
#include "rpiConfig.h"
|
||||
#elif defined(XIPHOS_Q7S)
|
||||
#include "q7sConfig.h"
|
||||
#endif
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
#include "lwgps/lwgps.h"
|
||||
|
||||
#include <fcntl.h> // Contains file controls like O_RDWR
|
||||
#include <errno.h> // Error integer and strerror() function
|
||||
#include <unistd.h> // write(), read(), close()
|
||||
|
||||
#define GPS_REPLY_WIRETAPPING 0
|
||||
|
||||
UartTestClass::UartTestClass(object_id_t objectId): TestTask(objectId) {
|
||||
}
|
||||
|
||||
ReturnValue_t UartTestClass::performPeriodicAction() {
|
||||
ReturnValue_t UartTestClass::initialize() {
|
||||
#if RPI_TEST_GPS_DEVICE == 1
|
||||
int result = lwgps_init(&gpsData);
|
||||
if(result == 0) {
|
||||
sif::warning << "lwgps_init error: " << result << std::endl;
|
||||
}
|
||||
|
||||
/* Get file descriptor */
|
||||
serialPort = open("/dev/serial0", O_RDWR);
|
||||
if(serialPort < 0) {
|
||||
sif::warning << "open call failed with error [" << errno << ", " << strerror(errno)
|
||||
<< std::endl;
|
||||
}
|
||||
/* Setting up UART parameters */
|
||||
tty.c_cflag &= ~PARENB; // Clear parity bit
|
||||
tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
|
||||
tty.c_cflag &= ~CSIZE; // Clear all the size bits
|
||||
tty.c_cflag |= CS8; // 8 bits per byte
|
||||
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
|
||||
tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1)
|
||||
// Use canonical mode for GPS device
|
||||
tty.c_lflag |= ICANON;
|
||||
tty.c_lflag &= ~ECHO; // Disable echo
|
||||
tty.c_lflag &= ~ECHOE; // Disable erasure
|
||||
tty.c_lflag &= ~ECHONL; // Disable new-line echo
|
||||
tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP
|
||||
tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl
|
||||
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL); // Disable any special handling of received bytes
|
||||
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
||||
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
||||
|
||||
// Non-blocking mode
|
||||
tty.c_cc[VTIME] = 0;
|
||||
tty.c_cc[VMIN] = 0;
|
||||
|
||||
cfsetispeed(&tty, B9600);
|
||||
cfsetospeed(&tty, B9600);
|
||||
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
||||
sif::warning << "tcsetattr call failed with error [" << errno << ", " <<
|
||||
strerror(errno) << std::endl;;
|
||||
}
|
||||
// Flush received and unread data. Those are old NMEA strings which are not relevant anymore
|
||||
tcflush(serialPort, TCIFLUSH);
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t UartTestClass::performOneShotAction() {
|
||||
#if RPI_TEST_GPS_DEVICE == 1
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t UartTestClass::performPeriodicAction() {
|
||||
#if RPI_TEST_GPS_DEVICE == 1
|
||||
int bytesRead = 0;
|
||||
do {
|
||||
bytesRead = read(serialPort,
|
||||
reinterpret_cast<void*>(recBuf.data()),
|
||||
static_cast<unsigned int>(recBuf.size()));
|
||||
if(bytesRead < 0) {
|
||||
sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" <<
|
||||
errno << ", " << strerror(errno) << "]" << std::endl;
|
||||
break;
|
||||
}
|
||||
else if(bytesRead >= static_cast<int>(recBuf.size())) {
|
||||
sif::debug << "UartTestClass::performPeriodicAction: "
|
||||
"recv buffer might not be large enough" << std::endl;
|
||||
}
|
||||
else if(bytesRead > 0) {
|
||||
// pass data to lwgps for processing
|
||||
#if GPS_REPLY_WIRETAPPING == 1
|
||||
sif::info << recBuf.data() << std::endl;
|
||||
#endif
|
||||
int result = lwgps_process(&gpsData, recBuf.data(), bytesRead);
|
||||
if(result == 0) {
|
||||
sif::warning << "UartTestClass::performPeriodicAction: lwgps_process error"
|
||||
<< std::endl;
|
||||
}
|
||||
recvCnt++;
|
||||
if(recvCnt == 6) {
|
||||
recvCnt = 0;
|
||||
sif::info << "GPS Data" << std::endl;
|
||||
// Print messages
|
||||
printf("Valid status: %d\n", gpsData.is_valid);
|
||||
printf("Latitude: %f degrees\n", gpsData.latitude);
|
||||
printf("Longitude: %f degrees\n", gpsData.longitude);
|
||||
printf("Altitude: %f meters\n", gpsData.altitude);
|
||||
}
|
||||
}
|
||||
} while(bytesRead > 0);
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -1,15 +1,27 @@
|
||||
#ifndef LINUX_BOARDTEST_UARTTESTCLASS_H_
|
||||
#define LINUX_BOARDTEST_UARTTESTCLASS_H_
|
||||
|
||||
#include <test/testtasks/TestTask.h>
|
||||
#include "test/testtasks/TestTask.h"
|
||||
#include "lwgps/lwgps.h"
|
||||
|
||||
#include <array>
|
||||
#include <termios.h> // Contains POSIX terminal control definitions
|
||||
|
||||
class UartTestClass: public TestTask {
|
||||
public:
|
||||
UartTestClass(object_id_t objectId);
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
ReturnValue_t performOneShotAction() override;
|
||||
ReturnValue_t performPeriodicAction() override;
|
||||
private:
|
||||
|
||||
lwgps_t gpsData = {};
|
||||
struct termios tty = {};
|
||||
int serialPort = 0;
|
||||
std::array<uint8_t, 512> recBuf;
|
||||
uint8_t recvCnt = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */
|
||||
|
@ -82,7 +82,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF *cookie,
|
||||
|
||||
/* Extract csp port and bytes to query from command buffer */
|
||||
uint8_t cspPort;
|
||||
uint16_t querySize;
|
||||
uint16_t querySize = 0;
|
||||
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
|
5
linux/devices/CMakeLists.txt
Normal file
5
linux/devices/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
HeaterHandler.cpp
|
||||
SolarArrayDeploymentHandler.cpp
|
||||
SusHandler.cpp
|
||||
)
|
373
linux/devices/HeaterHandler.cpp
Normal file
373
linux/devices/HeaterHandler.cpp
Normal file
@ -0,0 +1,373 @@
|
||||
#include "HeaterHandler.h"
|
||||
#include "devices/gpioIds.h"
|
||||
#include "devices/powerSwitcherList.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||
|
||||
HeaterHandler::HeaterHandler(object_id_t setObjectId_, object_id_t gpioDriverId_,
|
||||
CookieIF * gpioCookie_, object_id_t mainLineSwitcherObjectId_, uint8_t mainLineSwitch_) :
|
||||
SystemObject(setObjectId_), gpioDriverId(gpioDriverId_), gpioCookie(gpioCookie_),
|
||||
mainLineSwitcherObjectId(mainLineSwitcherObjectId_), mainLineSwitch(mainLineSwitch_),
|
||||
actionHelper(this, nullptr) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
HeaterHandler::~HeaterHandler() {
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::performOperation(uint8_t operationCode) {
|
||||
|
||||
if (operationCode == DeviceHandlerIF::PERFORM_OPERATION) {
|
||||
readCommandQueue();
|
||||
handleActiveCommands();
|
||||
return RETURN_OK;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::initialize() {
|
||||
ReturnValue_t result = SystemObject::initialize();
|
||||
if (result != RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
result = initializeHeaterMap();
|
||||
if (result != RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioDriverId);
|
||||
if (gpioInterface == nullptr) {
|
||||
sif::error << "HeaterHandler::initialize: Invalid Gpio interface." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
result = gpioInterface->addGpios(dynamic_cast<GpioCookie*>(gpioCookie));
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "HeaterHandler::initialize: Failed to initialize Gpio interface" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if (IPCStore == nullptr) {
|
||||
sif::error << "HeaterHandler::initialize: IPC store not set up in factory." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
if(mainLineSwitcherObjectId != objects::NO_OBJECT) {
|
||||
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
|
||||
if (mainLineSwitcher == nullptr) {
|
||||
sif::error
|
||||
<< "HeaterHandler::initialize: Failed to get main line switcher. Make sure "
|
||||
<< "main line switcher object is initialized." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
result = actionHelper.initialize(commandQueue);
|
||||
if (result != RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::initializeHeaterMap(){
|
||||
HeaterCommandInfo_t heaterCommandInfo;
|
||||
for(switchNr_t switchNr = 0; switchNr < heaterSwitches::NUMBER_OF_SWITCHES; switchNr++) {
|
||||
std::pair status = heaterMap.emplace(switchNr, heaterCommandInfo);
|
||||
if (status.second == false) {
|
||||
sif::error << "HeaterHandler::initializeHeaterMap: Failed to initialize heater map"
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void HeaterHandler::setInitialSwitchStates() {
|
||||
for (switchNr_t switchNr = 0; switchNr < heaterSwitches::NUMBER_OF_SWITCHES; switchNr++) {
|
||||
switchStates[switchNr] = OFF;
|
||||
}
|
||||
}
|
||||
|
||||
void HeaterHandler::readCommandQueue() {
|
||||
CommandMessage command;
|
||||
ReturnValue_t result = commandQueue->receiveMessage(&command);
|
||||
if (result != RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = actionHelper.handleActionMessage(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
||||
ReturnValue_t result;
|
||||
if (actionId != SWITCH_HEATER) {
|
||||
result = COMMAND_NOT_SUPPORTED;
|
||||
} else {
|
||||
switchNr_t switchNr = *data;
|
||||
HeaterMapIter heaterMapIter = heaterMap.find(switchNr);
|
||||
if (heaterMapIter != heaterMap.end()) {
|
||||
if (heaterMapIter->second.active) {
|
||||
return COMMAND_ALREADY_WAITING;
|
||||
}
|
||||
heaterMapIter->second.action = *(data + 1);
|
||||
heaterMapIter->second.active = true;
|
||||
heaterMapIter->second.replyQueue = commandedBy;
|
||||
}
|
||||
else {
|
||||
sif::error << "HeaterHandler::executeAction: Invalid switchNr" << std::endl;
|
||||
return INVALID_SWITCH_NR;
|
||||
}
|
||||
result = RETURN_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void HeaterHandler::sendSwitchCommand(uint8_t switchNr,
|
||||
ReturnValue_t onOff) const {
|
||||
|
||||
ReturnValue_t result;
|
||||
store_address_t storeAddress;
|
||||
uint8_t commandData[2];
|
||||
|
||||
switch(onOff) {
|
||||
case PowerSwitchIF::SWITCH_ON:
|
||||
commandData[0] = switchNr;
|
||||
commandData[1] = SET_SWITCH_ON;
|
||||
break;
|
||||
case PowerSwitchIF::SWITCH_OFF:
|
||||
commandData[0] = switchNr;
|
||||
commandData[1] = SET_SWITCH_OFF;
|
||||
break;
|
||||
default:
|
||||
sif::error << "HeaterHandler::sendSwitchCommand: Invalid switch request"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
result = IPCStore->addData(&storeAddress, commandData, sizeof(commandData));
|
||||
if (result == RETURN_OK) {
|
||||
CommandMessage message;
|
||||
ActionMessage::setCommand(&message, SWITCH_HEATER, storeAddress);
|
||||
/* Send heater command to own command queue */
|
||||
result = commandQueue->sendMessage(commandQueue->getId(), &message, 0);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "HeaterHandler::sendSwitchCommand: Failed to send switch"
|
||||
<< "message" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HeaterHandler::handleActiveCommands(){
|
||||
|
||||
HeaterMapIter heaterMapIter = heaterMap.begin();
|
||||
for (; heaterMapIter != heaterMap.end(); heaterMapIter++) {
|
||||
if (heaterMapIter->second.active) {
|
||||
switch(heaterMapIter->second.action) {
|
||||
case SET_SWITCH_ON:
|
||||
handleSwitchOnCommand(heaterMapIter);
|
||||
break;
|
||||
case SET_SWITCH_OFF:
|
||||
handleSwitchOffCommand(heaterMapIter);
|
||||
break;
|
||||
default:
|
||||
sif::error << "HeaterHandler::handleActiveCommands: Invalid action commanded"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
switchNr_t switchNr;
|
||||
|
||||
/* Check if command waits for main switch being set on and whether the timeout has expired */
|
||||
if (heaterMapIter->second.waitMainSwitchOn
|
||||
&& heaterMapIter->second.mainSwitchCountdown.hasTimedOut()) {
|
||||
//TODO - This requires the initiation of an FDIR procedure
|
||||
triggerEvent(MAIN_SWITCH_TIMEOUT);
|
||||
sif::error << "HeaterHandler::handleSwitchOnCommand: Main switch setting on timeout"
|
||||
<< std::endl;
|
||||
heaterMapIter->second.active = false;
|
||||
heaterMapIter->second.waitMainSwitchOn = false;
|
||||
if (heaterMapIter->second.replyQueue != commandQueue->getId()) {
|
||||
actionHelper.finish(false, heaterMapIter->second.replyQueue,
|
||||
heaterMapIter->second.action, MAIN_SWITCH_SET_TIMEOUT );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switchNr = heaterMapIter->first;
|
||||
/* Check state of main line switch */
|
||||
ReturnValue_t mainSwitchState = mainLineSwitcher->getSwitchState(mainLineSwitch);
|
||||
if (mainSwitchState == PowerSwitchIF::SWITCH_ON) {
|
||||
if (!checkSwitchState(switchNr)) {
|
||||
gpioId_t gpioId = getGpioIdFromSwitchNr(switchNr);
|
||||
result = gpioInterface->pullHigh(gpioId);
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "HeaterHandler::handleSwitchOnCommand: Failed to pull gpio with id "
|
||||
<< gpioId << " high" << std::endl;
|
||||
triggerEvent(GPIO_PULL_HIGH_FAILED, result);
|
||||
}
|
||||
else {
|
||||
switchStates[switchNr] = ON;
|
||||
}
|
||||
}
|
||||
else {
|
||||
triggerEvent(SWITCH_ALREADY_ON, switchNr);
|
||||
}
|
||||
/* There is no need to send action finish replies if the sender was the
|
||||
* HeaterHandler itself. */
|
||||
if (heaterMapIter->second.replyQueue != commandQueue->getId()) {
|
||||
if(result == RETURN_OK) {
|
||||
actionHelper.finish(true, heaterMapIter->second.replyQueue,
|
||||
heaterMapIter->second.action, result);
|
||||
}
|
||||
else {
|
||||
actionHelper.finish(false, heaterMapIter->second.replyQueue,
|
||||
heaterMapIter->second.action, result);
|
||||
}
|
||||
|
||||
}
|
||||
heaterMapIter->second.active = false;
|
||||
heaterMapIter->second.waitMainSwitchOn = false;
|
||||
}
|
||||
else if (mainSwitchState == PowerSwitchIF::SWITCH_OFF
|
||||
&& heaterMapIter->second.waitMainSwitchOn) {
|
||||
/* Just waiting for the main switch being set on */
|
||||
return;
|
||||
}
|
||||
else if (mainSwitchState == PowerSwitchIF::SWITCH_OFF) {
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch,
|
||||
PowerSwitchIF::SWITCH_ON);
|
||||
heaterMapIter->second.mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
||||
heaterMapIter->second.waitMainSwitchOn = true;
|
||||
}
|
||||
else {
|
||||
sif::debug << "HeaterHandler::handleActiveCommands: Failed to get state of"
|
||||
<< " main line switch" << std::endl;
|
||||
if (heaterMapIter->second.replyQueue != commandQueue->getId()) {
|
||||
actionHelper.finish(false, heaterMapIter->second.replyQueue,
|
||||
heaterMapIter->second.action, mainSwitchState);
|
||||
}
|
||||
heaterMapIter->second.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
void HeaterHandler::handleSwitchOffCommand(HeaterMapIter heaterMapIter) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
switchNr_t switchNr = heaterMapIter->first;
|
||||
/* Check whether switch is already off */
|
||||
if (checkSwitchState(switchNr)) {
|
||||
gpioId_t gpioId = getGpioIdFromSwitchNr(switchNr);
|
||||
result = gpioInterface->pullLow(gpioId);
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "HeaterHandler::handleSwitchOffCommand: Failed to pull gpio with id"
|
||||
<< gpioId << " low" << std::endl;
|
||||
triggerEvent(GPIO_PULL_LOW_FAILED, result);
|
||||
}
|
||||
else {
|
||||
switchStates[switchNr] = OFF;
|
||||
/* When all switches are off, also main line switch will be turned off */
|
||||
if (allSwitchesOff()) {
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
sif::info << "HeaterHandler::handleSwitchOffCommand: Switch already off" << std::endl;
|
||||
triggerEvent(SWITCH_ALREADY_OFF, switchNr);
|
||||
}
|
||||
if (heaterMapIter->second.replyQueue != NO_COMMANDER) {
|
||||
/* Report back switch command reply if necessary */
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
actionHelper.finish(true, heaterMapIter->second.replyQueue,
|
||||
heaterMapIter->second.action, result);
|
||||
}
|
||||
else {
|
||||
actionHelper.finish(false, heaterMapIter->second.replyQueue,
|
||||
heaterMapIter->second.action, result);
|
||||
}
|
||||
}
|
||||
heaterMapIter->second.active = false;
|
||||
}
|
||||
|
||||
bool HeaterHandler::checkSwitchState(int switchNr) {
|
||||
return switchStates[switchNr];
|
||||
}
|
||||
|
||||
bool HeaterHandler::allSwitchesOff() {
|
||||
bool allSwitchesOrd = false;
|
||||
/* Or all switches. As soon one switch is on, allSwitchesOrd will be true */
|
||||
for (switchNr_t switchNr = 0; switchNr < heaterSwitches::NUMBER_OF_SWITCHES; switchNr++) {
|
||||
allSwitchesOrd = allSwitchesOrd || switchStates[switchNr];
|
||||
}
|
||||
return !allSwitchesOrd;
|
||||
}
|
||||
|
||||
gpioId_t HeaterHandler::getGpioIdFromSwitchNr(int switchNr) {
|
||||
gpioId_t gpioId = 0xFFFF;
|
||||
switch(switchNr) {
|
||||
case heaterSwitches::HEATER_0:
|
||||
gpioId = gpioIds::HEATER_0;
|
||||
break;
|
||||
case heaterSwitches::HEATER_1:
|
||||
gpioId = gpioIds::HEATER_1;
|
||||
break;
|
||||
case heaterSwitches::HEATER_2:
|
||||
gpioId = gpioIds::HEATER_2;
|
||||
break;
|
||||
case heaterSwitches::HEATER_3:
|
||||
gpioId = gpioIds::HEATER_3;
|
||||
break;
|
||||
case heaterSwitches::HEATER_4:
|
||||
gpioId = gpioIds::HEATER_4;
|
||||
break;
|
||||
case heaterSwitches::HEATER_5:
|
||||
gpioId = gpioIds::HEATER_5;
|
||||
break;
|
||||
case heaterSwitches::HEATER_6:
|
||||
gpioId = gpioIds::HEATER_6;
|
||||
break;
|
||||
case heaterSwitches::HEATER_7:
|
||||
gpioId = gpioIds::HEATER_7;
|
||||
break;
|
||||
default:
|
||||
sif::error << "HeaterHandler::getGpioIdFromSwitchNr: Unknown heater switch number"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
return gpioId;
|
||||
}
|
||||
|
||||
MessageQueueId_t HeaterHandler::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
void HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) const {
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::getSwitchState( uint8_t switchNr ) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::getFuseState( uint8_t fuseNr ) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t HeaterHandler::getSwitchDelayMs(void) const {
|
||||
return 0;
|
||||
}
|
178
linux/devices/HeaterHandler.h
Normal file
178
linux/devices/HeaterHandler.h
Normal file
@ -0,0 +1,178 @@
|
||||
#ifndef MISSION_DEVICES_HEATERHANDLER_H_
|
||||
#define MISSION_DEVICES_HEATERHANDLER_H_
|
||||
|
||||
#include "devices/heaterSwitcherList.h"
|
||||
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/action/HasActionsIF.h>
|
||||
#include <fsfw/power/PowerSwitchIF.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||
#include <unordered_map>
|
||||
|
||||
/**
|
||||
* @brief This class intends the control of heaters.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class HeaterHandler: public ExecutableObjectIF,
|
||||
public PowerSwitchIF,
|
||||
public SystemObject,
|
||||
public HasActionsIF {
|
||||
public:
|
||||
|
||||
/** Device command IDs */
|
||||
static const DeviceCommandId_t SWITCH_HEATER = 0x0;
|
||||
|
||||
HeaterHandler(object_id_t setObjectId, object_id_t gpioDriverId, CookieIF * gpioCookie,
|
||||
object_id_t mainLineSwitcherObjectId, uint8_t mainLineSwitch);
|
||||
|
||||
virtual ~HeaterHandler();
|
||||
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
|
||||
virtual void sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const override;
|
||||
virtual void sendFuseOnCommand(uint8_t fuseNr) const override;
|
||||
/**
|
||||
* @brief This function will be called from the Heater object to check
|
||||
* the current switch state.
|
||||
*/
|
||||
virtual ReturnValue_t getSwitchState( uint8_t switchNr ) const override;
|
||||
virtual ReturnValue_t getFuseState( uint8_t fuseNr ) const override;
|
||||
virtual uint32_t getSwitchDelayMs(void) const override;
|
||||
|
||||
virtual MessageQueueId_t getCommandQueue() const override;
|
||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
virtual ReturnValue_t initialize() override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::HEATER_HANDLER;
|
||||
|
||||
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA1);
|
||||
static const ReturnValue_t INIT_FAILED = MAKE_RETURN_CODE(0xA2);
|
||||
static const ReturnValue_t INVALID_SWITCH_NR = MAKE_RETURN_CODE(0xA3);
|
||||
static const ReturnValue_t MAIN_SWITCH_SET_TIMEOUT = MAKE_RETURN_CODE(0xA4);
|
||||
static const ReturnValue_t COMMAND_ALREADY_WAITING = MAKE_RETURN_CODE(0xA5);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::HEATER_HANDLER;
|
||||
static const Event GPIO_PULL_HIGH_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||
static const Event GPIO_PULL_LOW_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||
static const Event SWITCH_ALREADY_ON = MAKE_EVENT(2, severity::LOW);
|
||||
static const Event SWITCH_ALREADY_OFF = MAKE_EVENT(3, severity::LOW);
|
||||
static const Event MAIN_SWITCH_TIMEOUT = MAKE_EVENT(4, severity::LOW);
|
||||
|
||||
static const MessageQueueId_t NO_COMMANDER = 0;
|
||||
|
||||
enum SwitchState : bool {
|
||||
ON = true,
|
||||
OFF = false
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Struct holding information about a heater command to execute.
|
||||
*
|
||||
* @param action The action to perform.
|
||||
* @param replyQueue The queue of the commander to which status replies
|
||||
* will be sent.
|
||||
* @param active True if command is waiting for execution, otherwise false.
|
||||
* @param waitSwitchOn True if the command is waiting for the main switch being set on.
|
||||
* @param mainSwitchCountdown Sets timeout to wait for main switch being set on.
|
||||
*/
|
||||
typedef struct HeaterCommandInfo {
|
||||
uint8_t action;
|
||||
MessageQueueId_t replyQueue;
|
||||
bool active = false;
|
||||
bool waitMainSwitchOn = false;
|
||||
Countdown mainSwitchCountdown;
|
||||
} HeaterCommandInfo_t;
|
||||
|
||||
enum SwitchAction {
|
||||
SET_SWITCH_OFF,
|
||||
SET_SWITCH_ON
|
||||
};
|
||||
|
||||
using switchNr_t = uint8_t;
|
||||
using HeaterMap = std::unordered_map<switchNr_t, HeaterCommandInfo_t>;
|
||||
using HeaterMapIter = HeaterMap::iterator;
|
||||
|
||||
HeaterMap heaterMap;
|
||||
|
||||
bool switchStates[heaterSwitches::NUMBER_OF_SWITCHES];
|
||||
|
||||
/** Size of command queue */
|
||||
size_t cmdQueueSize = 20;
|
||||
|
||||
/**
|
||||
* The object ID of the GPIO driver which enables and disables the
|
||||
* heaters.
|
||||
*/
|
||||
object_id_t gpioDriverId;
|
||||
|
||||
CookieIF * gpioCookie;
|
||||
|
||||
GpioIF* gpioInterface = nullptr;
|
||||
|
||||
/** Queue to receive messages from other objects. */
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
object_id_t mainLineSwitcherObjectId;
|
||||
|
||||
/** Switch number of the heater power supply switch */
|
||||
uint8_t mainLineSwitch;
|
||||
|
||||
/**
|
||||
* Power switcher object which controls the 8V main line of the heater
|
||||
* logic on the TCS board.
|
||||
*/
|
||||
PowerSwitchIF *mainLineSwitcher = nullptr;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
|
||||
StorageManagerIF *IPCStore = nullptr;
|
||||
|
||||
void readCommandQueue();
|
||||
|
||||
/**
|
||||
* @brief Returns the state of a switch (ON - true, or OFF - false).
|
||||
* @param switchNr The number of the switch to check.
|
||||
*/
|
||||
bool checkSwitchState(int switchNr);
|
||||
|
||||
/**
|
||||
* @brief Returns the ID of the GPIO related to a heater identified by the switch number
|
||||
* which is defined in the heaterSwitches list.
|
||||
*/
|
||||
gpioId_t getGpioIdFromSwitchNr(int switchNr);
|
||||
|
||||
/**
|
||||
* @brief This function runs commands waiting for execution.
|
||||
*/
|
||||
void handleActiveCommands();
|
||||
|
||||
ReturnValue_t initializeHeaterMap();
|
||||
|
||||
/**
|
||||
* @brief Sets all switches to OFF.
|
||||
*/
|
||||
void setInitialSwitchStates();
|
||||
|
||||
void handleSwitchOnCommand(HeaterMapIter heaterMapIter);
|
||||
|
||||
void handleSwitchOffCommand(HeaterMapIter heaterMapIter);
|
||||
|
||||
/**
|
||||
* @brief Checks if all switches are off.
|
||||
* @return True if all switches are off, otherwise false.
|
||||
*/
|
||||
bool allSwitchesOff();
|
||||
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_HEATERHANDLER_H_ */
|
202
linux/devices/SolarArrayDeploymentHandler.cpp
Normal file
202
linux/devices/SolarArrayDeploymentHandler.cpp
Normal file
@ -0,0 +1,202 @@
|
||||
#include "SolarArrayDeploymentHandler.h"
|
||||
|
||||
#include <devices/powerSwitcherList.h>
|
||||
#include <devices/gpioIds.h>
|
||||
|
||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
|
||||
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_,
|
||||
object_id_t gpioDriverId_, CookieIF * gpioCookie_, object_id_t mainLineSwitcherObjectId_,
|
||||
uint8_t mainLineSwitch_, gpioId_t deplSA1, gpioId_t deplSA2, uint32_t burnTimeMs) :
|
||||
SystemObject(setObjectId_), gpioDriverId(gpioDriverId_), gpioCookie(gpioCookie_),
|
||||
mainLineSwitcherObjectId(mainLineSwitcherObjectId_), mainLineSwitch(mainLineSwitch_),
|
||||
deplSA1(deplSA1), deplSA2(deplSA2), burnTimeMs(burnTimeMs), actionHelper(this, nullptr) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() {
|
||||
}
|
||||
|
||||
ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) {
|
||||
|
||||
if (operationCode == DeviceHandlerIF::PERFORM_OPERATION) {
|
||||
handleStateMachine();
|
||||
return RETURN_OK;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t SolarArrayDeploymentHandler::initialize() {
|
||||
ReturnValue_t result = SystemObject::initialize();
|
||||
if (result != RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioDriverId);
|
||||
if (gpioInterface == nullptr) {
|
||||
sif::error << "SolarArrayDeploymentHandler::initialize: Invalid Gpio interface."
|
||||
<< std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
result = gpioInterface->addGpios(dynamic_cast<GpioCookie*>(gpioCookie));
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "SolarArrayDeploymentHandler::initialize: Failed to initialize Gpio interface"
|
||||
<< std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
if (mainLineSwitcherObjectId != objects::NO_OBJECT) {
|
||||
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
|
||||
if (mainLineSwitcher == nullptr) {
|
||||
sif::error
|
||||
<< "SolarArrayDeploymentHandler::initialize: Main line switcher failed to fetch object"
|
||||
<< "from object ID." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
result = actionHelper.initialize(commandQueue);
|
||||
if (result != RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void SolarArrayDeploymentHandler::handleStateMachine() {
|
||||
switch (stateMachine) {
|
||||
case WAIT_ON_DELOYMENT_COMMAND:
|
||||
readCommandQueue();
|
||||
break;
|
||||
case SWITCH_8V_ON:
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
|
||||
mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
||||
stateMachine = WAIT_ON_8V_SWITCH;
|
||||
break;
|
||||
case WAIT_ON_8V_SWITCH:
|
||||
performWaitOn8VActions();
|
||||
break;
|
||||
case SWITCH_DEPL_GPIOS:
|
||||
switchDeploymentTransistors();
|
||||
break;
|
||||
case WAIT_ON_DEPLOYMENT_FINISH:
|
||||
handleDeploymentFinish();
|
||||
break;
|
||||
case WAIT_FOR_MAIN_SWITCH_OFF:
|
||||
if (mainLineSwitcher->getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_OFF) {
|
||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
} else if (mainSwitchCountdown.hasTimedOut()) {
|
||||
triggerEvent(MAIN_SWITCH_OFF_TIMEOUT);
|
||||
sif::error << "SolarArrayDeploymentHandler::handleStateMachine: Failed to switch main"
|
||||
<< " switch off" << std::endl;
|
||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Invalid state" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SolarArrayDeploymentHandler::performWaitOn8VActions() {
|
||||
if (mainLineSwitcher->getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_ON) {
|
||||
stateMachine = SWITCH_DEPL_GPIOS;
|
||||
} else {
|
||||
if (mainSwitchCountdown.hasTimedOut()) {
|
||||
triggerEvent(MAIN_SWITCH_ON_TIMEOUT);
|
||||
actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
|
||||
MAIN_SWITCH_TIMEOUT_FAILURE);
|
||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
result = gpioInterface->pullHigh(deplSA1);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 1 high " << std::endl;
|
||||
/* If gpio switch high failed, state machine is reset to wait for a command reinitiating
|
||||
* the deployment sequence. */
|
||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
|
||||
actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
|
||||
SWITCHING_DEPL_SA2_FAILED);
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
result = gpioInterface->pullHigh(deplSA2);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 2 high " << std::endl;
|
||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
|
||||
actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
|
||||
SWITCHING_DEPL_SA2_FAILED);
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
deploymentCountdown.setTimeout(burnTimeMs);
|
||||
stateMachine = WAIT_ON_DEPLOYMENT_FINISH;
|
||||
}
|
||||
|
||||
void SolarArrayDeploymentHandler::handleDeploymentFinish() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
if (deploymentCountdown.hasTimedOut()) {
|
||||
actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, RETURN_OK);
|
||||
result = gpioInterface->pullLow(deplSA1);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 1 low " << std::endl;
|
||||
}
|
||||
result = gpioInterface->pullLow(deplSA2);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 2 low " << std::endl;
|
||||
}
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
||||
stateMachine = WAIT_FOR_MAIN_SWITCH_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
void SolarArrayDeploymentHandler::readCommandQueue() {
|
||||
CommandMessage command;
|
||||
ReturnValue_t result = commandQueue->receiveMessage(&command);
|
||||
if (result != RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = actionHelper.handleActionMessage(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t SolarArrayDeploymentHandler::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
||||
ReturnValue_t result;
|
||||
if (stateMachine != WAIT_ON_DELOYMENT_COMMAND) {
|
||||
sif::error << "SolarArrayDeploymentHandler::executeAction: Received command while not in"
|
||||
<< "waiting-on-command-state" << std::endl;
|
||||
return DEPLOYMENT_ALREADY_EXECUTING;
|
||||
}
|
||||
if (actionId != DEPLOY_SOLAR_ARRAYS) {
|
||||
sif::error << "SolarArrayDeploymentHandler::executeAction: Received invalid command"
|
||||
<< std::endl;
|
||||
result = COMMAND_NOT_SUPPORTED;
|
||||
} else {
|
||||
stateMachine = SWITCH_8V_ON;
|
||||
rememberCommanderId = commandedBy;
|
||||
result = RETURN_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
MessageQueueId_t SolarArrayDeploymentHandler::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
158
linux/devices/SolarArrayDeploymentHandler.h
Normal file
158
linux/devices/SolarArrayDeploymentHandler.h
Normal file
@ -0,0 +1,158 @@
|
||||
#ifndef MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_
|
||||
#define MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/action/HasActionsIF.h>
|
||||
#include <fsfw/power/PowerSwitchIF.h>
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||
#include <unordered_map>
|
||||
|
||||
/**
|
||||
* @brief This class is used to control the solar array deployment.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class SolarArrayDeploymentHandler: public ExecutableObjectIF,
|
||||
public SystemObject,
|
||||
public HasReturnvaluesIF,
|
||||
public HasActionsIF {
|
||||
public:
|
||||
|
||||
static const DeviceCommandId_t DEPLOY_SOLAR_ARRAYS = 0x5;
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
*
|
||||
* @param setObjectId The object id of the SolarArrayDeploymentHandler.
|
||||
* @param gpioDriverId The id of the gpio com if.
|
||||
* @param gpioCookie GpioCookie holding information about the gpios used to switch the
|
||||
* transistors.
|
||||
* @param mainLineSwitcherObjectId The object id of the object responsible for switching
|
||||
* the 8V power source. This is normally the PCDU.
|
||||
* @param mainLineSwitch The id of the main line switch. This is defined in
|
||||
* powerSwitcherList.h.
|
||||
* @param deplSA1 gpioId of the GPIO controlling the deployment 1 transistor.
|
||||
* @param deplSA2 gpioId of the GPIO controlling the deployment 2 transistor.
|
||||
* @param burnTimeMs Time duration the power will be applied to the burn wires.
|
||||
*/
|
||||
SolarArrayDeploymentHandler(object_id_t setObjectId, object_id_t gpioDriverId,
|
||||
CookieIF * gpioCookie, object_id_t mainLineSwitcherObjectId, uint8_t mainLineSwitch,
|
||||
gpioId_t deplSA1, gpioId_t deplSA2, uint32_t burnTimeMs);
|
||||
|
||||
virtual ~SolarArrayDeploymentHandler();
|
||||
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
|
||||
virtual MessageQueueId_t getCommandQueue() const override;
|
||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
virtual ReturnValue_t initialize() override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::SA_DEPL_HANDLER;
|
||||
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA0);
|
||||
static const ReturnValue_t DEPLOYMENT_ALREADY_EXECUTING = MAKE_RETURN_CODE(0xA1);
|
||||
static const ReturnValue_t MAIN_SWITCH_TIMEOUT_FAILURE = MAKE_RETURN_CODE(0xA2);
|
||||
static const ReturnValue_t SWITCHING_DEPL_SA1_FAILED = MAKE_RETURN_CODE(0xA3);
|
||||
static const ReturnValue_t SWITCHING_DEPL_SA2_FAILED = MAKE_RETURN_CODE(0xA4);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SA_DEPL_HANDLER;
|
||||
static const Event MAIN_SWITCH_ON_TIMEOUT = MAKE_EVENT(0, severity::LOW);
|
||||
static const Event MAIN_SWITCH_OFF_TIMEOUT = MAKE_EVENT(1, severity::LOW);
|
||||
static const Event DEPLOYMENT_FAILED = MAKE_EVENT(2, severity::HIGH);
|
||||
static const Event DEPL_SA1_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(3, severity::HIGH);
|
||||
static const Event DEPL_SA2_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(4, severity::HIGH);
|
||||
|
||||
|
||||
enum StateMachine {
|
||||
WAIT_ON_DELOYMENT_COMMAND,
|
||||
SWITCH_8V_ON,
|
||||
WAIT_ON_8V_SWITCH,
|
||||
SWITCH_DEPL_GPIOS,
|
||||
WAIT_ON_DEPLOYMENT_FINISH,
|
||||
WAIT_FOR_MAIN_SWITCH_OFF
|
||||
};
|
||||
|
||||
StateMachine stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
|
||||
/**
|
||||
* This countdown is used to check if the PCDU sets the 8V line on in the intended time.
|
||||
*/
|
||||
Countdown mainSwitchCountdown;
|
||||
|
||||
/**
|
||||
* This countdown is used to wait for the burn wire being successful cut.
|
||||
*/
|
||||
Countdown deploymentCountdown;
|
||||
|
||||
|
||||
/**
|
||||
* The message queue id of the component commanding an action will be stored in this variable.
|
||||
* This is necessary to send later the action finish replies.
|
||||
*/
|
||||
MessageQueueId_t rememberCommanderId = 0;
|
||||
|
||||
/** Size of command queue */
|
||||
size_t cmdQueueSize = 20;
|
||||
|
||||
/** The object ID of the GPIO driver which switches the deployment transistors */
|
||||
object_id_t gpioDriverId;
|
||||
|
||||
CookieIF * gpioCookie;
|
||||
|
||||
/** Object id of the object responsible to switch the 8V power input. Typically the PCDU. */
|
||||
object_id_t mainLineSwitcherObjectId;
|
||||
|
||||
/** Switch number of the 8V power switch */
|
||||
uint8_t mainLineSwitch;
|
||||
|
||||
gpioId_t deplSA1;
|
||||
gpioId_t deplSA2;
|
||||
|
||||
GpioIF* gpioInterface = nullptr;
|
||||
|
||||
/** Time duration switches are active to cut the burn wire */
|
||||
uint32_t burnTimeMs;
|
||||
|
||||
/** Queue to receive messages from other objects. */
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
/**
|
||||
* After initialization this pointer will hold the reference to the main line switcher object.
|
||||
*/
|
||||
PowerSwitchIF *mainLineSwitcher = nullptr;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
|
||||
void readCommandQueue();
|
||||
|
||||
/**
|
||||
* @brief This function performs actions dependent on the current state.
|
||||
*/
|
||||
void handleStateMachine();
|
||||
|
||||
/**
|
||||
* @brief This function polls the 8V switch state and changes the state machine when the
|
||||
* switch has been enabled.
|
||||
*/
|
||||
void performWaitOn8VActions();
|
||||
|
||||
/**
|
||||
* @brief This functions handles the switching of the solar array deployment transistors.
|
||||
*/
|
||||
void switchDeploymentTransistors();
|
||||
|
||||
/**
|
||||
* @brief This function performs actions to finish the deployment. Essentially switches
|
||||
* are turned of after the burn time has expired.
|
||||
*/
|
||||
void handleDeploymentFinish();
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ */
|
230
linux/devices/SusHandler.cpp
Normal file
230
linux/devices/SusHandler.cpp
Normal file
@ -0,0 +1,230 @@
|
||||
#include "SusHandler.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||
|
||||
SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
|
||||
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId) :
|
||||
DeviceHandlerBase(objectId, comIF, comCookie), gpioComIF(gpioComIF), chipSelectId(
|
||||
chipSelectId), dataset(this) {
|
||||
if (comCookie == NULL) {
|
||||
sif::error << "SusHandler: Invalid com cookie" << std::endl;
|
||||
}
|
||||
if (gpioComIF == NULL) {
|
||||
sif::error << "SusHandler: Invalid GpioComIF" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
SusHandler::~SusHandler() {
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::performOperation(uint8_t counter) {
|
||||
|
||||
if (counter != FIRST_WRITE) {
|
||||
DeviceHandlerBase::performOperation(counter);
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
if (mode != MODE_NORMAL) {
|
||||
DeviceHandlerBase::performOperation(DeviceHandlerIF::SEND_WRITE);
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
/* If device is in normale mode the communication sequence is initiated here */
|
||||
if (communicationStep == CommunicationStep::IDLE) {
|
||||
communicationStep = CommunicationStep::WRITE_SETUP;
|
||||
}
|
||||
|
||||
DeviceHandlerBase::performOperation(DeviceHandlerIF::SEND_WRITE);
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::initialize() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
result = DeviceHandlerBase::initialize();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
auto spiComIF = dynamic_cast<SpiComIF*>(communicationInterface);
|
||||
if (spiComIF == nullptr) {
|
||||
sif::debug << "SusHandler::initialize: Invalid communication interface" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
spiMutex = spiComIF->getMutex();
|
||||
if (spiMutex == nullptr) {
|
||||
sif::debug << "SusHandler::initialize: Failed to get spi mutex" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void SusHandler::doStartUp(){
|
||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||
setMode(MODE_NORMAL);
|
||||
#else
|
||||
setMode(_MODE_TO_ON);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SusHandler::doShutDown(){
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::buildNormalDeviceCommand(
|
||||
DeviceCommandId_t * id) {
|
||||
|
||||
if (communicationStep == CommunicationStep::IDLE) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
if (communicationStep == CommunicationStep::WRITE_SETUP) {
|
||||
*id = SUS::WRITE_SETUP;
|
||||
communicationStep = CommunicationStep::START_CONVERSIONS;
|
||||
}
|
||||
else if (communicationStep == CommunicationStep::START_CONVERSIONS) {
|
||||
*id = SUS::START_CONVERSIONS;
|
||||
communicationStep = CommunicationStep::READ_CONVERSIONS;
|
||||
}
|
||||
else if (communicationStep == CommunicationStep::READ_CONVERSIONS) {
|
||||
*id = SUS::READ_CONVERSIONS;
|
||||
communicationStep = CommunicationStep::IDLE;
|
||||
}
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::buildTransitionDeviceCommand(
|
||||
DeviceCommandId_t * id){
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||
size_t commandDataLen) {
|
||||
switch(deviceCommand) {
|
||||
case(SUS::WRITE_SETUP): {
|
||||
/**
|
||||
* The sun sensor ADC is shutdown when CS is pulled high, so each time requesting a
|
||||
* measurement the setup has to be rewritten. There must also be a little delay between
|
||||
* the transmission of the setup byte and the first conversion. Thus the conversion
|
||||
* will be performed in an extra step.
|
||||
* Because the chip select is driven manually by the SusHandler the SPI bus must be
|
||||
* protected with a mutex here.
|
||||
*/
|
||||
ReturnValue_t result = spiMutex->lockMutex(timeoutType, timeoutMs);
|
||||
if(result == MutexIF::MUTEX_TIMEOUT) {
|
||||
sif::error << "SusHandler::buildCommandFromCommand: Mutex timeout" << std::endl;
|
||||
return ERROR_LOCK_MUTEX;
|
||||
}
|
||||
else if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "SusHandler::buildCommandFromCommand: Failed to lock spi mutex"
|
||||
<< std::endl;
|
||||
return ERROR_LOCK_MUTEX;
|
||||
}
|
||||
|
||||
gpioComIF->pullLow(chipSelectId);
|
||||
cmdBuffer[0] = SUS::SETUP;
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = 1;
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(SUS::START_CONVERSIONS): {
|
||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||
cmdBuffer[0] = SUS::CONVERSION;
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = 2;
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(SUS::READ_CONVERSIONS): {
|
||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = SUS::SIZE_READ_CONVERSIONS;
|
||||
return RETURN_OK;
|
||||
}
|
||||
default:
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
void SusHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(SUS::WRITE_SETUP);
|
||||
this->insertInCommandMap(SUS::START_CONVERSIONS);
|
||||
this->insertInCommandAndReplyMap(SUS::READ_CONVERSIONS, 1, &dataset, SUS::SIZE_READ_CONVERSIONS);
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::scanForReply(const uint8_t *start,
|
||||
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
*foundId = this->getPendingCommand();
|
||||
*foundLen = remainingSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) {
|
||||
switch (id) {
|
||||
case SUS::READ_CONVERSIONS: {
|
||||
PoolReadGuard readSet(&dataset);
|
||||
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
|
||||
dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3));
|
||||
dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5));
|
||||
dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7));
|
||||
dataset.ain3 = (*(packet + 8) << 8 | *(packet + 9));
|
||||
dataset.ain4 = (*(packet + 10) << 8 | *(packet + 11));
|
||||
dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13));
|
||||
#if OBSW_VERBOSE_LEVEL >= 1 && DEBUG_SUS
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", Temperature: "
|
||||
<< dataset.temperatureCelcius << " °C" << std::endl;
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN0: "
|
||||
<< std::dec << dataset.ain0 << std::endl;
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN1: "
|
||||
<< std::dec << dataset.ain1 << std::endl;
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN2: "
|
||||
<< std::dec << dataset.ain2 << std::endl;
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN3: "
|
||||
<< std::dec << dataset.ain3 << std::endl;
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN4: "
|
||||
<< std::dec << dataset.ain4 << std::endl;
|
||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN5: "
|
||||
<< std::dec << dataset.ain5 << std::endl;
|
||||
#endif
|
||||
/** SUS can now be shutdown and thus the SPI bus released again */
|
||||
gpioComIF->pullHigh(chipSelectId);
|
||||
ReturnValue_t result = spiMutex->unlockMutex();
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "SusHandler::interpretDeviceReply: Failed to unlock spi mutex"
|
||||
<< std::endl;
|
||||
return ERROR_UNLOCK_MUTEX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sif::debug << "SusHandler::interpretDeviceReply: Unknown reply id" << std::endl;
|
||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||
}
|
||||
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void SusHandler::setNormalDatapoolEntriesInvalid(){
|
||||
|
||||
}
|
||||
|
||||
uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
|
||||
return 1000;
|
||||
}
|
||||
|
||||
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(SUS::TEMPERATURE_C, new PoolEntry<float>( { 0.0 }));
|
||||
localDataPoolMap.emplace(SUS::AIN0, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(SUS::AIN1, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(SUS::AIN2, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(SUS::AIN3, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(SUS::AIN4, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(SUS::AIN5, new PoolEntry<uint16_t>( { 0 }));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
80
linux/devices/SusHandler.h
Normal file
80
linux/devices/SusHandler.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef MISSION_DEVICES_SUSHANDLER_H_
|
||||
#define MISSION_DEVICES_SUSHANDLER_H_
|
||||
|
||||
#include "devicedefinitions/SusDefinitions.h"
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||
|
||||
/**
|
||||
* @brief This is the device handler class for the SUS sensor. The sensor is
|
||||
* based on the MAX1227 ADC. Details about the SUS electronic can be found at
|
||||
* https://egit.irs.uni-stuttgart.de/eive/eive_dokumente/src/branch/master/400_Raumsegment/443_SunSensorDocumentation/release
|
||||
*
|
||||
* @details Datasheet of MAX1227: https://datasheets.maximintegrated.com/en/ds/MAX1227-MAX1231.pdf
|
||||
*
|
||||
* @note When adding a SusHandler to the polling sequence table make sure to add a slot with
|
||||
* the executionStep FIRST_WRITE. Otherwise the communication sequence will never be
|
||||
* started.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class SusHandler: public DeviceHandlerBase {
|
||||
public:
|
||||
|
||||
static const uint8_t FIRST_WRITE = 7;
|
||||
|
||||
SusHandler(object_id_t objectId, object_id_t comIF,
|
||||
CookieIF * comCookie, LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
|
||||
virtual ~SusHandler();
|
||||
|
||||
virtual ReturnValue_t performOperation(uint8_t counter) override;
|
||||
|
||||
virtual ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t * commandData,size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) override;
|
||||
void setNormalDatapoolEntriesInvalid() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::SUS_HANDLER;
|
||||
|
||||
static const ReturnValue_t ERROR_UNLOCK_MUTEX = MAKE_RETURN_CODE(0xA0);
|
||||
static const ReturnValue_t ERROR_LOCK_MUTEX = MAKE_RETURN_CODE(0xA1);
|
||||
|
||||
enum class CommunicationStep {
|
||||
IDLE,
|
||||
WRITE_SETUP,
|
||||
START_CONVERSIONS,
|
||||
READ_CONVERSIONS
|
||||
};
|
||||
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
|
||||
gpioId_t chipSelectId = gpio::NO_GPIO;
|
||||
|
||||
SUS::SusDataset dataset;
|
||||
|
||||
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
||||
CommunicationStep communicationStep = CommunicationStep::IDLE;
|
||||
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t timeoutMs = 20;
|
||||
|
||||
MutexIF* spiMutex = nullptr;
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_SUSHANDLER_H_ */
|
95
linux/devices/devicedefinitions/SusDefinitions.h
Normal file
95
linux/devices/devicedefinitions/SusDefinitions.h
Normal file
@ -0,0 +1,95 @@
|
||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SUS_H_
|
||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_SUS_H_
|
||||
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace SUS {
|
||||
|
||||
/**
|
||||
* Some MAX1227 could not be reached with frequencies around 4 MHz. Maybe this is caused by
|
||||
* the decoder and buffer circuits. Thus frequency is here defined to 1 MHz.
|
||||
*/
|
||||
static const uint32_t MAX1227_SPI_FREQ = 1000000;
|
||||
|
||||
static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
|
||||
|
||||
static const DeviceCommandId_t WRITE_SETUP = 0x1;
|
||||
/**
|
||||
* This command initiates the ADC conversion for all channels including the internal
|
||||
* temperature sensor.
|
||||
*/
|
||||
static const DeviceCommandId_t START_CONVERSIONS = 0x2;
|
||||
/**
|
||||
* This command reads the internal fifo which holds the temperature and the channel
|
||||
* conversions.
|
||||
*/
|
||||
static const DeviceCommandId_t READ_CONVERSIONS = 0x3;
|
||||
|
||||
/**
|
||||
* @brief This is the configuration byte which will be written to the setup register after
|
||||
* power on.
|
||||
*
|
||||
* @note Bit1 (DIFFSEL1) - Bit0 (DIFFSEL0): 0b00, No byte is following the setup byte
|
||||
* Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b10, Internal reference, no wake-up delay
|
||||
* Bit5 (CLKSEL1) - Bit4 (CLKSEL0): 0b10, Internally clocked
|
||||
* Bit7 - Bit6: 0b01, Tells MAX1227 that this byte should be
|
||||
* written to the setup register
|
||||
*
|
||||
*/
|
||||
static const uint8_t SETUP = 0b01101000;
|
||||
|
||||
/**
|
||||
* @brief This values will always be written to the ADC conversion register to specify the
|
||||
* conversions to perform.
|
||||
* @details Bit0: 1 - Enables temperature conversion
|
||||
* Bit2 (SCAN1) and Bit1 (SCAN0): 0b00, Scans channels 0 through N
|
||||
* Bit6 - Bit3 defines N: 0b0101 (N = 5)
|
||||
* Bit7: Always 1. Tells the ADC that this is the conversion register.
|
||||
*/
|
||||
static const uint8_t CONVERSION = 0b10101001;
|
||||
|
||||
static const uint8_t SUS_DATA_SET_ID = READ_CONVERSIONS;
|
||||
|
||||
/** Size of data replies. Temperature and 6 channel convesions (AIN0 - AIN5) */
|
||||
static const uint8_t SIZE_READ_CONVERSIONS = 14;
|
||||
|
||||
static const uint8_t MAX_CMD_SIZE = SIZE_READ_CONVERSIONS;
|
||||
|
||||
static const uint8_t POOL_ENTRIES = 7;
|
||||
|
||||
enum Max1227PoolIds: lp_id_t {
|
||||
TEMPERATURE_C,
|
||||
AIN0,
|
||||
AIN1,
|
||||
AIN2,
|
||||
AIN3,
|
||||
AIN4,
|
||||
AIN5,
|
||||
};
|
||||
|
||||
class SusDataset: public StaticLocalDataSet<POOL_ENTRIES> {
|
||||
public:
|
||||
|
||||
SusDataset(HasLocalDataPoolIF* owner) :
|
||||
StaticLocalDataSet(owner, SUS_DATA_SET_ID) {
|
||||
}
|
||||
|
||||
SusDataset(object_id_t objectId) :
|
||||
StaticLocalDataSet(sid_t(objectId, SUS_DATA_SET_ID)) {
|
||||
}
|
||||
|
||||
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, TEMPERATURE_C, this);
|
||||
lp_var_t<uint16_t> ain0 = lp_var_t<uint16_t>(sid.objectId, AIN0, this);
|
||||
lp_var_t<uint16_t> ain1 = lp_var_t<uint16_t>(sid.objectId, AIN1, this);
|
||||
lp_var_t<uint16_t> ain2 = lp_var_t<uint16_t>(sid.objectId, AIN2, this);
|
||||
lp_var_t<uint16_t> ain3 = lp_var_t<uint16_t>(sid.objectId, AIN3, this);
|
||||
lp_var_t<uint16_t> ain4 = lp_var_t<uint16_t>(sid.objectId, AIN4, this);
|
||||
lp_var_t<uint16_t> ain5 = lp_var_t<uint16_t>(sid.objectId, AIN5, this);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SUS_H_ */
|
22
linux/fsfwconfig/CMakeLists.txt
Normal file
22
linux/fsfwconfig/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
ipc/MissionMessageTypes.cpp
|
||||
pollingsequence/pollingSequenceFactory.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# If a special translation file for object IDs exists, compile it.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
objects/translateObjects.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# If a special translation file for events exists, compile it.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
events/translateEvents.cpp
|
||||
)
|
||||
endif()
|
77
linux/fsfwconfig/FSFWConfig.h.in
Normal file
77
linux/fsfwconfig/FSFWConfig.h.in
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef CONFIG_FSFWCONFIG_H_
|
||||
#define CONFIG_FSFWCONFIG_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
//! Used to determine whether C++ ostreams are used which can increase
|
||||
//! the binary size significantly. If this is disabled,
|
||||
//! the C stdio functions can be used alternatively
|
||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
||||
|
||||
//! More FSFW related printouts depending on level. Useful for development.
|
||||
#define FSFW_VERBOSE_LEVEL 1
|
||||
|
||||
//! Can be used to completely disable printouts, even the C stdio ones.
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
|
||||
#define FSFW_DISABLE_PRINTOUT 0
|
||||
#endif
|
||||
|
||||
#define FSFW_USE_PUS_C_TELEMETRY 1
|
||||
#define FSFW_USE_PUS_C_TELECOMMANDS 1
|
||||
|
||||
//! Can be used to disable the ANSI color sequences for C stdio.
|
||||
#define FSFW_COLORED_OUTPUT 1
|
||||
|
||||
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
||||
//! additional output which requires the translation files translateObjects
|
||||
//! and translateEvents (and their compiled source files)
|
||||
#define FSFW_OBJ_EVENT_TRANSLATION 1
|
||||
|
||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||
//! Specify whether info events are printed too.
|
||||
#define FSFW_DEBUG_INFO 1
|
||||
#include "objects/translateObjects.h"
|
||||
#include "events/translateEvents.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
//! When using the newlib nano library, C99 support for stdio facilities
|
||||
//! will not be provided. This define should be set to 1 if this is the case.
|
||||
#define FSFW_NO_C99_IO 1
|
||||
|
||||
//! Specify whether a special mode store is used for Subsystem components.
|
||||
#define FSFW_USE_MODESTORE 0
|
||||
|
||||
//! Defines if the real time scheduler for linux should be used.
|
||||
//! If set to 0, this will also disable priority settings for linux
|
||||
//! as most systems will not allow to set nice values without privileges
|
||||
//! For embedded linux system set this to 1.
|
||||
//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run
|
||||
#define FSFW_USE_REALTIME_FOR_LINUX 1
|
||||
|
||||
namespace fsfwconfig {
|
||||
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
||||
//! short timestamp.
|
||||
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
|
||||
|
||||
//! Configure the allocated pool sizes for the event manager.
|
||||
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
|
||||
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
|
||||
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
||||
|
||||
//! Defines the FIFO depth of each commanding service base which
|
||||
//! also determines how many commands a CSB service can handle in one cycle
|
||||
//! simulataneously. This will increase the required RAM for
|
||||
//! each CSB service !
|
||||
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
||||
|
||||
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
||||
|
||||
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
|
||||
|
||||
}
|
||||
|
||||
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0
|
||||
|
||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
70
linux/fsfwconfig/OBSWConfig.h.in
Normal file
70
linux/fsfwconfig/OBSWConfig.h.in
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @brief This file can be used to add preprocessor define for conditional
|
||||
* code inclusion exclusion or various other project constants and
|
||||
* properties in one place.
|
||||
*/
|
||||
#ifndef FSFWCONFIG_OBSWCONFIG_H_
|
||||
#define FSFWCONFIG_OBSWCONFIG_H_
|
||||
|
||||
#ifdef RASPBERRY_PI
|
||||
#include "rpiConfig.h"
|
||||
#elif defined(XIPHOS_Q7S)
|
||||
#include "q7sConfig.h"
|
||||
#endif
|
||||
#include "commonConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
/* These defines should be disabled for mission code but are useful for
|
||||
debugging. */
|
||||
#define OBSW_VERBOSE_LEVEL 1
|
||||
#define OBSW_PRINT_MISSED_DEADLINES 1
|
||||
#define OBSW_ADD_TEST_CODE 1
|
||||
#define OBSW_ADD_TEST_PST 1
|
||||
|
||||
#define TEST_LIBGPIOD 0
|
||||
#define TEST_RADIATION_SENSOR_HANDLER 0
|
||||
#define TEST_SUS_HANDLER 1
|
||||
#define TEST_PLOC_HANDLER 0
|
||||
#define TEST_CCSDS_BRIDGE 0
|
||||
#define PERFORM_PTME_TEST 0
|
||||
|
||||
#define TE0720 0
|
||||
#define TE0720_HEATER_TEST 0
|
||||
|
||||
#define P60DOCK_DEBUG 0
|
||||
#define PDU1_DEBUG 0
|
||||
#define PDU2_DEBUG 0
|
||||
#define ACU_DEBUG 0
|
||||
#define SYRLINKS_DEBUG 0
|
||||
#define IMQT_DEBUG 0
|
||||
#define ADIS16507_DEBUG 1
|
||||
#define L3GD20_GYRO_DEBUG 0
|
||||
#define DEBUG_RAD_SENSOR 1
|
||||
#define DEBUG_SUS 1
|
||||
#define DEBUG_RTD 1
|
||||
#define IMTQ_DEBUG 1
|
||||
|
||||
// Leave at one as the BSP is linux. Used by the ADIS16507 device handler
|
||||
#define OBSW_ADIS16507_LINUX_COM_IF 1
|
||||
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
/* Can be used to switch device to NORMAL mode immediately */
|
||||
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
#include "returnvalues/classIds.h"
|
||||
|
||||
namespace config {
|
||||
#endif
|
||||
|
||||
/* Add mission configuration flags here */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FSFWCONFIG_OBSWCONFIG_H_ */
|
11
linux/fsfwconfig/devices/addresses.cpp
Normal file
11
linux/fsfwconfig/devices/addresses.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* \file logicalAddresses.cpp
|
||||
*
|
||||
* \date 06.11.2019
|
||||
*/
|
||||
|
||||
#include "addresses.h"
|
||||
|
||||
|
||||
|
||||
|
80
linux/fsfwconfig/devices/addresses.h
Normal file
80
linux/fsfwconfig/devices/addresses.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef FSFWCONFIG_DEVICES_ADDRESSES_H_
|
||||
#define FSFWCONFIG_DEVICES_ADDRESSES_H_
|
||||
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
#include "objects/systemObjectList.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace addresses {
|
||||
/* Logical addresses have uint32_t datatype */
|
||||
enum logicalAddresses: address_t {
|
||||
PCDU,
|
||||
|
||||
MGM_0_LIS3 = objects::MGM_0_LIS3_HANDLER,
|
||||
MGM_1_RM3100 = objects::MGM_1_RM3100_HANDLER,
|
||||
MGM_2_LIS3 = objects::MGM_2_LIS3_HANDLER,
|
||||
MGM_3_RM3100 = objects::MGM_3_RM3100_HANDLER,
|
||||
|
||||
GYRO_0_ADIS = objects::GYRO_0_ADIS_HANDLER,
|
||||
GYRO_1_L3G = objects::GYRO_1_L3G_HANDLER,
|
||||
GYRO_2_L3G = objects::GYRO_2_L3G_HANDLER,
|
||||
|
||||
RAD_SENSOR = objects::RAD_SENSOR,
|
||||
|
||||
SUS_1 = objects::SUS_1,
|
||||
SUS_2 = objects::SUS_2,
|
||||
SUS_3 = objects::SUS_3,
|
||||
SUS_4 = objects::SUS_4,
|
||||
SUS_5 = objects::SUS_5,
|
||||
SUS_6 = objects::SUS_6,
|
||||
SUS_7 = objects::SUS_7,
|
||||
SUS_8 = objects::SUS_8,
|
||||
SUS_9 = objects::SUS_9,
|
||||
SUS_10 = objects::SUS_10,
|
||||
SUS_11 = objects::SUS_11,
|
||||
SUS_12 = objects::SUS_12,
|
||||
SUS_13 = objects::SUS_13,
|
||||
|
||||
/* Dummy and Test Addresses */
|
||||
DUMMY_ECHO = 129,
|
||||
DUMMY_GPS0 = 130,
|
||||
DUMMY_GPS1 = 131,
|
||||
};
|
||||
|
||||
enum i2cAddresses: address_t {
|
||||
IMTQ = 16,
|
||||
TMP1075_TCS_1 = 72,
|
||||
TMP1075_TCS_2 = 73,
|
||||
};
|
||||
|
||||
enum spiAddresses: address_t {
|
||||
RTD_IC3,
|
||||
RTD_IC4,
|
||||
RTD_IC5,
|
||||
RTD_IC6,
|
||||
RTD_IC7,
|
||||
RTD_IC8,
|
||||
RTD_IC9,
|
||||
RTD_IC10,
|
||||
RTD_IC11,
|
||||
RTD_IC12,
|
||||
RTD_IC13,
|
||||
RTD_IC14,
|
||||
RTD_IC15,
|
||||
RTD_IC16,
|
||||
RTD_IC17,
|
||||
RTD_IC18
|
||||
};
|
||||
|
||||
/* Addresses of devices supporting the CSP protocol */
|
||||
enum cspAddresses: uint8_t {
|
||||
P60DOCK = 4,
|
||||
ACU = 2,
|
||||
PDU1 = 3,
|
||||
/* PDU2 occupies X4 slot of P60Dock */
|
||||
PDU2 = 6
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_DEVICES_ADDRESSES_H_ */
|
78
linux/fsfwconfig/devices/gpioIds.h
Normal file
78
linux/fsfwconfig/devices/gpioIds.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
|
||||
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
|
||||
|
||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||
|
||||
namespace gpioIds {
|
||||
enum gpioId_t {
|
||||
HEATER_0,
|
||||
HEATER_1,
|
||||
HEATER_2,
|
||||
HEATER_3,
|
||||
HEATER_4,
|
||||
HEATER_5,
|
||||
HEATER_6,
|
||||
HEATER_7,
|
||||
DEPLSA1,
|
||||
DEPLSA2,
|
||||
|
||||
MGM_0_LIS3_CS,
|
||||
MGM_1_RM3100_CS,
|
||||
GYRO_0_ADIS_CS,
|
||||
GYRO_1_L3G_CS,
|
||||
GYRO_2_L3G_CS,
|
||||
MGM_2_LIS3_CS,
|
||||
MGM_3_RM3100_CS,
|
||||
|
||||
TEST_ID_0,
|
||||
TEST_ID_1,
|
||||
|
||||
RTD_IC3,
|
||||
RTD_IC4,
|
||||
RTD_IC5,
|
||||
RTD_IC6,
|
||||
RTD_IC7,
|
||||
RTD_IC8,
|
||||
RTD_IC9,
|
||||
RTD_IC10,
|
||||
RTD_IC11,
|
||||
RTD_IC12,
|
||||
RTD_IC13,
|
||||
RTD_IC14,
|
||||
RTD_IC15,
|
||||
RTD_IC16,
|
||||
RTD_IC17,
|
||||
RTD_IC18,
|
||||
|
||||
CS_SUS_1,
|
||||
CS_SUS_2,
|
||||
CS_SUS_3,
|
||||
CS_SUS_4,
|
||||
CS_SUS_5,
|
||||
CS_SUS_6,
|
||||
CS_SUS_7,
|
||||
CS_SUS_8,
|
||||
CS_SUS_9,
|
||||
CS_SUS_10,
|
||||
CS_SUS_11,
|
||||
CS_SUS_12,
|
||||
CS_SUS_13,
|
||||
|
||||
SPI_MUX_BIT_1,
|
||||
SPI_MUX_BIT_2,
|
||||
SPI_MUX_BIT_3,
|
||||
SPI_MUX_BIT_4,
|
||||
SPI_MUX_BIT_5,
|
||||
SPI_MUX_BIT_6,
|
||||
|
||||
CS_RAD_SENSOR,
|
||||
|
||||
PAPB_BUSY_N,
|
||||
PAPB_EMPTY
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
20
linux/fsfwconfig/devices/heaterSwitcherList.h
Normal file
20
linux/fsfwconfig/devices/heaterSwitcherList.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FSFWCONFIG_DEVICES_HEATERSWITCHERLIST_H_
|
||||
#define FSFWCONFIG_DEVICES_HEATERSWITCHERLIST_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace heaterSwitches {
|
||||
enum switcherList: uint8_t {
|
||||
HEATER_0,
|
||||
HEATER_1,
|
||||
HEATER_2,
|
||||
HEATER_3,
|
||||
HEATER_4,
|
||||
HEATER_5,
|
||||
HEATER_6,
|
||||
HEATER_7,
|
||||
NUMBER_OF_SWITCHES
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_DEVICES_HEATERSWITCHERLIST_H_ */
|
58
linux/fsfwconfig/devices/powerSwitcherList.h
Normal file
58
linux/fsfwconfig/devices/powerSwitcherList.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
|
||||
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
namespace pcduSwitches {
|
||||
/* Switches are uint8_t datatype and go from 0 to 255 */
|
||||
enum switcherList {
|
||||
Q7S,
|
||||
PAYLOAD_PCDU_CH1,
|
||||
RW,
|
||||
TCS_BOARD_8V_HEATER_IN,
|
||||
SUS_REDUNDANT,
|
||||
DEPLOYMENT_MECHANISM,
|
||||
PAYLOAD_PCDU_CH6,
|
||||
ACS_BOARD_SIDE_B,
|
||||
PAYLOAD_CAMERA,
|
||||
TCS_BOARD_3V3,
|
||||
SYRLINKS,
|
||||
STAR_TRACKER,
|
||||
MGT,
|
||||
SUS_NOMINAL,
|
||||
SOLAR_CELL_EXP,
|
||||
PLOC,
|
||||
ACS_BORAD_SIDE_A,
|
||||
NUMBER_OF_SWITCHES
|
||||
};
|
||||
|
||||
static const uint8_t ON = 1;
|
||||
static const uint8_t OFF = 0;
|
||||
|
||||
/* Output states after reboot of the PDUs */
|
||||
static const uint8_t INIT_STATE_Q7S = ON;
|
||||
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
|
||||
static const uint8_t INIT_STATE_RW = OFF;
|
||||
#if TE0720 == 1
|
||||
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
|
||||
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
|
||||
#else
|
||||
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
|
||||
#endif
|
||||
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
|
||||
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
|
||||
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
|
||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
|
||||
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
|
||||
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
|
||||
static const uint8_t INIT_STATE_SYRLINKS = OFF;
|
||||
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
|
||||
static const uint8_t INIT_STATE_MGT = OFF;
|
||||
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
|
||||
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
||||
static const uint8_t INIT_STATE_PLOC = OFF;
|
||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
19
linux/fsfwconfig/events/subsystemIdRanges.h
Normal file
19
linux/fsfwconfig/events/subsystemIdRanges.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||
#define FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||
|
||||
#include "common/config/commonSubsystemIds.h"
|
||||
#include "fsfw/events/fwSubsystemIdRanges.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* These IDs are part of the ID for an event thrown by a subsystem.
|
||||
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
||||
*/
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum: uint8_t {
|
||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
264
linux/fsfwconfig/events/translateEvents.cpp
Normal file
264
linux/fsfwconfig/events/translateEvents.cpp
Normal file
@ -0,0 +1,264 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 83 translations.
|
||||
* @details
|
||||
* Generated on: 2021-06-08 17:09:32
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
const char *STORE_SEND_WRITE_FAILED_STRING = "STORE_SEND_WRITE_FAILED";
|
||||
const char *STORE_WRITE_FAILED_STRING = "STORE_WRITE_FAILED";
|
||||
const char *STORE_SEND_READ_FAILED_STRING = "STORE_SEND_READ_FAILED";
|
||||
const char *STORE_READ_FAILED_STRING = "STORE_READ_FAILED";
|
||||
const char *UNEXPECTED_MSG_STRING = "UNEXPECTED_MSG";
|
||||
const char *STORING_FAILED_STRING = "STORING_FAILED";
|
||||
const char *TM_DUMP_FAILED_STRING = "TM_DUMP_FAILED";
|
||||
const char *STORE_INIT_FAILED_STRING = "STORE_INIT_FAILED";
|
||||
const char *STORE_INIT_EMPTY_STRING = "STORE_INIT_EMPTY";
|
||||
const char *STORE_CONTENT_CORRUPTED_STRING = "STORE_CONTENT_CORRUPTED";
|
||||
const char *STORE_INITIALIZE_STRING = "STORE_INITIALIZE";
|
||||
const char *INIT_DONE_STRING = "INIT_DONE";
|
||||
const char *DUMP_FINISHED_STRING = "DUMP_FINISHED";
|
||||
const char *DELETION_FINISHED_STRING = "DELETION_FINISHED";
|
||||
const char *DELETION_FAILED_STRING = "DELETION_FAILED";
|
||||
const char *AUTO_CATALOGS_SENDING_FAILED_STRING = "AUTO_CATALOGS_SENDING_FAILED";
|
||||
const char *GET_DATA_FAILED_STRING = "GET_DATA_FAILED";
|
||||
const char *STORE_DATA_FAILED_STRING = "STORE_DATA_FAILED";
|
||||
const char *DEVICE_BUILDING_COMMAND_FAILED_STRING = "DEVICE_BUILDING_COMMAND_FAILED";
|
||||
const char *DEVICE_SENDING_COMMAND_FAILED_STRING = "DEVICE_SENDING_COMMAND_FAILED";
|
||||
const char *DEVICE_REQUESTING_REPLY_FAILED_STRING = "DEVICE_REQUESTING_REPLY_FAILED";
|
||||
const char *DEVICE_READING_REPLY_FAILED_STRING = "DEVICE_READING_REPLY_FAILED";
|
||||
const char *DEVICE_INTERPRETING_REPLY_FAILED_STRING = "DEVICE_INTERPRETING_REPLY_FAILED";
|
||||
const char *DEVICE_MISSED_REPLY_STRING = "DEVICE_MISSED_REPLY";
|
||||
const char *DEVICE_UNKNOWN_REPLY_STRING = "DEVICE_UNKNOWN_REPLY";
|
||||
const char *DEVICE_UNREQUESTED_REPLY_STRING = "DEVICE_UNREQUESTED_REPLY";
|
||||
const char *INVALID_DEVICE_COMMAND_STRING = "INVALID_DEVICE_COMMAND";
|
||||
const char *MONITORING_LIMIT_EXCEEDED_STRING = "MONITORING_LIMIT_EXCEEDED";
|
||||
const char *MONITORING_AMBIGUOUS_STRING = "MONITORING_AMBIGUOUS";
|
||||
const char *FUSE_CURRENT_HIGH_STRING = "FUSE_CURRENT_HIGH";
|
||||
const char *FUSE_WENT_OFF_STRING = "FUSE_WENT_OFF";
|
||||
const char *POWER_ABOVE_HIGH_LIMIT_STRING = "POWER_ABOVE_HIGH_LIMIT";
|
||||
const char *POWER_BELOW_LOW_LIMIT_STRING = "POWER_BELOW_LOW_LIMIT";
|
||||
const char *SWITCH_WENT_OFF_STRING = "SWITCH_WENT_OFF";
|
||||
const char *HEATER_ON_STRING = "HEATER_ON";
|
||||
const char *HEATER_OFF_STRING = "HEATER_OFF";
|
||||
const char *HEATER_TIMEOUT_STRING = "HEATER_TIMEOUT";
|
||||
const char *HEATER_STAYED_ON_STRING = "HEATER_STAYED_ON";
|
||||
const char *HEATER_STAYED_OFF_STRING = "HEATER_STAYED_OFF";
|
||||
const char *TEMP_SENSOR_HIGH_STRING = "TEMP_SENSOR_HIGH";
|
||||
const char *TEMP_SENSOR_LOW_STRING = "TEMP_SENSOR_LOW";
|
||||
const char *TEMP_SENSOR_GRADIENT_STRING = "TEMP_SENSOR_GRADIENT";
|
||||
const char *COMPONENT_TEMP_LOW_STRING = "COMPONENT_TEMP_LOW";
|
||||
const char *COMPONENT_TEMP_HIGH_STRING = "COMPONENT_TEMP_HIGH";
|
||||
const char *COMPONENT_TEMP_OOL_LOW_STRING = "COMPONENT_TEMP_OOL_LOW";
|
||||
const char *COMPONENT_TEMP_OOL_HIGH_STRING = "COMPONENT_TEMP_OOL_HIGH";
|
||||
const char *TEMP_NOT_IN_OP_RANGE_STRING = "TEMP_NOT_IN_OP_RANGE";
|
||||
const char *FDIR_CHANGED_STATE_STRING = "FDIR_CHANGED_STATE";
|
||||
const char *FDIR_STARTS_RECOVERY_STRING = "FDIR_STARTS_RECOVERY";
|
||||
const char *FDIR_TURNS_OFF_DEVICE_STRING = "FDIR_TURNS_OFF_DEVICE";
|
||||
const char *MONITOR_CHANGED_STATE_STRING = "MONITOR_CHANGED_STATE";
|
||||
const char *VALUE_BELOW_LOW_LIMIT_STRING = "VALUE_BELOW_LOW_LIMIT";
|
||||
const char *VALUE_ABOVE_HIGH_LIMIT_STRING = "VALUE_ABOVE_HIGH_LIMIT";
|
||||
const char *VALUE_OUT_OF_RANGE_STRING = "VALUE_OUT_OF_RANGE";
|
||||
const char *SWITCHING_TM_FAILED_STRING = "SWITCHING_TM_FAILED";
|
||||
const char *CHANGING_MODE_STRING = "CHANGING_MODE";
|
||||
const char *MODE_INFO_STRING = "MODE_INFO";
|
||||
const char *FALLBACK_FAILED_STRING = "FALLBACK_FAILED";
|
||||
const char *MODE_TRANSITION_FAILED_STRING = "MODE_TRANSITION_FAILED";
|
||||
const char *CANT_KEEP_MODE_STRING = "CANT_KEEP_MODE";
|
||||
const char *OBJECT_IN_INVALID_MODE_STRING = "OBJECT_IN_INVALID_MODE";
|
||||
const char *FORCING_MODE_STRING = "FORCING_MODE";
|
||||
const char *MODE_CMD_REJECTED_STRING = "MODE_CMD_REJECTED";
|
||||
const char *HEALTH_INFO_STRING = "HEALTH_INFO";
|
||||
const char *CHILD_CHANGED_HEALTH_STRING = "CHILD_CHANGED_HEALTH";
|
||||
const char *CHILD_PROBLEMS_STRING = "CHILD_PROBLEMS";
|
||||
const char *OVERWRITING_HEALTH_STRING = "OVERWRITING_HEALTH";
|
||||
const char *TRYING_RECOVERY_STRING = "TRYING_RECOVERY";
|
||||
const char *RECOVERY_STEP_STRING = "RECOVERY_STEP";
|
||||
const char *RECOVERY_DONE_STRING = "RECOVERY_DONE";
|
||||
const char *RF_AVAILABLE_STRING = "RF_AVAILABLE";
|
||||
const char *RF_LOST_STRING = "RF_LOST";
|
||||
const char *BIT_LOCK_STRING = "BIT_LOCK";
|
||||
const char *BIT_LOCK_LOST_STRING = "BIT_LOCK_LOST";
|
||||
const char *FRAME_PROCESSING_FAILED_STRING = "FRAME_PROCESSING_FAILED";
|
||||
const char *CLOCK_SET_STRING = "CLOCK_SET";
|
||||
const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE";
|
||||
const char *TEST_STRING = "TEST";
|
||||
const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER";
|
||||
const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE";
|
||||
const char *ACK_FAILURE_STRING = "ACK_FAILURE";
|
||||
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
|
||||
const char *CRC_FAILURE_EVENT_STRING = "CRC_FAILURE_EVENT";
|
||||
|
||||
const char * translateEvents(Event event) {
|
||||
switch( (event & 0xffff) ) {
|
||||
case(2200):
|
||||
return STORE_SEND_WRITE_FAILED_STRING;
|
||||
case(2201):
|
||||
return STORE_WRITE_FAILED_STRING;
|
||||
case(2202):
|
||||
return STORE_SEND_READ_FAILED_STRING;
|
||||
case(2203):
|
||||
return STORE_READ_FAILED_STRING;
|
||||
case(2204):
|
||||
return UNEXPECTED_MSG_STRING;
|
||||
case(2205):
|
||||
return STORING_FAILED_STRING;
|
||||
case(2206):
|
||||
return TM_DUMP_FAILED_STRING;
|
||||
case(2207):
|
||||
return STORE_INIT_FAILED_STRING;
|
||||
case(2208):
|
||||
return STORE_INIT_EMPTY_STRING;
|
||||
case(2209):
|
||||
return STORE_CONTENT_CORRUPTED_STRING;
|
||||
case(2210):
|
||||
return STORE_INITIALIZE_STRING;
|
||||
case(2211):
|
||||
return INIT_DONE_STRING;
|
||||
case(2212):
|
||||
return DUMP_FINISHED_STRING;
|
||||
case(2213):
|
||||
return DELETION_FINISHED_STRING;
|
||||
case(2214):
|
||||
return DELETION_FAILED_STRING;
|
||||
case(2215):
|
||||
return AUTO_CATALOGS_SENDING_FAILED_STRING;
|
||||
case(2600):
|
||||
return GET_DATA_FAILED_STRING;
|
||||
case(2601):
|
||||
return STORE_DATA_FAILED_STRING;
|
||||
case(2800):
|
||||
return DEVICE_BUILDING_COMMAND_FAILED_STRING;
|
||||
case(2801):
|
||||
return DEVICE_SENDING_COMMAND_FAILED_STRING;
|
||||
case(2802):
|
||||
return DEVICE_REQUESTING_REPLY_FAILED_STRING;
|
||||
case(2803):
|
||||
return DEVICE_READING_REPLY_FAILED_STRING;
|
||||
case(2804):
|
||||
return DEVICE_INTERPRETING_REPLY_FAILED_STRING;
|
||||
case(2805):
|
||||
return DEVICE_MISSED_REPLY_STRING;
|
||||
case(2806):
|
||||
return DEVICE_UNKNOWN_REPLY_STRING;
|
||||
case(2807):
|
||||
return DEVICE_UNREQUESTED_REPLY_STRING;
|
||||
case(2808):
|
||||
return INVALID_DEVICE_COMMAND_STRING;
|
||||
case(2809):
|
||||
return MONITORING_LIMIT_EXCEEDED_STRING;
|
||||
case(2810):
|
||||
return MONITORING_AMBIGUOUS_STRING;
|
||||
case(4201):
|
||||
return FUSE_CURRENT_HIGH_STRING;
|
||||
case(4202):
|
||||
return FUSE_WENT_OFF_STRING;
|
||||
case(4204):
|
||||
return POWER_ABOVE_HIGH_LIMIT_STRING;
|
||||
case(4205):
|
||||
return POWER_BELOW_LOW_LIMIT_STRING;
|
||||
case(4300):
|
||||
return SWITCH_WENT_OFF_STRING;
|
||||
case(5000):
|
||||
return HEATER_ON_STRING;
|
||||
case(5001):
|
||||
return HEATER_OFF_STRING;
|
||||
case(5002):
|
||||
return HEATER_TIMEOUT_STRING;
|
||||
case(5003):
|
||||
return HEATER_STAYED_ON_STRING;
|
||||
case(5004):
|
||||
return HEATER_STAYED_OFF_STRING;
|
||||
case(5200):
|
||||
return TEMP_SENSOR_HIGH_STRING;
|
||||
case(5201):
|
||||
return TEMP_SENSOR_LOW_STRING;
|
||||
case(5202):
|
||||
return TEMP_SENSOR_GRADIENT_STRING;
|
||||
case(5901):
|
||||
return COMPONENT_TEMP_LOW_STRING;
|
||||
case(5902):
|
||||
return COMPONENT_TEMP_HIGH_STRING;
|
||||
case(5903):
|
||||
return COMPONENT_TEMP_OOL_LOW_STRING;
|
||||
case(5904):
|
||||
return COMPONENT_TEMP_OOL_HIGH_STRING;
|
||||
case(5905):
|
||||
return TEMP_NOT_IN_OP_RANGE_STRING;
|
||||
case(7101):
|
||||
return FDIR_CHANGED_STATE_STRING;
|
||||
case(7102):
|
||||
return FDIR_STARTS_RECOVERY_STRING;
|
||||
case(7103):
|
||||
return FDIR_TURNS_OFF_DEVICE_STRING;
|
||||
case(7201):
|
||||
return MONITOR_CHANGED_STATE_STRING;
|
||||
case(7202):
|
||||
return VALUE_BELOW_LOW_LIMIT_STRING;
|
||||
case(7203):
|
||||
return VALUE_ABOVE_HIGH_LIMIT_STRING;
|
||||
case(7204):
|
||||
return VALUE_OUT_OF_RANGE_STRING;
|
||||
case(7301):
|
||||
return SWITCHING_TM_FAILED_STRING;
|
||||
case(7400):
|
||||
return CHANGING_MODE_STRING;
|
||||
case(7401):
|
||||
return MODE_INFO_STRING;
|
||||
case(7402):
|
||||
return FALLBACK_FAILED_STRING;
|
||||
case(7403):
|
||||
return MODE_TRANSITION_FAILED_STRING;
|
||||
case(7404):
|
||||
return CANT_KEEP_MODE_STRING;
|
||||
case(7405):
|
||||
return OBJECT_IN_INVALID_MODE_STRING;
|
||||
case(7406):
|
||||
return FORCING_MODE_STRING;
|
||||
case(7407):
|
||||
return MODE_CMD_REJECTED_STRING;
|
||||
case(7506):
|
||||
return HEALTH_INFO_STRING;
|
||||
case(7507):
|
||||
return CHILD_CHANGED_HEALTH_STRING;
|
||||
case(7508):
|
||||
return CHILD_PROBLEMS_STRING;
|
||||
case(7509):
|
||||
return OVERWRITING_HEALTH_STRING;
|
||||
case(7510):
|
||||
return TRYING_RECOVERY_STRING;
|
||||
case(7511):
|
||||
return RECOVERY_STEP_STRING;
|
||||
case(7512):
|
||||
return RECOVERY_DONE_STRING;
|
||||
case(7900):
|
||||
return RF_AVAILABLE_STRING;
|
||||
case(7901):
|
||||
return RF_LOST_STRING;
|
||||
case(7902):
|
||||
return BIT_LOCK_STRING;
|
||||
case(7903):
|
||||
return BIT_LOCK_LOST_STRING;
|
||||
case(7905):
|
||||
return FRAME_PROCESSING_FAILED_STRING;
|
||||
case(8900):
|
||||
return CLOCK_SET_STRING;
|
||||
case(8901):
|
||||
return CLOCK_SET_FAILURE_STRING;
|
||||
case(9700):
|
||||
return TEST_STRING;
|
||||
case(10600):
|
||||
return CHANGE_OF_SETUP_PARAMETER_STRING;
|
||||
case(11101):
|
||||
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||
case(11102):
|
||||
return ACK_FAILURE_STRING;
|
||||
case(11103):
|
||||
return EXE_FAILURE_STRING;
|
||||
case(11104):
|
||||
return CRC_FAILURE_EVENT_STRING;
|
||||
default:
|
||||
return "UNKNOWN_EVENT";
|
||||
}
|
||||
return 0;
|
||||
}
|
8
linux/fsfwconfig/events/translateEvents.h
Normal file
8
linux/fsfwconfig/events/translateEvents.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
|
||||
#define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
|
||||
|
||||
#include <fsfw/events/Event.h>
|
||||
|
||||
const char * translateEvents(Event event);
|
||||
|
||||
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */
|
15
linux/fsfwconfig/fsfwconfig.mk
Normal file
15
linux/fsfwconfig/fsfwconfig.mk
Normal file
@ -0,0 +1,15 @@
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
||||
|
||||
INCLUDES += $(CURRENTPATH)
|
||||
INCLUDES += $(CURRENTPATH)/objects
|
||||
INCLUDES += $(CURRENTPATH)/ipc
|
||||
INCLUDES += $(CURRENTPATH)/pollingsequence
|
||||
INCLUDES += $(CURRENTPATH)/returnvalues
|
||||
INCLUDES += $(CURRENTPATH)/tmtc
|
||||
INCLUDES += $(CURRENTPATH)/events
|
||||
INCLUDES += $(CURRENTPATH)/devices
|
||||
INCLUDES += $(CURRENTPATH)/cdatapool
|
12
linux/fsfwconfig/ipc/MissionMessageTypes.cpp
Normal file
12
linux/fsfwconfig/ipc/MissionMessageTypes.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "MissionMessageTypes.h"
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
|
||||
|
||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||
switch(message->getMessageType()) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
22
linux/fsfwconfig/ipc/MissionMessageTypes.h
Normal file
22
linux/fsfwconfig/ipc/MissionMessageTypes.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
#define FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
|
||||
#include <fsfw/ipc/FwMessageTypes.h>
|
||||
|
||||
class CommandMessage;
|
||||
|
||||
/**
|
||||
* Custom command messages are specified here.
|
||||
* Most messages needed to use FSFW are already located in
|
||||
* <fsfw/ipc/FwMessageTypes.h>
|
||||
* @param message Generic Command Message
|
||||
*/
|
||||
namespace messagetypes{
|
||||
enum MESSAGE_TYPE {
|
||||
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
|
||||
};
|
||||
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
72
linux/fsfwconfig/objects/systemObjectList.h
Normal file
72
linux/fsfwconfig/objects/systemObjectList.h
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
|
||||
#include "commonObjects.h"
|
||||
#include <fsfw/objectmanager/frameworkObjects.h>
|
||||
#include <cstdint>
|
||||
|
||||
// The objects will be instantiated in the ID order
|
||||
namespace objects {
|
||||
enum sourceObjects: uint32_t {
|
||||
/* 0x53 reserved for FSFW */
|
||||
FW_ADDRESS_START = PUS_SERVICE_1_VERIFICATION,
|
||||
FW_ADDRESS_END = TIME_STAMPER,
|
||||
|
||||
CCSDS_IP_CORE_BRIDGE = 0x50000500,
|
||||
|
||||
PUS_SERVICE_6 = 0x51000500,
|
||||
|
||||
TM_FUNNEL = 0x52000002,
|
||||
|
||||
/* 0x49 ('I') for Communication Interfaces **/
|
||||
ARDUINO_COM_IF = 0x49000001,
|
||||
CSP_COM_IF = 0x49000002,
|
||||
I2C_COM_IF = 0x49000003,
|
||||
UART_COM_IF = 0x49000004,
|
||||
SPI_COM_IF = 0x49000005,
|
||||
|
||||
/* 0x47 ('G') for Gpio Interfaces */
|
||||
GPIO_IF = 0x47000001,
|
||||
|
||||
/* Custom device handler */
|
||||
PCDU_HANDLER = 0x44001000,
|
||||
SOLAR_ARRAY_DEPL_HANDLER = 0x44001001,
|
||||
SYRLINKS_HK_HANDLER = 0x44001002,
|
||||
|
||||
/* 0x54 ('T') for thermal objects */
|
||||
HEATER_HANDLER = 0x54000003,
|
||||
/**
|
||||
* Not yet specified which pt1000 will measure which device/location in the satellite.
|
||||
* Therefore object ids are named according to the IC naming of the RTDs in the schematic.
|
||||
*/
|
||||
RTD_IC3 = 0x54000004,
|
||||
RTD_IC4 = 0x54000005,
|
||||
RTD_IC5 = 0x54000006,
|
||||
RTD_IC6 = 0x54000007,
|
||||
RTD_IC7 = 0x54000008,
|
||||
RTD_IC8 = 0x54000009,
|
||||
RTD_IC9 = 0x5400000A,
|
||||
RTD_IC10 = 0x5400000B,
|
||||
RTD_IC11 = 0x5400000C,
|
||||
RTD_IC12 = 0x5400000D,
|
||||
RTD_IC13 = 0x5400000E,
|
||||
RTD_IC14 = 0x5400000F,
|
||||
RTD_IC15 = 0x5400001F,
|
||||
RTD_IC16 = 0x5400002F,
|
||||
RTD_IC17 = 0x5400003F,
|
||||
RTD_IC18 = 0x5400004F,
|
||||
|
||||
RAD_SENSOR = 0x54000050,
|
||||
|
||||
/* 0x54 ('T') for test handlers */
|
||||
TEST_TASK = 0x54694269,
|
||||
LIBGPIOD_TEST = 0x54123456,
|
||||
SPI_TEST = 0x54000010,
|
||||
UART_TEST = 0x54000020,
|
||||
DUMMY_INTERFACE = 0x5400CAFE,
|
||||
DUMMY_HANDLER = 0x5400AFFE,
|
||||
P60DOCK_TEST_TASK = 0x00005060
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
295
linux/fsfwconfig/objects/translateObjects.cpp
Normal file
295
linux/fsfwconfig/objects/translateObjects.cpp
Normal file
@ -0,0 +1,295 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 93 translations.
|
||||
* Generated on: 2021-05-18 16:48:46
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
const char *P60DOCK_TEST_TASK_STRING = "P60DOCK_TEST_TASK";
|
||||
const char *P60DOCK_HANDLER_STRING = "P60DOCK_HANDLER";
|
||||
const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
|
||||
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
|
||||
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
|
||||
const char *TMP1075_HANDLER_1_STRING = "TMP1075_HANDLER_1";
|
||||
const char *TMP1075_HANDLER_2_STRING = "TMP1075_HANDLER_2";
|
||||
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
|
||||
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
|
||||
const char *MGM_2_LIS3_HANDLER_STRING = "MGM_2_LIS3_HANDLER";
|
||||
const char *MGM_3_RM3100_HANDLER_STRING = "MGM_3_RM3100_HANDLER";
|
||||
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
|
||||
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
|
||||
const char *GYRO_2_L3G_HANDLER_STRING = "GYRO_2_L3G_HANDLER";
|
||||
const char *IMTQ_HANDLER_STRING = "IMTQ_HANDLER";
|
||||
const char *PLOC_HANDLER_STRING = "PLOC_HANDLER";
|
||||
const char *SUS_1_STRING = "SUS_1";
|
||||
const char *SUS_2_STRING = "SUS_2";
|
||||
const char *SUS_3_STRING = "SUS_3";
|
||||
const char *SUS_4_STRING = "SUS_4";
|
||||
const char *SUS_5_STRING = "SUS_5";
|
||||
const char *SUS_6_STRING = "SUS_6";
|
||||
const char *SUS_7_STRING = "SUS_7";
|
||||
const char *SUS_8_STRING = "SUS_8";
|
||||
const char *SUS_9_STRING = "SUS_9";
|
||||
const char *SUS_10_STRING = "SUS_10";
|
||||
const char *SUS_11_STRING = "SUS_11";
|
||||
const char *SUS_12_STRING = "SUS_12";
|
||||
const char *SUS_13_STRING = "SUS_13";
|
||||
const char *PCDU_HANDLER_STRING = "PCDU_HANDLER";
|
||||
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
|
||||
const char *SYRLINKS_HK_HANDLER_STRING = "SYRLINKS_HK_HANDLER";
|
||||
const char *GPIO_IF_STRING = "GPIO_IF";
|
||||
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
|
||||
const char *CSP_COM_IF_STRING = "CSP_COM_IF";
|
||||
const char *I2C_COM_IF_STRING = "I2C_COM_IF";
|
||||
const char *UART_COM_IF_STRING = "UART_COM_IF";
|
||||
const char *SPI_COM_IF_STRING = "SPI_COM_IF";
|
||||
const char *CCSDS_PACKET_DISTRIBUTOR_STRING = "CCSDS_PACKET_DISTRIBUTOR";
|
||||
const char *PUS_PACKET_DISTRIBUTOR_STRING = "PUS_PACKET_DISTRIBUTOR";
|
||||
const char *UDP_BRIDGE_STRING = "UDP_BRIDGE";
|
||||
const char *UDP_POLLING_TASK_STRING = "UDP_POLLING_TASK";
|
||||
const char *PUS_SERVICE_3_STRING = "PUS_SERVICE_3";
|
||||
const char *PUS_SERVICE_5_STRING = "PUS_SERVICE_5";
|
||||
const char *PUS_SERVICE_6_STRING = "PUS_SERVICE_6";
|
||||
const char *PUS_SERVICE_8_STRING = "PUS_SERVICE_8";
|
||||
const char *PUS_SERVICE_23_STRING = "PUS_SERVICE_23";
|
||||
const char *PUS_SERVICE_201_STRING = "PUS_SERVICE_201";
|
||||
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
|
||||
const char *FSFW_OBJECTS_START_STRING = "FSFW_OBJECTS_START";
|
||||
const char *PUS_SERVICE_1_VERIFICATION_STRING = "PUS_SERVICE_1_VERIFICATION";
|
||||
const char *PUS_SERVICE_2_DEVICE_ACCESS_STRING = "PUS_SERVICE_2_DEVICE_ACCESS";
|
||||
const char *PUS_SERVICE_3_HOUSEKEEPING_STRING = "PUS_SERVICE_3_HOUSEKEEPING";
|
||||
const char *PUS_SERVICE_5_EVENT_REPORTING_STRING = "PUS_SERVICE_5_EVENT_REPORTING";
|
||||
const char *PUS_SERVICE_8_FUNCTION_MGMT_STRING = "PUS_SERVICE_8_FUNCTION_MGMT";
|
||||
const char *PUS_SERVICE_9_TIME_MGMT_STRING = "PUS_SERVICE_9_TIME_MGMT";
|
||||
const char *PUS_SERVICE_17_TEST_STRING = "PUS_SERVICE_17_TEST";
|
||||
const char *PUS_SERVICE_20_PARAMETERS_STRING = "PUS_SERVICE_20_PARAMETERS";
|
||||
const char *PUS_SERVICE_200_MODE_MGMT_STRING = "PUS_SERVICE_200_MODE_MGMT";
|
||||
const char *PUS_SERVICE_201_HEALTH_STRING = "PUS_SERVICE_201_HEALTH";
|
||||
const char *HEALTH_TABLE_STRING = "HEALTH_TABLE";
|
||||
const char *MODE_STORE_STRING = "MODE_STORE";
|
||||
const char *EVENT_MANAGER_STRING = "EVENT_MANAGER";
|
||||
const char *INTERNAL_ERROR_REPORTER_STRING = "INTERNAL_ERROR_REPORTER";
|
||||
const char *TC_STORE_STRING = "TC_STORE";
|
||||
const char *TM_STORE_STRING = "TM_STORE";
|
||||
const char *IPC_STORE_STRING = "IPC_STORE";
|
||||
const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
||||
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *HEATER_HANDLER_STRING = "HEATER_HANDLER";
|
||||
const char *RTD_IC3_STRING = "RTD_IC3";
|
||||
const char *RTD_IC4_STRING = "RTD_IC4";
|
||||
const char *RTD_IC5_STRING = "RTD_IC5";
|
||||
const char *RTD_IC6_STRING = "RTD_IC6";
|
||||
const char *RTD_IC7_STRING = "RTD_IC7";
|
||||
const char *RTD_IC8_STRING = "RTD_IC8";
|
||||
const char *RTD_IC9_STRING = "RTD_IC9";
|
||||
const char *RTD_IC10_STRING = "RTD_IC10";
|
||||
const char *RTD_IC11_STRING = "RTD_IC11";
|
||||
const char *RTD_IC12_STRING = "RTD_IC12";
|
||||
const char *RTD_IC13_STRING = "RTD_IC13";
|
||||
const char *RTD_IC14_STRING = "RTD_IC14";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *RTD_IC15_STRING = "RTD_IC15";
|
||||
const char *RTD_IC16_STRING = "RTD_IC16";
|
||||
const char *RTD_IC17_STRING = "RTD_IC17";
|
||||
const char *RTD_IC18_STRING = "RTD_IC18";
|
||||
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
const char *TEST_TASK_STRING = "TEST_TASK";
|
||||
const char *NO_OBJECT_STRING = "NO_OBJECT";
|
||||
|
||||
const char* translateObject(object_id_t object) {
|
||||
switch( (object & 0xFFFFFFFF) ) {
|
||||
case 0x00005060:
|
||||
return P60DOCK_TEST_TASK_STRING;
|
||||
case 0x44000001:
|
||||
return P60DOCK_HANDLER_STRING;
|
||||
case 0x44000002:
|
||||
return PDU1_HANDLER_STRING;
|
||||
case 0x44000003:
|
||||
return PDU2_HANDLER_STRING;
|
||||
case 0x44000004:
|
||||
return ACU_HANDLER_STRING;
|
||||
case 0x44000005:
|
||||
return TMP1075_HANDLER_1_STRING;
|
||||
case 0x44000006:
|
||||
return TMP1075_HANDLER_2_STRING;
|
||||
case 0x44000007:
|
||||
return MGM_0_LIS3_HANDLER_STRING;
|
||||
case 0x44000008:
|
||||
return MGM_1_RM3100_HANDLER_STRING;
|
||||
case 0x44000009:
|
||||
return MGM_2_LIS3_HANDLER_STRING;
|
||||
case 0x44000010:
|
||||
return MGM_3_RM3100_HANDLER_STRING;
|
||||
case 0x44000011:
|
||||
return GYRO_0_ADIS_HANDLER_STRING;
|
||||
case 0x44000012:
|
||||
return GYRO_1_L3G_HANDLER_STRING;
|
||||
case 0x44000013:
|
||||
return GYRO_2_L3G_HANDLER_STRING;
|
||||
case 0x44000014:
|
||||
return IMTQ_HANDLER_STRING;
|
||||
case 0x44000015:
|
||||
return PLOC_HANDLER_STRING;
|
||||
case 0x44000016:
|
||||
return SUS_1_STRING;
|
||||
case 0x44000017:
|
||||
return SUS_2_STRING;
|
||||
case 0x44000018:
|
||||
return SUS_3_STRING;
|
||||
case 0x44000019:
|
||||
return SUS_4_STRING;
|
||||
case 0x4400001A:
|
||||
return SUS_5_STRING;
|
||||
case 0x4400001B:
|
||||
return SUS_6_STRING;
|
||||
case 0x4400001C:
|
||||
return SUS_7_STRING;
|
||||
case 0x4400001D:
|
||||
return SUS_8_STRING;
|
||||
case 0x4400001E:
|
||||
return SUS_9_STRING;
|
||||
case 0x4400001F:
|
||||
return SUS_10_STRING;
|
||||
case 0x44000021:
|
||||
return SUS_11_STRING;
|
||||
case 0x44000022:
|
||||
return SUS_12_STRING;
|
||||
case 0x44000023:
|
||||
return SUS_13_STRING;
|
||||
case 0x44001000:
|
||||
return PCDU_HANDLER_STRING;
|
||||
case 0x44001001:
|
||||
return SOLAR_ARRAY_DEPL_HANDLER_STRING;
|
||||
case 0x44001002:
|
||||
return SYRLINKS_HK_HANDLER_STRING;
|
||||
case 0x47000001:
|
||||
return GPIO_IF_STRING;
|
||||
case 0x49000001:
|
||||
return ARDUINO_COM_IF_STRING;
|
||||
case 0x49000002:
|
||||
return CSP_COM_IF_STRING;
|
||||
case 0x49000003:
|
||||
return I2C_COM_IF_STRING;
|
||||
case 0x49000004:
|
||||
return UART_COM_IF_STRING;
|
||||
case 0x49000005:
|
||||
return SPI_COM_IF_STRING;
|
||||
case 0x50000100:
|
||||
return CCSDS_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x50000200:
|
||||
return PUS_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x50000300:
|
||||
return UDP_BRIDGE_STRING;
|
||||
case 0x50000400:
|
||||
return UDP_POLLING_TASK_STRING;
|
||||
case 0x51000300:
|
||||
return PUS_SERVICE_3_STRING;
|
||||
case 0x51000400:
|
||||
return PUS_SERVICE_5_STRING;
|
||||
case 0x51000500:
|
||||
return PUS_SERVICE_6_STRING;
|
||||
case 0x51000800:
|
||||
return PUS_SERVICE_8_STRING;
|
||||
case 0x51002300:
|
||||
return PUS_SERVICE_23_STRING;
|
||||
case 0x51020100:
|
||||
return PUS_SERVICE_201_STRING;
|
||||
case 0x52000002:
|
||||
return TM_FUNNEL_STRING;
|
||||
case 0x53000000:
|
||||
return FSFW_OBJECTS_START_STRING;
|
||||
case 0x53000001:
|
||||
return PUS_SERVICE_1_VERIFICATION_STRING;
|
||||
case 0x53000002:
|
||||
return PUS_SERVICE_2_DEVICE_ACCESS_STRING;
|
||||
case 0x53000003:
|
||||
return PUS_SERVICE_3_HOUSEKEEPING_STRING;
|
||||
case 0x53000005:
|
||||
return PUS_SERVICE_5_EVENT_REPORTING_STRING;
|
||||
case 0x53000008:
|
||||
return PUS_SERVICE_8_FUNCTION_MGMT_STRING;
|
||||
case 0x53000009:
|
||||
return PUS_SERVICE_9_TIME_MGMT_STRING;
|
||||
case 0x53000017:
|
||||
return PUS_SERVICE_17_TEST_STRING;
|
||||
case 0x53000020:
|
||||
return PUS_SERVICE_20_PARAMETERS_STRING;
|
||||
case 0x53000200:
|
||||
return PUS_SERVICE_200_MODE_MGMT_STRING;
|
||||
case 0x53000201:
|
||||
return PUS_SERVICE_201_HEALTH_STRING;
|
||||
case 0x53010000:
|
||||
return HEALTH_TABLE_STRING;
|
||||
case 0x53010100:
|
||||
return MODE_STORE_STRING;
|
||||
case 0x53030000:
|
||||
return EVENT_MANAGER_STRING;
|
||||
case 0x53040000:
|
||||
return INTERNAL_ERROR_REPORTER_STRING;
|
||||
case 0x534f0100:
|
||||
return TC_STORE_STRING;
|
||||
case 0x534f0200:
|
||||
return TM_STORE_STRING;
|
||||
case 0x534f0300:
|
||||
return IPC_STORE_STRING;
|
||||
case 0x53500010:
|
||||
return TIME_STAMPER_STRING;
|
||||
case 0x53ffffff:
|
||||
return FSFW_OBJECTS_END_STRING;
|
||||
case 0x54000003:
|
||||
return HEATER_HANDLER_STRING;
|
||||
case 0x54000004:
|
||||
return RTD_IC3_STRING;
|
||||
case 0x54000005:
|
||||
return RTD_IC4_STRING;
|
||||
case 0x54000006:
|
||||
return RTD_IC5_STRING;
|
||||
case 0x54000007:
|
||||
return RTD_IC6_STRING;
|
||||
case 0x54000008:
|
||||
return RTD_IC7_STRING;
|
||||
case 0x54000009:
|
||||
return RTD_IC8_STRING;
|
||||
case 0x5400000A:
|
||||
return RTD_IC9_STRING;
|
||||
case 0x5400000B:
|
||||
return RTD_IC10_STRING;
|
||||
case 0x5400000C:
|
||||
return RTD_IC11_STRING;
|
||||
case 0x5400000D:
|
||||
return RTD_IC12_STRING;
|
||||
case 0x5400000E:
|
||||
return RTD_IC13_STRING;
|
||||
case 0x5400000F:
|
||||
return RTD_IC14_STRING;
|
||||
case 0x54000010:
|
||||
return SPI_TEST_STRING;
|
||||
case 0x5400001F:
|
||||
return RTD_IC15_STRING;
|
||||
case 0x5400002F:
|
||||
return RTD_IC16_STRING;
|
||||
case 0x5400003F:
|
||||
return RTD_IC17_STRING;
|
||||
case 0x5400004F:
|
||||
return RTD_IC18_STRING;
|
||||
case 0x54000050:
|
||||
return RAD_SENSOR_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
return DUMMY_INTERFACE_STRING;
|
||||
case 0x54123456:
|
||||
return LIBGPIOD_TEST_STRING;
|
||||
case 0x54694269:
|
||||
return TEST_TASK_STRING;
|
||||
case 0xFFFFFFFF:
|
||||
return NO_OBJECT_STRING;
|
||||
default:
|
||||
return "UNKNOWN_OBJECT";
|
||||
}
|
||||
return 0;
|
||||
}
|
8
linux/fsfwconfig/objects/translateObjects.h
Normal file
8
linux/fsfwconfig/objects/translateObjects.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_
|
||||
#define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
|
||||
const char* translateObject(object_id_t object);
|
||||
|
||||
#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */
|
689
linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp
Normal file
689
linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp
Normal file
@ -0,0 +1,689 @@
|
||||
#include "pollingSequenceFactory.h"
|
||||
#include "linux/devices/SusHandler.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
|
||||
ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence)
|
||||
{
|
||||
// Length of a communication cycle
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
thisSequence->addSlot(objects::HEATER_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::SOLAR_ARRAY_DEPL_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
||||
// Radiation sensor
|
||||
// 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.4, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
// if (length != 3000) {
|
||||
// sif::warning << "pollingSequenceInitDefault: Frequency changed. Make sure timing critical "
|
||||
// << "SUS sensors still produce correct values" << std::endl;
|
||||
// }
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
sif::error << "PollingSequence::initialize has errors!" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_IC3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC5, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC6, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC7, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC9, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC10, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC11, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC12, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC13, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC14, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC15, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC16, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC17, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_IC18, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
#endif /* Q7S_ADD_RTD_DEVICES */
|
||||
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_IC3, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC4, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC5, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC6, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC7, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC8, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC9, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC10, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC11, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC12, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC13, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC14, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC15, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC16, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC17, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC18, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
#endif /* Q7S_ADD_RTD_DEVICES */
|
||||
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_IC3, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC4, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC5, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC6, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC7, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC8, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC9, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC10, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC11, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC12, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC13, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC14, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC15, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
#endif /* Q7S_ADD_RTD_DEVICES */
|
||||
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_IC3, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC4, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC5, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC6, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC7, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC8, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC9, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC10, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC11, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC12, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC13, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC14, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC15, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC16, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC17, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC18, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
#endif /* Q7S_ADD_RTD_DEVICES */
|
||||
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_IC3, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC4, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC5, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC6, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC7, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC8, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC9, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC10, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC11, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC12, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC13, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC14, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC15, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC16, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC17, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_IC18, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif /* Q7S_ADD_RTD_DEVICES */
|
||||
/**
|
||||
* 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
|
||||
* device handler cycles is that the ADC conversions take some time. Thus first the ADC
|
||||
* conversions are initiated and in a next step the results can be read from the internal FIFO.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Write setup */
|
||||
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_1, length * 0.9, 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_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ);
|
||||
// /* Write setup */
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_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_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
// /* Write setup */
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_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_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ);
|
||||
// /* Write setup */
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_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_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ);
|
||||
// /* Write setup */
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_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_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ);
|
||||
// /* Start ADC conversions */
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_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_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE);
|
||||
// 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 */
|
||||
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_8, length * 0.921, 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_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE);
|
||||
// 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 */
|
||||
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_10, length * 0.927, 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_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE);
|
||||
// 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 */
|
||||
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_12, length * 0.933, 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_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE);
|
||||
// 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 */
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ);
|
||||
// /* Read ADC conversions */
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ);
|
||||
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ);
|
||||
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "SPI PST initialization failed" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
|
||||
// Length of a communication cycle
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
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.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "I2C PST initialization failed" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
|
||||
// Length of a communication cycle
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "UART PST initialization failed" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence){
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
// PCDU handlers receives two messages and both must be handled
|
||||
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
||||
thisSequence->addSlot(objects::P60DOCK_HANDLER,
|
||||
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::PDU1_HANDLER,
|
||||
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::PDU2_HANDLER,
|
||||
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::ACU_HANDLER,
|
||||
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
||||
thisSequence->addSlot(objects::P60DOCK_HANDLER,
|
||||
length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::PDU1_HANDLER,
|
||||
length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::PDU2_HANDLER,
|
||||
length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::ACU_HANDLER,
|
||||
length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
|
||||
thisSequence->addSlot(objects::P60DOCK_HANDLER,
|
||||
length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::PDU1_HANDLER,
|
||||
length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::PDU2_HANDLER,
|
||||
length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::ACU_HANDLER,
|
||||
length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
|
||||
thisSequence->addSlot(objects::P60DOCK_HANDLER,
|
||||
length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::PDU1_HANDLER,
|
||||
length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::PDU2_HANDLER,
|
||||
length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::ACU_HANDLER,
|
||||
length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
|
||||
thisSequence->addSlot(objects::P60DOCK_HANDLER,
|
||||
length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::PDU1_HANDLER,
|
||||
length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::PDU2_HANDLER,
|
||||
length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::ACU_HANDLER,
|
||||
length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "GomSpace PST initialization failed" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
|
||||
/* Length of a communication cycle */
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
|
||||
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
|
||||
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
|
||||
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.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
|
||||
|
||||
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
|
||||
|
||||
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
|
||||
|
||||
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
|
||||
#if RPI_TEST_ADIS16507 == 1
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
|
||||
#if RPI_TEST_GPS_HANDLER == 1
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.5, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.5, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
static_cast<void>(length);
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Test PST initialization failed" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#if TE7020 == 1
|
||||
ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
#if TEST_PLOC_HANDLER == 1
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
|
||||
#if TEST_RADIATION_SENSOR_HANDLER == 1
|
||||
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.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
|
||||
#if TEST_SUS_HANDLER == 1
|
||||
/* Write setup */
|
||||
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.903, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.904, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.905, DeviceHandlerIF::GET_READ);
|
||||
|
||||
/* Start conversion*/
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.906, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.907, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.908, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.909, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.91, DeviceHandlerIF::GET_READ);
|
||||
|
||||
/* Read conversions */
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.912, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.913, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.914, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::SUS_1, length * 0.915, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Initialization of TE0720 PST failed" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#endif /* TE7020 == 1 */
|
68
linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h
Normal file
68
linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||
#define POLLINGSEQUENCEFACTORY_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#if defined(RASPBERRY_PI)
|
||||
#include "rpiConfig.h"
|
||||
#elif defined(XIPHOS_Q7S)
|
||||
#include "q7sConfig.h"
|
||||
#endif
|
||||
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
class FixedTimeslotTaskIF;
|
||||
|
||||
/**
|
||||
* All device handlers are scheduled by adding them into
|
||||
* Polling Sequence Tables (PST) to satisfy stricter timing requirements of
|
||||
* device communication, a device handler has four different communication steps:
|
||||
* 1. DeviceHandlerIF::SEND_WRITE -> Send write via interface
|
||||
* 2. DeviceHandlerIF::GET_WRITE -> Get confirmation for write
|
||||
* 3. DeviceHandlerIF::SEND_READ -> Send read request
|
||||
* 4. DeviceHandlerIF::GET_READ -> Read from interface
|
||||
* The PST specifies precisely when the respective ComIF functions are called
|
||||
* during the communication cycle time.
|
||||
* The task is created using the FixedTimeslotTaskIF,
|
||||
* which utilises the underlying Operating System Abstraction Layer (OSAL)
|
||||
*
|
||||
* @param thisSequence FixedTimeslotTaskIF * object is passed inside the
|
||||
* Factory class when creating the PST
|
||||
* @return
|
||||
*/
|
||||
namespace pst {
|
||||
|
||||
/* 0.4 second period init*/
|
||||
ReturnValue_t pstGpio(FixedTimeslotTaskIF *thisSequence);
|
||||
|
||||
/**
|
||||
* @brief This function creates the PST for all gomspace devices.
|
||||
* @details
|
||||
* Scheduled in a separate PST because the gomspace library uses blocking calls when requesting
|
||||
* data from devices.
|
||||
*/
|
||||
ReturnValue_t pstGompaceCan(FixedTimeslotTaskIF *thisSequence);
|
||||
|
||||
ReturnValue_t pstUart(FixedTimeslotTaskIF* thisSequence);
|
||||
|
||||
ReturnValue_t pstSpi(FixedTimeslotTaskIF* thisSequence);
|
||||
|
||||
ReturnValue_t pstI2c(FixedTimeslotTaskIF* thisSequence);
|
||||
|
||||
/**
|
||||
* Generic test PST
|
||||
* @param thisSequence
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t pstTest(FixedTimeslotTaskIF* thisSequence);
|
||||
|
||||
#if TE7020 == 1
|
||||
/**
|
||||
* @brief This polling sequence will be created when the software is compiled for the TE0720.
|
||||
*/
|
||||
ReturnValue_t pollingSequenceTE0720(FixedTimeslotTaskIF* thisSequence);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* POLLINGSEQUENCEINIT_H_ */
|
21
linux/fsfwconfig/returnvalues/classIds.h
Normal file
21
linux/fsfwconfig/returnvalues/classIds.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
#define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
|
||||
#include <fsfw/returnvalues/FwClassIds.h>
|
||||
#include <common/config/commonClassIds.h>
|
||||
|
||||
/**
|
||||
* Source IDs starts at 73 for now
|
||||
* Framework IDs for ReturnValues run from 0 to 56
|
||||
* and are located inside <fsfw/returnvalues/FwClassIds.h>
|
||||
*/
|
||||
namespace CLASS_ID {
|
||||
enum {
|
||||
CLASS_ID_START = COMMON_CLASS_ID_END,
|
||||
SA_DEPL_HANDLER, //SADPL
|
||||
CLASS_ID_END // [EXPORT] : [END]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */
|
19
linux/fsfwconfig/tmtc/apid.h
Normal file
19
linux/fsfwconfig/tmtc/apid.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef FSFWCONFIG_TMTC_APID_H_
|
||||
#define FSFWCONFIG_TMTC_APID_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* Application Process Definition: entity, uniquely identified by an
|
||||
* application process ID (APID), capable of generating telemetry source
|
||||
* packets and receiving telecommand packets
|
||||
*
|
||||
* EIVE APID: 0x65 / 101 / e
|
||||
* APID is a 11 bit number
|
||||
*/
|
||||
namespace apid {
|
||||
static const uint16_t EIVE_OBSW = 0x65;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
23
linux/fsfwconfig/tmtc/pusIds.h
Normal file
23
linux/fsfwconfig/tmtc/pusIds.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef CONFIG_TMTC_PUSIDS_HPP_
|
||||
#define CONFIG_TMTC_PUSIDS_HPP_
|
||||
|
||||
namespace pus {
|
||||
enum Ids{
|
||||
PUS_SERVICE_1 = 1,
|
||||
PUS_SERVICE_2 = 2,
|
||||
PUS_SERVICE_3 = 3,
|
||||
PUS_SERVICE_3_PSB = 3,
|
||||
PUS_SERVICE_5 = 5,
|
||||
PUS_SERVICE_6 = 6,
|
||||
PUS_SERVICE_8 = 8,
|
||||
PUS_SERVICE_9 = 9,
|
||||
PUS_SERVICE_17 = 17,
|
||||
PUS_SERVICE_19 = 19,
|
||||
PUS_SERVICE_20 = 20,
|
||||
PUS_SERVICE_23 = 23,
|
||||
PUS_SERVICE_200 = 200,
|
||||
PUS_SERVICE_201 = 201,
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* CONFIG_TMTC_PUSIDS_HPP_ */
|
136
linux/obc/CCSDSIPCoreBridge.cpp
Normal file
136
linux/obc/CCSDSIPCoreBridge.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <linux/obc/CCSDSIPCoreBridge.h>
|
||||
|
||||
CCSDSIPCoreBridge::CCSDSIPCoreBridge(object_id_t objectId, object_id_t tcDestination,
|
||||
object_id_t tmStoreId, object_id_t tcStoreId, LinuxLibgpioIF* gpioComIF,
|
||||
std::string uioPtme, gpioId_t papbBusyId, gpioId_t papbEmptyId) :
|
||||
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId), gpioComIF(gpioComIF), uioPtme(
|
||||
uioPtme), papbBusyId(papbBusyId), papbEmptyId(papbEmptyId) {
|
||||
}
|
||||
|
||||
CCSDSIPCoreBridge::~CCSDSIPCoreBridge() {
|
||||
}
|
||||
|
||||
ReturnValue_t CCSDSIPCoreBridge::initialize() {
|
||||
ReturnValue_t result = TmTcBridge::initialize();
|
||||
|
||||
fd = open("/dev/uio0", O_RDWR);
|
||||
if (fd < 1) {
|
||||
sif::debug << "CCSDSIPCoreBridge::initialize: Invalid UIO device file" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map uio device in virtual address space
|
||||
* PROT_WRITE: Map uio device in writable only mode
|
||||
*/
|
||||
ptmeBaseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, fd, 0));
|
||||
|
||||
if (ptmeBaseAddress == MAP_FAILED) {
|
||||
sif::error << "CCSDSIPCoreBridge::initialize: Failed to map uio address" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t CCSDSIPCoreBridge::handleTm() {
|
||||
|
||||
#if PERFORM_PTME_TEST == 1
|
||||
return sendTestFrame();
|
||||
#else
|
||||
return TmTcBridge::handleTm();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t * data, size_t dataLen) {
|
||||
|
||||
if(pollPapbBusySignal() == RETURN_OK) {
|
||||
startPacketTransfer();
|
||||
}
|
||||
|
||||
for(size_t idx = 0; idx < dataLen; idx++) {
|
||||
if(pollPapbBusySignal() == RETURN_OK) {
|
||||
*(ptmeBaseAddress + PTME_DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
||||
}
|
||||
else {
|
||||
sif::debug << "CCSDSIPCoreBridge::sendTm: Only written " << idx - 1 << " of " << dataLen
|
||||
<< " data" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if(pollPapbBusySignal() == RETURN_OK) {
|
||||
endPacketTransfer();
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void CCSDSIPCoreBridge::startPacketTransfer() {
|
||||
*ptmeBaseAddress = PTME_CONFIG_START;
|
||||
}
|
||||
|
||||
void CCSDSIPCoreBridge::endPacketTransfer() {
|
||||
*ptmeBaseAddress = PTME_CONFIG_END;
|
||||
}
|
||||
|
||||
ReturnValue_t CCSDSIPCoreBridge::pollPapbBusySignal() {
|
||||
int papbBusyState = 0;
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
/** Check if PAPB interface is ready to receive data */
|
||||
result = gpioComIF->readGpio(papbBusyId, &papbBusyState);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "CCSDSIPCoreBridge::pollPapbBusySignal: Failed to read papb busy signal"
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
if (!papbBusyState) {
|
||||
sif::debug << "CCSDSIPCoreBridge::pollPapbBusySignal: PAPB busy" << std::endl;
|
||||
return PAPB_BUSY;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void CCSDSIPCoreBridge::isPtmeBufferEmpty() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
int papbEmptyState = 1;
|
||||
|
||||
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
|
||||
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Failed to read papb empty signal"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (papbEmptyState == 1) {
|
||||
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Buffer is empty" << std::endl;
|
||||
}
|
||||
else {
|
||||
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Buffer is not empty" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ReturnValue_t CCSDSIPCoreBridge::sendTestFrame() {
|
||||
/** Size of one complete transfer frame data field amounts to 1105 bytes */
|
||||
uint8_t testPacket[1105];
|
||||
|
||||
/** Fill one test packet */
|
||||
for(int idx = 0; idx < 1105; idx++) {
|
||||
testPacket[idx] = static_cast<uint8_t>(idx & 0xFF);
|
||||
}
|
||||
|
||||
ReturnValue_t result = sendTm(testPacket, 1105);
|
||||
if(result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
130
linux/obc/CCSDSIPCoreBridge.h
Normal file
130
linux/obc/CCSDSIPCoreBridge.h
Normal file
@ -0,0 +1,130 @@
|
||||
#ifndef MISSION_OBC_CCSDSIPCOREBRIDGE_H_
|
||||
#define MISSION_OBC_CCSDSIPCOREBRIDGE_H_
|
||||
|
||||
#include <fsfw/tmtcservices/TmTcBridge.h>
|
||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||
#include <string.h>
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
/**
|
||||
* @brief This class handles the interfacing to the telemetry (PTME) and telecommand (PDEC) IP
|
||||
* cores responsible for the CCSDS encoding and decoding. The IP cores are implemented
|
||||
* on the programmable logic and are accessible through the linux UIO driver.
|
||||
*/
|
||||
class CCSDSIPCoreBridge: public TmTcBridge {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param objectId
|
||||
* @param tcDestination
|
||||
* @param tmStoreId
|
||||
* @param tcStoreId
|
||||
* @param uioPtme Name of the uio device file which provides access to the PTME IP Core.
|
||||
* @param papbBusyId The ID of the GPIO which is connected to the PAPBBusy_N signal of the
|
||||
* PTME IP Core. A low logic level indicates the PTME is not ready to
|
||||
* receive more data.
|
||||
* @param papbEmptyId The ID of the GPIO which is connected to the PAPBEmpty signal of the
|
||||
* PTME IP Core. The signal is high when there are no packets in the
|
||||
* external buffer memory (BRAM).
|
||||
*/
|
||||
CCSDSIPCoreBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
|
||||
object_id_t tcStoreId, LinuxLibgpioIF* gpioComIF, std::string uioPtme,
|
||||
gpioId_t papbBusyId, gpioId_t papbEmptyId);
|
||||
virtual ~CCSDSIPCoreBridge();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Overwriting this function to provide the capability of testing the PTME IP Core
|
||||
* implementation.
|
||||
*/
|
||||
virtual ReturnValue_t handleTm() override;
|
||||
|
||||
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_IP_CORE_BRIDGE;
|
||||
|
||||
static const ReturnValue_t PAPB_BUSY = MAKE_RETURN_CODE(0xA0);
|
||||
|
||||
|
||||
/** Size of mapped address space. 4k (minimal size of pl device) */
|
||||
// static const int MAP_SIZE = 0xFA0;
|
||||
static const int MAP_SIZE = 0x1000;
|
||||
|
||||
/**
|
||||
* Configuration bits:
|
||||
* bit[1:0]: Size of data (1,2,3 or 4 bytes). 1 Byte <=> b00
|
||||
* bit[2]: Set this bit to 1 to abort a transfered packet
|
||||
* bit[3]: Signals to PTME the start of a new telemetry packet
|
||||
*/
|
||||
static const uint32_t PTME_CONFIG_START = 0x8;
|
||||
|
||||
/**
|
||||
* Writing this word to the ptme base address signals to the PTME that a complete tm packet has
|
||||
* been transferred.
|
||||
*/
|
||||
static const uint32_t PTME_CONFIG_END = 0x0;
|
||||
|
||||
/**
|
||||
* Writing to this offset within the PTME memory space will insert data for encoding to the
|
||||
* PTME IP core.
|
||||
* The address offset is 0x400 (= 4 * 256)
|
||||
*/
|
||||
static const int PTME_DATA_REG_OFFSET = 256;
|
||||
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
|
||||
/** The uio device file related to the PTME IP Core */
|
||||
std::string uioPtme;
|
||||
|
||||
/** Pulled to low when PTME not ready to receive data */
|
||||
gpioId_t papbBusyId = gpio::NO_GPIO;
|
||||
|
||||
/** High when externally buffer memory of PTME is empty */
|
||||
gpioId_t papbEmptyId = gpio::NO_GPIO;
|
||||
|
||||
/** The file descriptor of the UIO driver */
|
||||
int fd;
|
||||
|
||||
uint32_t* ptmeBaseAddress = nullptr;
|
||||
|
||||
/**
|
||||
* @brief This function sends the config byte to the PTME IP Core to initiate a packet
|
||||
* transfer.
|
||||
*/
|
||||
void startPacketTransfer();
|
||||
|
||||
/**
|
||||
* @brief This function sends the config byte to the PTME IP Core to signal the end of a
|
||||
* packet transfer.
|
||||
*/
|
||||
void endPacketTransfer();
|
||||
|
||||
/**
|
||||
* @brief This function reads the papb busy signal indicating whether the PAPB interface is
|
||||
* ready to receive more data or not. PAPB is ready when PAPB_Busy_N == '1'.
|
||||
*
|
||||
* @return RETURN_OK when ready to receive data else PAPB_BUSY.
|
||||
*/
|
||||
ReturnValue_t pollPapbBusySignal();
|
||||
|
||||
/**
|
||||
* @brief This function can be used for debugging to check wheter there are packets in
|
||||
* the packet buffer of the PTME or not.
|
||||
*/
|
||||
void isPtmeBufferEmpty();
|
||||
|
||||
/**
|
||||
* @brief This function sends a complete telemetry transfer frame data field (1105 bytes)
|
||||
* to the input of the PTME IP Core. Can be used to test the implementation.
|
||||
*/
|
||||
ReturnValue_t sendTestFrame();
|
||||
};
|
||||
|
||||
#endif /* MISSION_OBC_CCSDSIPCOREBRIDGE_H_ */
|
@ -1,8 +1,5 @@
|
||||
target_sources(${TARGET_NAME} PUBLIC
|
||||
UartComIF.cpp
|
||||
UartCookie.cpp
|
||||
CCSDSIPCoreBridge.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -1,371 +0,0 @@
|
||||
#include "UartComIF.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
UartComIF::UartComIF(object_id_t objectId): SystemObject(objectId){
|
||||
}
|
||||
|
||||
UartComIF::~UartComIF() {}
|
||||
|
||||
ReturnValue_t UartComIF::initializeInterface(CookieIF * cookie) {
|
||||
|
||||
std::string deviceFile;
|
||||
UartDeviceMapIter uartDeviceMapIter;
|
||||
|
||||
if(cookie == nullptr) {
|
||||
return NULLPOINTER;
|
||||
}
|
||||
|
||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
||||
if (uartCookie == nullptr) {
|
||||
sif::error << "UartComIF::initializeInterface: Invalid UART Cookie!" << std::endl;
|
||||
return NULLPOINTER;
|
||||
}
|
||||
|
||||
deviceFile = uartCookie->getDeviceFile();
|
||||
|
||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||
if(uartDeviceMapIter == uartDeviceMap.end()) {
|
||||
int fileDescriptor = configureUartPort(uartCookie);
|
||||
if (fileDescriptor < 0) {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
size_t maxReplyLen = uartCookie->getMaxReplyLen();
|
||||
UartElements_t uartElements = {fileDescriptor, std::vector<uint8_t>(maxReplyLen), 0};
|
||||
std::pair status = uartDeviceMap.emplace(deviceFile, uartElements);
|
||||
if (status.second == false) {
|
||||
sif::debug << "UartComIF::initializeInterface: Failed to insert device " << deviceFile
|
||||
<< "to Uart device map" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sif::debug << "UartComIF::initializeInterface: Uart device " << deviceFile << "already in "
|
||||
<< "use" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
int UartComIF::configureUartPort(UartCookie* uartCookie) {
|
||||
|
||||
struct termios options;
|
||||
|
||||
std::string deviceFile = uartCookie->getDeviceFile();
|
||||
int fd = open(deviceFile.c_str(), O_RDWR);
|
||||
|
||||
if (fd < 0) {
|
||||
sif::debug << "UartComIF::configureUartPort: Failed to open uart " << deviceFile << "with"
|
||||
<< " error code " << errno << strerror(errno) << std::endl;
|
||||
return fd;
|
||||
}
|
||||
|
||||
/* Read in existing settings */
|
||||
if(tcgetattr(fd, &options) != 0) {
|
||||
sif::debug << "UartComIF::configureUartPort: Error " << errno << "from tcgetattr: "
|
||||
<< strerror(errno) << std::endl;
|
||||
return fd;
|
||||
}
|
||||
|
||||
setParityOptions(&options, uartCookie);
|
||||
setStopBitOptions(&options, uartCookie);
|
||||
setDatasizeOptions(&options, uartCookie);
|
||||
setFixedOptions(&options);
|
||||
|
||||
/* Sets uart to non-blocking mode. Read returns immediately when there are no data available */
|
||||
options.c_cc[VTIME] = 0;
|
||||
options.c_cc[VMIN] = 0;
|
||||
|
||||
configureBaudrate(&options, uartCookie);
|
||||
|
||||
/* Save option settings */
|
||||
if (tcsetattr(fd, TCSANOW, &options) != 0) {
|
||||
sif::debug << "UartComIF::configureUartPort: Failed to set options with error " << errno
|
||||
<< ": " << strerror(errno);
|
||||
return fd;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
void UartComIF::setParityOptions(struct termios* options, UartCookie* uartCookie) {
|
||||
/* Clear parity bit */
|
||||
options->c_cflag &= ~PARENB;
|
||||
switch (uartCookie->getParity()) {
|
||||
case Parity::EVEN:
|
||||
options->c_cflag |= PARENB;
|
||||
options->c_cflag &= ~PARODD;
|
||||
break;
|
||||
case Parity::ODD:
|
||||
options->c_cflag |= PARENB;
|
||||
options->c_cflag |= PARODD;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UartComIF::setStopBitOptions(struct termios* options, UartCookie* uartCookie) {
|
||||
/* Clear stop field. Sets stop bit to one bit */
|
||||
options->c_cflag &= ~CSTOPB;
|
||||
switch (uartCookie->getStopBits()) {
|
||||
case StopBits::TWO_STOP_BITS:
|
||||
options->c_cflag |= CSTOPB;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UartComIF::setDatasizeOptions(struct termios* options, UartCookie* uartCookie) {
|
||||
/* Clear size bits */
|
||||
options->c_cflag &= ~CSIZE;
|
||||
switch (uartCookie->getBitsPerWord()) {
|
||||
case 5:
|
||||
options->c_cflag |= CS5;
|
||||
break;
|
||||
case 6:
|
||||
options->c_cflag |= CS6;
|
||||
break;
|
||||
case 7:
|
||||
options->c_cflag |= CS7;
|
||||
break;
|
||||
case 8:
|
||||
options->c_cflag |= CS8;
|
||||
break;
|
||||
default:
|
||||
sif::debug << "UartComIF::setDatasizeOptions: Invalid size specified" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UartComIF::setFixedOptions(struct termios* options) {
|
||||
/* Disable RTS/CTS hardware flow control */
|
||||
options->c_cflag &= ~CRTSCTS;
|
||||
/* Turn on READ & ignore ctrl lines (CLOCAL = 1) */
|
||||
options->c_cflag |= CREAD | CLOCAL;
|
||||
/* Disable canonical mode */
|
||||
options->c_lflag &= ~ICANON;
|
||||
/* Disable echo */
|
||||
options->c_lflag &= ~ECHO;
|
||||
/* Disable erasure */
|
||||
options->c_lflag &= ~ECHOE;
|
||||
/* Disable new-line echo */
|
||||
options->c_lflag &= ~ECHONL;
|
||||
/* Disable interpretation of INTR, QUIT and SUSP */
|
||||
options->c_lflag &= ~ISIG;
|
||||
/* Turn off s/w flow ctrl */
|
||||
options->c_iflag &= ~(IXON | IXOFF | IXANY);
|
||||
/* Disable any special handling of received bytes */
|
||||
options->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL);
|
||||
/* Prevent special interpretation of output bytes (e.g. newline chars) */
|
||||
options->c_oflag &= ~OPOST;
|
||||
/* Prevent conversion of newline to carriage return/line feed */
|
||||
options->c_oflag &= ~ONLCR;
|
||||
}
|
||||
|
||||
void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCookie) {
|
||||
switch (uartCookie->getBaudrate()) {
|
||||
case 50:
|
||||
cfsetispeed(options, B50);
|
||||
cfsetospeed(options, B50);
|
||||
break;
|
||||
case 75:
|
||||
cfsetispeed(options, B75);
|
||||
cfsetospeed(options, B75);
|
||||
break;
|
||||
case 110:
|
||||
cfsetispeed(options, B110);
|
||||
cfsetospeed(options, B110);
|
||||
break;
|
||||
case 134:
|
||||
cfsetispeed(options, B134);
|
||||
cfsetospeed(options, B134);
|
||||
break;
|
||||
case 150:
|
||||
cfsetispeed(options, B150);
|
||||
cfsetospeed(options, B150);
|
||||
break;
|
||||
case 200:
|
||||
cfsetispeed(options, B200);
|
||||
cfsetospeed(options, B200);
|
||||
break;
|
||||
case 300:
|
||||
cfsetispeed(options, B300);
|
||||
cfsetospeed(options, B300);
|
||||
break;
|
||||
case 600:
|
||||
cfsetispeed(options, B600);
|
||||
cfsetospeed(options, B600);
|
||||
break;
|
||||
case 1200:
|
||||
cfsetispeed(options, B1200);
|
||||
cfsetospeed(options, B1200);
|
||||
break;
|
||||
case 1800:
|
||||
cfsetispeed(options, B1800);
|
||||
cfsetospeed(options, B1800);
|
||||
break;
|
||||
case 2400:
|
||||
cfsetispeed(options, B2400);
|
||||
cfsetospeed(options, B2400);
|
||||
break;
|
||||
case 4800:
|
||||
cfsetispeed(options, B4800);
|
||||
cfsetospeed(options, B4800);
|
||||
break;
|
||||
case 9600:
|
||||
cfsetispeed(options, B9600);
|
||||
cfsetospeed(options, B9600);
|
||||
break;
|
||||
case 19200:
|
||||
cfsetispeed(options, B19200);
|
||||
cfsetospeed(options, B19200);
|
||||
break;
|
||||
case 38400:
|
||||
cfsetispeed(options, B38400);
|
||||
cfsetospeed(options, B38400);
|
||||
break;
|
||||
case 57600:
|
||||
cfsetispeed(options, B57600);
|
||||
cfsetospeed(options, B57600);
|
||||
break;
|
||||
case 115200:
|
||||
cfsetispeed(options, B115200);
|
||||
cfsetospeed(options, B115200);
|
||||
break;
|
||||
case 230400:
|
||||
cfsetispeed(options, B230400);
|
||||
cfsetospeed(options, B230400);
|
||||
break;
|
||||
case 460800:
|
||||
cfsetispeed(options, B460800);
|
||||
cfsetospeed(options, B460800);
|
||||
break;
|
||||
default:
|
||||
sif::debug << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t UartComIF::sendMessage(CookieIF *cookie,
|
||||
const uint8_t *sendData, size_t sendLen) {
|
||||
|
||||
int fd;
|
||||
std::string deviceFile;
|
||||
UartDeviceMapIter uartDeviceMapIter;
|
||||
|
||||
if(sendData == nullptr) {
|
||||
sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
if(sendLen == 0) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
||||
if(uartCookie == nullptr) {
|
||||
sif::debug << "UartComIF::sendMessasge: Invalid Uart Cookie!" << std::endl;
|
||||
return NULLPOINTER;
|
||||
}
|
||||
|
||||
deviceFile = uartCookie->getDeviceFile();
|
||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||
if (uartDeviceMapIter == uartDeviceMap.end()) {
|
||||
sif::debug << "UartComIF::sendMessage: Device file " << deviceFile << "not in uart map"
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
fd = uartDeviceMapIter->second.fileDescriptor;
|
||||
|
||||
if (write(fd, sendData, sendLen) != (int)sendLen) {
|
||||
sif::error << "UartComIF::sendMessage: Failed to send data with error code " << errno
|
||||
<< ": Error description: " << strerror(errno) << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t UartComIF::getSendSuccess(CookieIF *cookie) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t UartComIF::requestReceiveMessage(CookieIF *cookie,
|
||||
size_t requestLen) {
|
||||
|
||||
int fd;
|
||||
std::string deviceFile;
|
||||
UartDeviceMapIter uartDeviceMapIter;
|
||||
uint8_t* bufferPtr;
|
||||
|
||||
if(requestLen == 0) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
||||
if(uartCookie == nullptr) {
|
||||
sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl;
|
||||
return NULLPOINTER;
|
||||
}
|
||||
|
||||
deviceFile = uartCookie->getDeviceFile();
|
||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||
if (uartDeviceMapIter == uartDeviceMap.end()) {
|
||||
sif::debug << "UartComIF::requestReceiveMessage: Device file " << deviceFile
|
||||
<< " not in uart map" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
fd = uartDeviceMapIter->second.fileDescriptor;
|
||||
bufferPtr = uartDeviceMapIter->second.replyBuffer.data();
|
||||
int bytesRead = read(fd, bufferPtr, requestLen);
|
||||
if (bytesRead != static_cast<int>(requestLen)) {
|
||||
sif::debug << "UartComIF::requestReceiveMessage: Only read " << bytesRead
|
||||
<< " of " << requestLen << " bytes" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
else {
|
||||
uartDeviceMapIter->second.replyLen = bytesRead;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t UartComIF::readReceivedMessage(CookieIF *cookie,
|
||||
uint8_t **buffer, size_t* size) {
|
||||
|
||||
std::string deviceFile;
|
||||
UartDeviceMapIter uartDeviceMapIter;
|
||||
|
||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
||||
if(uartCookie == nullptr) {
|
||||
sif::debug << "UartComIF::readReceivedMessage: Invalid uart cookie!" << std::endl;
|
||||
return NULLPOINTER;
|
||||
}
|
||||
|
||||
deviceFile = uartCookie->getDeviceFile();
|
||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||
if (uartDeviceMapIter == uartDeviceMap.end()) {
|
||||
sif::debug << "UartComIF::readReceivedMessage: Device file " << deviceFile
|
||||
<< " not in uart map" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
*buffer = uartDeviceMapIter->second.replyBuffer.data();
|
||||
*size = uartDeviceMapIter->second.replyLen;
|
||||
|
||||
/* Length is reset to 0 to prevent reading the same data twice */
|
||||
uartDeviceMapIter->second.replyLen = 0;
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_
|
||||
#define BSP_Q7S_COMIF_UARTCOMIF_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "UartCookie.h"
|
||||
|
||||
/**
|
||||
* @brief This is the communication interface to access serial ports on linux based operating
|
||||
* systems.
|
||||
*
|
||||
* @details The implementation follows the instructions from https://blog.mbedded.ninja/programming/
|
||||
* operating-systems/linux/linux-serial-ports-using-c-cpp/#disabling-canonical-mode
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class UartComIF: public DeviceCommunicationIF, public SystemObject {
|
||||
public:
|
||||
UartComIF(object_id_t objectId);
|
||||
|
||||
virtual ~UartComIF();
|
||||
|
||||
ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
||||
ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData,
|
||||
size_t sendLen) override;
|
||||
ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||
ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
||||
size_t requestLen) override;
|
||||
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||
size_t *size) override;
|
||||
|
||||
private:
|
||||
|
||||
using UartDeviceFile_t = std::string;
|
||||
|
||||
typedef struct UartElements {
|
||||
int fileDescriptor;
|
||||
std::vector<uint8_t> replyBuffer;
|
||||
/** Number of bytes read will be written to this variable */
|
||||
size_t replyLen;
|
||||
} UartElements_t;
|
||||
|
||||
using UartDeviceMap = std::unordered_map<UartDeviceFile_t, UartElements_t>;
|
||||
using UartDeviceMapIter = UartDeviceMap::iterator;
|
||||
|
||||
/**
|
||||
* The uart devie map stores informations of initialized uart ports.
|
||||
*/
|
||||
UartDeviceMap uartDeviceMap;
|
||||
|
||||
/**
|
||||
* @brief This function opens and configures a uart device by using the information stored
|
||||
* in the uart cookie.
|
||||
* @param uartCookie Pointer to uart cookie with information about the uart. Contains the
|
||||
* uart device file, baudrate, parity, stopbits etc.
|
||||
* @return The file descriptor of the configured uart.
|
||||
*/
|
||||
int configureUartPort(UartCookie* uartCookie);
|
||||
|
||||
/**
|
||||
* @brief This function adds the parity settings to the termios options struct.
|
||||
*
|
||||
* @param options Pointer to termios options struct which will be modified to enable or disable
|
||||
* parity checking.
|
||||
* @param uartCookie Pointer to uart cookie containing the information about the desired
|
||||
* parity settings.
|
||||
*
|
||||
*/
|
||||
void setParityOptions(struct termios* options, UartCookie* uartCookie);
|
||||
|
||||
void setStopBitOptions(struct termios* options, UartCookie* uartCookie);
|
||||
|
||||
/**
|
||||
* @brief This function sets options which are not configurable by the uartCookie.
|
||||
*/
|
||||
void setFixedOptions(struct termios* options);
|
||||
|
||||
/**
|
||||
* @brief With this function the datasize settings are added to the termios options struct.
|
||||
*/
|
||||
void setDatasizeOptions(struct termios* options, UartCookie* uartCookie);
|
||||
|
||||
/**
|
||||
* @brief This functions adds the baudrate specified in the uartCookie to the termios options
|
||||
* struct.
|
||||
*/
|
||||
void configureBaudrate(struct termios* options, UartCookie* uartCookie);
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_COMIF_UARTCOMIF_H_ */
|
@ -1,63 +0,0 @@
|
||||
#include "UartCookie.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
UartCookie::UartCookie(std::string deviceFile, uint32_t baudrate, size_t maxReplyLen) :
|
||||
deviceFile(deviceFile), baudrate(baudrate), maxReplyLen(maxReplyLen) {
|
||||
}
|
||||
|
||||
UartCookie::~UartCookie() {}
|
||||
|
||||
uint32_t UartCookie::getBaudrate() const {
|
||||
return baudrate;
|
||||
}
|
||||
|
||||
size_t UartCookie::getMaxReplyLen() const {
|
||||
return maxReplyLen;
|
||||
}
|
||||
|
||||
std::string UartCookie::getDeviceFile() const {
|
||||
return deviceFile;
|
||||
}
|
||||
|
||||
void UartCookie::setParityOdd() {
|
||||
parity = Parity::ODD;
|
||||
}
|
||||
|
||||
void UartCookie::setParityEven() {
|
||||
parity = Parity::EVEN;
|
||||
}
|
||||
|
||||
Parity UartCookie::getParity() const {
|
||||
return parity;
|
||||
}
|
||||
|
||||
void UartCookie::setBitsPerWord(uint8_t bitsPerWord_) {
|
||||
switch(bitsPerWord_) {
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
break;
|
||||
default:
|
||||
sif::debug << "UartCookie::setBitsPerWord: Invalid bits per word specified" << std::endl;
|
||||
return;
|
||||
}
|
||||
bitsPerWord = bitsPerWord_;
|
||||
}
|
||||
|
||||
uint8_t UartCookie::getBitsPerWord() const {
|
||||
return bitsPerWord;
|
||||
}
|
||||
|
||||
StopBits UartCookie::getStopBits() const {
|
||||
return stopBits;
|
||||
}
|
||||
|
||||
void UartCookie::setTwoStopBits() {
|
||||
stopBits = StopBits::TWO_STOP_BITS;
|
||||
}
|
||||
|
||||
void UartCookie::setOneStopBit() {
|
||||
stopBits = StopBits::ONE_STOP_BIT;
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
|
||||
#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
|
||||
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
#include <string>
|
||||
|
||||
enum class Parity {
|
||||
NONE,
|
||||
EVEN,
|
||||
ODD
|
||||
};
|
||||
|
||||
enum class StopBits {
|
||||
ONE_STOP_BIT,
|
||||
TWO_STOP_BITS
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Cookie for the UartComIF. There are many options available to configure the uart driver.
|
||||
* The constructor only requests for common options like the baudrate. Other options can
|
||||
* be set by member functions.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class UartCookie: public CookieIF {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor for the uart cookie.
|
||||
* @param deviceFile The device file specifying the uart to use. E.g. "/dev/ttyPS1".
|
||||
* @param baudrate The baudrate to use for input and output. Possible Baudrates are: 50,
|
||||
* 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, B19200,
|
||||
* 38400, 57600, 115200, 230400, 460800
|
||||
* @param maxReplyLen The maximum size an object using this cookie expects.
|
||||
*
|
||||
* @details Default configuration: No parity
|
||||
* 8 databits (number of bits transfered with one uart frame)
|
||||
* One stop bit
|
||||
*
|
||||
*
|
||||
*/
|
||||
UartCookie(std::string deviceFile, uint32_t baudrate, size_t maxReplyLen);
|
||||
|
||||
virtual ~UartCookie();
|
||||
|
||||
uint32_t getBaudrate() const;
|
||||
size_t getMaxReplyLen() const;
|
||||
std::string getDeviceFile() const;
|
||||
Parity getParity() const;
|
||||
uint8_t getBitsPerWord() const;
|
||||
StopBits getStopBits() const;
|
||||
|
||||
/**
|
||||
* Functions two enable parity checking.
|
||||
*/
|
||||
void setParityOdd();
|
||||
void setParityEven();
|
||||
|
||||
/**
|
||||
* Function two set number of bits per UART frame.
|
||||
*/
|
||||
void setBitsPerWord(uint8_t bitsPerWord_);
|
||||
|
||||
/**
|
||||
* Function to specify the number of stopbits.
|
||||
*/
|
||||
void setTwoStopBits();
|
||||
void setOneStopBit();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
std::string deviceFile;
|
||||
uint32_t baudrate;
|
||||
size_t maxReplyLen = 0;
|
||||
Parity parity = Parity::NONE;
|
||||
uint8_t bitsPerWord = 8;
|
||||
StopBits stopBits = StopBits::ONE_STOP_BIT;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user