fsfw-example-common/stm32h7/STM32TestTask.cpp

34 lines
773 B
C++
Raw Normal View History

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