mission and config folders added , make file is added

This commit is contained in:
2021-06-21 13:42:47 +02:00
parent caea75b0a8
commit 6a65c7af33
34 changed files with 1463 additions and 0 deletions

14
bsp_linux/CMakeLists.txt Normal file
View File

@ -0,0 +1,14 @@
target_sources(${TARGET_NAME}
PRIVATE
main.cpp
)
add_subdirectory(core)
add_subdirectory(fsfwconfig)
add_subdirectory(utility)
add_subdirectory(test)
target_include_directories(${TARGET_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

7
bsp_linux/bsp_linux.mk Normal file
View File

@ -0,0 +1,7 @@
CSRC += $(wildcard $(CURRENTPATH)/*.c)
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
CSRC += $(wildcard $(CURRENTPATH)/core/*.c)
CXXSRC += $(wildcard $(CURRENTPATH)/core/*.cpp)
CSRC += $(wildcard $(CURRENTPATH)/utility/*.c)

View File

@ -0,0 +1,5 @@
target_sources(${TARGET_NAME}
PRIVATE
InitMission.cpp
ObjectFactory.cpp
)

View File

@ -0,0 +1,167 @@
#include "../../bsp_linux/core/InitMission.h"
#include <OBSWConfig.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream>
#include "../../bsp_linux/fsfwconfig/objects/systemObjectList.h"
#include "../../bsp_linux/fsfwconfig/OBSWConfig.h"
#include "../fsfwconfig/pollingsequence/PollingSequenceArduino.h"
void InitMission::createTasks(){
/* TMTC Distribution */
PeriodicTaskIF* distributerTask = TaskFactory::instance()->
createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.100, nullptr);
ReturnValue_t result = distributerTask->addComponent(
objects::CCSDS_DISTRIBUTOR);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = distributerTask->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
/* UDP bridge */
PeriodicTaskIF* udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.2, nullptr);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* udpPollingTask = TaskFactory::instance()->
createPeriodicTask("UDP_POLLING", 80,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
PeriodicTaskIF* eventTask = TaskFactory::instance()->
createPeriodicTask("EVENT", 20,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.100, nullptr);
result = eventTask->addComponent(objects::EVENT_MANAGER);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
/* PUS Services */
PeriodicTaskIF* pusVerification = TaskFactory::instance()->
createPeriodicTask("PUS_VERIF_1", 40,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusEvents = TaskFactory::instance()->
createPeriodicTask("PUS_VERIF_1", 60,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusHighPrio = TaskFactory::instance()->
createPeriodicTask("PUS_HIGH_PRIO", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.200, nullptr);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusMedPrio = TaskFactory::instance()->
createPeriodicTask("PUS_HIGH_PRIO", 40,
PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.8, nullptr);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->
createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
1.6, nullptr);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
FixedTimeslotTaskIF* arduinoTask = TaskFactory::instance()->
createFixedTimeslotTask("ARDUINO_TASK",40,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.102, nullptr);
result = pollingSequenceArduinoFunction(arduinoTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::createTasks:ArduinoPST initialization failed!"
<< std::endl;
}
#if OBSW_ADD_TEST_CODE == 1
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->
createFixedTimeslotTask("PST_TEST_TASK", 10,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = pst::pollingSequenceTestFunction(testTimeslotTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::createTasks: Test PST initialization "
<< "failed!" << std::endl;
}
PeriodicTaskIF* testTask = TaskFactory::instance()->
createPeriodicTask("TEST", 15, PeriodicTaskIF::MINIMUM_STACK_SIZE,
1.0, nullptr);
result = testTask->addComponent(objects::TEST_TASK);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "InitMission::createTasks: Adding test task "
<< "failed" << std::endl;
}
#endif
//Main thread sleep
sif::debug << "Starting Tasks in 2 seconds" << std::endl;
TaskFactory::delayTask(2000);
distributerTask->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
//serializeTask->startTask();
arduinoTask->startTask();
//payloadTask->startTask();
eventTask->startTask();
pusVerification->startTask();
pusEvents->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTimeslotTask->startTask();
testTask->startTask();
#endif
sif::debug << "Tasks started.." << std::endl;
}

View File

@ -0,0 +1,8 @@
#ifndef MISSION_CORE_INITMISSION_H_
#define MISSION_CORE_INITMISSION_H_
namespace InitMission {
void createTasks();
};
#endif /* MISSION_CORE_INITMISSION_H_ */

View File

@ -0,0 +1,86 @@
#include "../../bsp_linux/core/ObjectFactory.h"
#include <OBSWConfig.h>
#include <mission/utility/TmFunnel.h>
#include <mission/core/GenericFactory.h>
#include <fsfw/monitoring/MonitoringMessageContent.h>
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include "../../bsp_linux/fsfwconfig/datapool/dataPoolInit.h"
#include "../../bsp_linux/fsfwconfig/objects/systemObjectList.h"
#include "../../bsp_linux/fsfwconfig/OBSWConfig.h"
#include "../../bsp_linux/fsfwconfig/tmtc/apid.h"
#include "../../bsp_linux/fsfwconfig/tmtc/pusIds.h"
#if OBSW_ADD_TEST_CODE == 1
#include <mission/test/TestTask.h>
#endif
void Factory::setStaticFrameworkObjectIds(){
MonitoringReportContent<float>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<double>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<uint32_t>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<int32_t>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<int16_t>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<uint16_t>::timeStamperId = objects::TIME_STAMPER;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
PusServiceBase::packetSource = objects::PUS_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
Factory::setStaticFrameworkObjectIds();
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TC_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TM_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 6;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {32, 64, 512,
1024, 2048, 4096};
const uint16_t n_elements[NUMBER_OF_POOLS] = {200, 100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::IPC_STORE, element_sizes,
n_elements);
}
ObjectFactory::produceGenericObjects();
/* TMTC Reception via UDP socket */
new TmTcUnixUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
#if OBSW_ADD_TEST_CODE == 1
new TestTask(objects::TEST_TASK, false);
#endif
}

View File

@ -0,0 +1,17 @@
/*
* ObjectFactory.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef MISSION_CORE_OBJECTFACTORY_H_
#define MISSION_CORE_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
};
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */

View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PRIVATE
ipc/missionMessageTypes.cpp
)
# Add include paths for the executable
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -0,0 +1,57 @@
#ifndef CONFIG_FSFWCONFIG_H_
#define CONFIG_FSFWCONFIG_H_
#include <cstddef>
#include <cstdint>
//! Used to determine whether C++ ostreams are used
//! Those can lead to code bloat.
#define FSFW_CPP_OSTREAM_ENABLED 1
//! Reduced printout to further decrease code size
//! Be careful, this also turns off most diagnostic prinouts!
#define FSFW_ENHANCED_PRINTOUT 0
//! Can be used to enable additional debugging printouts for developing the FSFW
#define FSFW_PRINT_VERBOSITY_LEVEL 0
//! 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 !
#define FSFW_CSB_FIFO_DEPTH 6
//! 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 0
#if FSFW_OBJ_EVENT_TRANSLATION == 1
#define FSFW_DEBUG_OUTPUT 1
//! Specify whether info events are printed too.
#define FSFW_DEBUG_INFO 1
#include <translateObjects.h>
#include <translateEvents.h>
#else
#define FSFW_DEBUG_OUTPUT 0
#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
namespace fsfwconfig {
//! Default timestamp size. The default timestamp will be an eight byte CDC
//! short timestamp.
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8;
//! 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;
}
#endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -0,0 +1,15 @@
/**
* @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_
#define ADD_TEST_FOLDER 0
#define OBSW_ADD_TEST_CODE 0
// Define not used yet, PUS stack and TMTC tasks are always started
#define ADD_PUS_STACK 1
#endif /* FSFWCONFIG_OBSWCONFIG_H_ */

View File

@ -0,0 +1,46 @@
/*
* dataPoolInit.cpp
*
* brief: Initialisation function for all variables in the data pool.
* This file was auto-generated by getDataPoolFromFLPmib.py via
* the flpmib database at 2018-06-04T12:02:46+00:00.
*/
#include "../../../bsp_linux/fsfwconfig/datapool/dataPoolInit.h"
void dataPoolInit(std::map<uint32_t, PoolEntryIF*>* pool_map) {
uint32_t testVar[1] = { 0 };
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::DUMMY1,
new PoolEntry<uint32_t>(testVar, 1)));
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::DUMMY2,
new PoolEntry<uint32_t>(testVar, 1)));
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::DUMMY3,
new PoolEntry<uint32_t>(testVar, 1)));
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::DUMMY4,
new PoolEntry<uint32_t>(testVar, 1)));
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::DUMMY5,
new PoolEntry<uint32_t>(testVar, 1)));
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::DUMMY6,
new PoolEntry<uint32_t>(testVar, 1)));
int32_t testVarSigned[1] = { 0 };
pool_map->insert(
std::pair<int32_t, PoolEntryIF*>(datapool::LIMIT_VAR,
new PoolEntry<int32_t>(testVarSigned, 1)));
/*float t_Centroid_PoolId[2] = {0,0};
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::Centroid_PoolId,
new PoolEntry<float>(t_Centroid_PoolId, 2)));
uint32_t t_CentroidTime_PoolId[2] = {0,0};
pool_map->insert(
std::pair<uint32_t, PoolEntryIF*>(datapool::CentroidTime_PoolId,
new PoolEntry<uint32_t>(t_CentroidTime_PoolId, 2)));
*/
//TODO: define your pool map entries here
}

View File

@ -0,0 +1,32 @@
/*
* dataPoolInit.h
*
* brief: Initialisation function for all variables in the data pool.
* This file was auto-generated by getDataPoolFromFLPmib.py via
* the flpmib database at 2018-06-04T12:02:46+00:00.
*/
#ifndef DATAPOOLINIT_H_
#define DATAPOOLINIT_H_
#include <fsfw/datapool/DataPool.h>
namespace datapool {
enum opus_variable_id {
NO_PARAMETER = 0x0, //This PID is used to denote a non-existing param in the OBSW (NOPARAME), Size: 1
DUMMY1 = 0x100000,
DUMMY2 = 0x100001,
DUMMY3 = 0x100002,
DUMMY4 = 0x100003,
DUMMY5 = 0x100004,
DUMMY6 = 0x100005,//TEST VAR
LIMIT_VAR = 0x100006,
TIME_STAMPER = 0x100007,
//Centroid_PoolId = 0x100008,
//CentroidTime_PoolId = 0x100009
//TODO: add your unique datapool Ids here
};
}
void dataPoolInit( std::map<uint32_t, PoolEntryIF*>* pool_map );
#endif /* DATAPOOLINIT_H_ */

View File

@ -0,0 +1,20 @@
/*
* subsystemIdRanges.h
*
* Created on: Jul 27, 2018
* Author: gaisser
*/
#ifndef FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_
#define FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_
namespace SUBSYSTEM_ID {
enum {
DUMMY = 10,
//VISIBLE=11
//TODO: add your subsystem id for your device here
};
}
#endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */

View File

@ -0,0 +1,10 @@
CXXSRC += $(wildcard $(CURRENTPATH)/datapool/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
INCLUDES += $(CURRENTPATH)
INCLUDES += $(CURRENTPATH)/events
INCLUDES += $(CURRENTPATH)/returnvalues
INCLUDES += $(CURRENTPATH)/tmtc

View File

@ -0,0 +1,16 @@
/*
* MissionMessageTypes.cpp
*
* Created on: 17.06.2016
* Author: baetz
*/
#include <fsfw/ipc/CommandMessageCleaner.h>
void messagetypes::clearMissionMessage(CommandMessage* message) {
switch((message->getCommand()>>8) & 0xff){
default:
message->setCommand(CommandMessage::CMD_NONE);
break;
}
}

View File

@ -0,0 +1,28 @@
/*
* MissionMessageTypes.h
*
* Created on: 16.06.2016
* Author: baetz
*/
#ifndef FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
#define FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
#include <fsfw/ipc/FwMessageTypes.h>
class CommandMessage;
namespace messagetypes {
//First type must have number MESSAGE_TYPE::FW_MESSAGES_COUNT!
//Remember to add new message types to the clearMissionMessage() function below!
enum MISSION_MESSAGE_TYPE {
COSTUM_MESSAGE = FW_MESSAGES_COUNT,
};
void clearMissionMessage(CommandMessage* message);
}
#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */

View File

@ -0,0 +1,59 @@
#ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#include <fsfw/objectmanager/frameworkObjects.h>
namespace objects {
enum mission_objects {
UDP_BRIDGE = 0x50000300,
UDP_POLLING_TASK = 0x50000400,
TM_FUNNEL = 0x50000500,
/****************Assembly********************/
SOFTWARE = 0x1,
DUMMY_ASS = 0xCAFECAFE,
/****************Controller******************/
DUMMY_CONTROLLER = 0xCAFEAFFE,
/****************Device Handler**************/
DUMMY1 = 0x01,
DUMMY2 = 0x02,
DUMMY3 = 0x03,
DUMMY4 = 0x04,
DUMMY5 = 0x05,
DUMMY6 = 0x06,
DUMMY7 = 0x07,
DUMMY8 = 0x08,
/****************MISC*********************/
TIME_STAMPER = 0x09,
/**************TC Handling****************/
CCSDS_DISTRIBUTOR = 0x10,
PUS_DISTRIBUTOR = 0x11,
/****** 0x49 ('I') for Communication Interfaces *****/
//TEST_ECHO_COM_IF = 0x4900AFFE,
/**************** Test *********************/
//TEST_DEVICE_HANDLER = 0x4400AFFE,
//TEST_TASK = 0x4400CAFE,
//TEST_DEVICE_SERIALIZE=0x4401CAFE,
/**************** PCO *********************/
//PCO_HANDLER= 0x12,
//PCO_COMMIF=0x13,
//CENTROID_INJECTOR=0x14,
//CENTROID_WRITER = 0x15
//TODO: add the object ids for your device and your communication interface
};
}
#endif /* FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */

View File

@ -0,0 +1,21 @@
/*
* PollingSequenceCentroid.h
*
* Created on: May 1, 2021
* Author: mala
*/
#ifndef BSP_LINUX_FSFWCONFIG_POLLINGSEQUENCE_POLLINGSEQUENCEARDUINO_H_
#define BSP_LINUX_FSFWCONFIG_POLLINGSEQUENCE_POLLINGSEQUENCEARDUINO_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include "../../fsfwconfig/OBSWConfig.h"
class FixedTimeslotTaskIF;
ReturnValue_t pollingSequenceArduinoFunction(FixedTimeslotTaskIF *thisSequence);
#endif /* BSP_LINUX_FSFWCONFIG_POLLINGSEQUENCE_POLLINGSEQUENCEARDUINO_H_ */

View File

@ -0,0 +1,38 @@
/*
* PollingSequenceCentroidFunction.cpp
*
* Created on: May 1, 2021
* Author: mala
*/
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include "../../../bsp_linux/fsfwconfig/objects/systemObjectList.h"
#include "../../../bsp_linux/fsfwconfig/OBSWConfig.h"
#include "PollingSequenceArduino.h"
ReturnValue_t pollingSequenceArduinoFunction(
FixedTimeslotTaskIF* thisSequence){
uint32_t length = thisSequence->getPeriodMs();
//thisSequence->addSlot(objects::CENTROID_INJECTOR, length * 0, 2);
//thisSequence->addSlot(objects::CENTROID_WRITER, length * 0.1, 2);
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0, 0);
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0.2, 1);
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0.4, 2);
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0.6, 3);
//thisSequence->addSlot(objects::CENTROID_WRITER, length * 0.1, 2);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
else {
sif::error << "pollingSequenceCentroidFunction::initialize has errors!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
}

View File

@ -0,0 +1,22 @@
/*
* classIds.h
*
* Created on: 30.06.2016
* Author: baetz
*/
#ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
#define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
#include <fsfw/returnvalues/FwClassIds.h>
namespace CLASS_ID {
enum {
DUMMY_HANDLER = FW_CLASS_ID_COUNT, //DDH
//VISIBLE_HANDLER_CLASS=FW_CLASS_ID_COUNT+1
//TODO: add your arduino handler class id
};
}
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */

View File

@ -0,0 +1,19 @@
/*
* apid.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef FSFWCONFIG_TMTC_APID_H_
#define FSFWCONFIG_TMTC_APID_H_
#include <cstdint>
namespace apid{
static const uint16_t APID = 0xEF;
};
#endif /* FSFWCONFIG_TMTC_APID_H_ */

View File

@ -0,0 +1,20 @@
#ifndef FSFWCONFIG_TMTC_PUSIDS_H_
#define FSFWCONFIG_TMTC_PUSIDS_H_
namespace pus {
enum {
PUS_SERVICE_1 = 1,
PUS_SERVICE_2 = 2,
PUS_SERVICE_3 = 3,
PUS_SERVICE_5 = 5,
PUS_SERVICE_8 = 8,
PUS_SERVICE_9 = 9,
PUS_SERVICE_17 = 17,
PUS_SERVICE_200 = 200
};
}
#endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */

53
bsp_linux/main.cpp Normal file
View File

@ -0,0 +1,53 @@
#include <fsfw/datapool/DataPool.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/TaskFactory.h>
#include <bsp_linux/core/InitMission.h>
#include <bsp_linux/core/ObjectFactory.h>
#include <mission/test/MutexExample.h>
#include <mission/utility/PusPacketCreator.h>
#include <iostream>
#include "../bsp_linux/fsfwconfig/datapool/dataPoolInit.h"
#ifdef WIN32
static const char* COMPILE_PRINTOUT = "Windows";
#elif LINUX
static const char* COMPILE_PRINTOUT = "Linux";
#else
static const char* COMPILE_PRINTOUT = "unknown OS";
#endif
// This is configured for linux without \cr
ServiceInterfaceStream sif::debug("DEBUG", false);
ServiceInterfaceStream sif::info("INFO", false);
ServiceInterfaceStream sif::warning("WARNING", false);
ServiceInterfaceStream sif::error("ERROR", false, false, true);
ObjectManagerIF *objectManager = nullptr;
//Initialize Data Pool
DataPool dataPool(dataPoolInit);
#include <array>
int main() {
std::cout << "-- FSFW Example (Hosted) --" << std::endl;
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
objectManager = new ObjectManager(ObjectFactory::produce);
objectManager->initialize();
InitMission::createTasks();
MutexExample::example();
PusPacketCreator::createPusPacketAndPrint();
// Permanent loop.
for(;;) {
// sleep main thread, not needed anymore.
TaskFactory::delayTask(5000);
}
return 0;
}

View File

@ -0,0 +1,7 @@
target_sources(${TARGET_NAME}
PUBLIC
printChar.c
)

View File

@ -0,0 +1,21 @@
/*
* printChar.c
*
* Created on: Jul 30, 2018
* Author: gaisser
*/
#include <stdio.h>
#include <stdbool.h>
void printChar(const char* character, bool errStream) {
if(errStream) {
fprintf( stderr, "%c", *character);
} else {
printf("%c", *character);
}
}