fsfw-example-common/stm32h7/STM32TestTask.cpp

34 lines
813 B
C++
Raw Normal View History

2021-07-12 23:32:12 +02:00
#include "STM32TestTask.h"
#include "stm32h7xx_nucleo.h"
#include "OBSWConfig.h"
2021-07-12 21:21:03 +02:00
STM32TestTask::STM32TestTask(object_id_t objectId, bool enablePrintout,
2021-10-27 17:09:25 +02:00
bool blinkyLed): TestTask(objectId), blinkyLed(blinkyLed) {
2021-07-16 12:44:35 +02:00
BSP_LED_Init(LED1);
BSP_LED_Init(LED2);
BSP_LED_Init(LED3);
2021-07-12 21:21:03 +02:00
}
ReturnValue_t STM32TestTask::performPeriodicAction() {
if(blinkyLed) {
#if OBSW_ETHERNET_USE_LEDS == 0
BSP_LED_Toggle(LED1);
BSP_LED_Toggle(LED2);
#endif
BSP_LED_Toggle(LED3);
}
2021-10-27 18:38:47 +02:00
if(testSpi) {
spiTest->performOperation();
}
2021-07-12 21:21:03 +02:00
return TestTask::performPeriodicAction();
}
2021-10-27 18:38:47 +02:00
ReturnValue_t STM32TestTask::initialize() {
if(testSpi) {
spiComIF = new SpiComIF(objects::SPI_COM_IF);
spiTest = new SpiTest(*spiComIF);
}
return TestTask::initialize();
}