This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
fsfw_example_public/common/stm32_nucleo/STM32TestTask.cpp

35 lines
944 B
C++

#include "STM32TestTask.h"
#include "stm32h7xx_nucleo.h"
#include "OBSWConfig.h"
#include "fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
STM32TestTask::STM32TestTask(object_id_t objectId, bool enablePrintout,
bool blinkyLed): TestTask(objectId, enablePrintout),
blinkyLed(blinkyLed) {
}
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);
}
return TestTask::performPeriodicAction();
}
ReturnValue_t STM32TestTask::performOneShotAction() {
performSpiL3gd20hTest();
return HasReturnvaluesIF::RETURN_OK;
}
void STM32TestTask::performSpiL3gd20hTest() {
SPI_HandleTypeDef spiHandle = {};
GyroL3GD20H gyroDevice(&spiHandle, spi::TransferModes::DMA);
gyroDevice.initialize();
gyroDevice.performOperation();
}