fsfw-example-stm32h7-rtems/bsp_stm32h7_rtems/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp

38 lines
1.4 KiB
C++
Raw Permalink Normal View History

2021-07-16 11:10:39 +02:00
/**
* 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) {
2022-05-27 02:17:19 +02:00
uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
2021-07-16 11:10:39 +02:00
#if OBSW_PERFORM_L3GD20H_TEST == 1
2022-05-27 02:17:19 +02:00
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);
2021-07-16 11:10:39 +02:00
#endif
2022-05-27 02:17:19 +02:00
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
2021-07-16 11:10:39 +02:00
#if FSFW_CPP_OSTREAM_ENABLED == 1
2022-05-27 02:17:19 +02:00
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!"
<< std::endl;
2021-07-16 11:10:39 +02:00
#else
2022-05-27 02:17:19 +02:00
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
2021-07-16 11:10:39 +02:00
#endif
2022-05-27 02:17:19 +02:00
return HasReturnvaluesIF::RETURN_FAILED;
2021-07-16 11:10:39 +02:00
}