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-22 15:30:08 +02:00
|
|
|
STM32TestTask::STM32TestTask(object_id_t objectId, bool enablePrintout,
|
|
|
|
bool blinkyLed)
|
2022-05-05 20:55:28 +02:00
|
|
|
: TestTask(objectId), blinkyLed(blinkyLed) {
|
|
|
|
BSP_LED_Init(LED1);
|
|
|
|
BSP_LED_Init(LED2);
|
|
|
|
BSP_LED_Init(LED3);
|
2021-07-12 21:21:03 +02:00
|
|
|
}
|
|
|
|
|
2022-05-29 17:34:43 +02:00
|
|
|
ReturnValue_t STM32TestTask::initialize() {
|
|
|
|
if (testSpi) {
|
|
|
|
spiComIF = new SpiComIF(objects::SPI_COM_IF);
|
|
|
|
spiTest = new SpiTest(*spiComIF);
|
|
|
|
}
|
|
|
|
return TestTask::initialize();
|
|
|
|
}
|
|
|
|
|
2021-07-12 21:21:03 +02:00
|
|
|
ReturnValue_t STM32TestTask::performPeriodicAction() {
|
2022-05-05 20:55:28 +02:00
|
|
|
if (blinkyLed) {
|
2022-05-29 18:41:33 +02:00
|
|
|
#if OBSW_ETHERNET_USE_LED1_LED2 == 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
|
|
|
}
|