added pst for peripheral tests

This commit is contained in:
Robin Müller 2021-06-09 23:53:44 +02:00
parent ac549216de
commit 5cbe18caa6
No known key found for this signature in database
GPG Key ID: BE6480244DFE612C
7 changed files with 81 additions and 2 deletions

View File

@ -124,7 +124,7 @@ void InitMission::createTasks() {
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
FixedTimeslotTaskIF* testDevicesTask = TaskFactory::instance()->createFixedTimeslotTask(
"PST_TEST_TASK", 10, 1024 * 2, 1.0, nullptr);
"PST_TEST_TASK", 7, 1024 * 2, 1.0, nullptr);
result = pst::pollingSequenceDevices(testDevicesTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -151,6 +151,19 @@ void InitMission::createTasks() {
task::printInitError("Test Task", objects::TEST_TASK);
}
#if OBSW_PERIPHERAL_PST == 1
FixedTimeslotTaskIF* peripheralPst = TaskFactory::instance()->createFixedTimeslotTask(
"PST_PERIPHERAL_TASK", 9, 1024 * 2, 2.0, nullptr);
result = pst::pstPeripheralsTest(peripheralPst);
if(result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "InitMission::createTasks: Test PST initialization failed!" << std::endl;
#else
sif::printError("InitMission::createTasks: Test PST initialization faiedl!\n");
#endif
}
#endif
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Starting tasks.." << std::endl;
#else
@ -181,6 +194,10 @@ void InitMission::createTasks() {
assemblyTask->startTask();
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
#if OBSW_PERIPHERAL_PST == 1
peripheralPst->startTask();
#endif /* OBSW_PERIPHERAL_PST == 1 */
testTask->startTask();
#if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -10,6 +10,8 @@
#include <common/stm32_nucleo/networking/TmTcLwIpUdpBridge.h>
#include <common/stm32_nucleo/STM32TestTask.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/monitoring/MonitoringMessageContent.h>
#include <fsfw/storagemanager/PoolManager.h>
@ -17,6 +19,18 @@
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#if OBSW_PERFORM_L3GD20H_TEST == 1
#include "fsfw_hal/stm32h7/spi/SpiCookie.h"
#include "fsfw_hal/stm32h7/spi/SpiComIF.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
namespace spi {
SPI_TypeDef spiDriver = {};
SPI_HandleTypeDef spiHandle = {};
}
#endif
void ObjectFactory::produce(void* args) {
/* Located inside GenericFactory source file */
Factory::setStaticFrameworkObjectIds();
@ -53,4 +67,15 @@ void ObjectFactory::produce(void* args) {
/* Test Device Handler */
new STM32TestTask(objects::TEST_TASK, false, true);
#if OBSW_PERFORM_L3GD20H_TEST == 1
new SpiComIF(objects::SPI_COM_IF, &spi::spiDriver, &spi::spiHandle,
spi::TransferModes::POLLING);
auto spiCookie = new SpiCookie(0, spi::SpiBus::SPI_1, 3900000, spi::SpiModes::MODE_3,
GPIO_PIN_14, GPIOD, 32);
auto gyroDevice = new GyroHandlerL3GD20H(objects::SPI_DEVICE_TEST, objects::SPI_COM_IF,
spiCookie);
gyroDevice->setStartUpImmediately();
#endif
}

View File

@ -16,6 +16,11 @@
#define OBSW_ATTEMPT_DHCP_CONN 1
#define OBSW_PERIPHERAL_PST 0
#define OBSW_PERFORM_SPI_TEST 0
#define OBSW_PERFORM_L3GD20H_TEST 0
#if OBSW_ATTEMPT_DHCP_CONN == 0
#define MAX_DHCP_TRIES 0
#else

View File

@ -8,6 +8,10 @@ enum mission_objects {
/* 0x62 ('b') Board and mission specific objects */
UDP_BRIDGE = 0x62000300,
UDP_POLLING_TASK = 0x62000400,
SPI_COM_IF = 0x63001000,
SPI_DEVICE_TEST = 0x74001000,
/* Generic name for FSFW static ID setter */
DOWNLINK_DESTINATION = UDP_BRIDGE
};

View File

@ -2,4 +2,31 @@
* Add polling sequence initialization which are not common to every BSP here.
*/
#include "pollingSequenceFactory.h"
#include "OBSWConfig.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
#if OBSW_PERFORM_L3GD20H_TEST == 1
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length, DeviceHandlerIF::GET_READ);
#endif
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!" << std::endl;
#else
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -7,6 +7,7 @@
class FixedTimeslotTaskIF;
namespace pst {
ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence);
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF* thisSequence);
}

View File

@ -22,7 +22,7 @@ ReturnValue_t STM32TestTask::performPeriodicAction() {
}
ReturnValue_t STM32TestTask::performOneShotAction() {
performSpiL3gd20hTest();
// performSpiL3gd20hTest();
return HasReturnvaluesIF::RETURN_OK;
}