moved msp init to user

This commit is contained in:
Robin Müller 2021-06-10 21:31:42 +02:00
parent dcc61873b2
commit cdb7dbff07
No known key found for this signature in database
GPG Key ID: BE6480244DFE612C
2 changed files with 31 additions and 7 deletions

View File

@ -10,8 +10,6 @@
#include <common/stm32_nucleo/networking/TmTcLwIpUdpBridge.h>
#include <common/stm32_nucleo/STM32TestTask.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/monitoring/MonitoringMessageContent.h>
#include <fsfw/storagemanager/PoolManager.h>
@ -19,11 +17,15 @@
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#if OBSW_PERFORM_L3GD20H_TEST == 1
#include "fsfw_hal/stm32h7/spi/SpiCookie.h"
#include "fsfw_hal/stm32h7/spi/SpiComIF.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h"
#include "fsfw_hal/stm32h7/spi/spiCore.h"
DMA_HandleTypeDef* txHandle = nullptr;
DMA_HandleTypeDef* rxHandle = nullptr;
#endif
void ObjectFactory::produce(void* args) {
@ -65,9 +67,31 @@ void ObjectFactory::produce(void* args) {
#if OBSW_PERFORM_L3GD20H_TEST == 1
new SpiComIF(objects::SPI_COM_IF, spi::TransferModes::INTERRUPT);
auto spiCookie = new SpiCookie(0, spi::SpiBus::SPI_1, SPI1, 3900000, spi::SpiModes::MODE_3,
GPIO_PIN_14, GPIOD, 32);
spi::MspCfgBase* mspCfg = nullptr;
spi::TransferModes transferMode = spi::TransferModes::INTERRUPT;
if(transferMode == spi::TransferModes::POLLING) {
auto typedCfg = new spi::MspPollingConfigStruct();
spi::h743zi::standardPollingCfg(*typedCfg);
mspCfg = typedCfg;
}
else if(transferMode == spi::TransferModes::INTERRUPT) {
auto typedCfg = new spi::MspIrqConfigStruct();
spi::h743zi::standardInterruptCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS);
mspCfg = typedCfg;
}
else if(transferMode == spi::TransferModes::DMA) {
auto typedCfg = new spi::MspDmaConfigStruct();
txHandle = new DMA_HandleTypeDef();
rxHandle = new DMA_HandleTypeDef();
spi::setDmaHandles(txHandle, rxHandle);
spi::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS,
IrqPriorities::HIGHEST_FREERTOS, IrqPriorities::HIGHEST_FREERTOS);
mspCfg = typedCfg;
}
new SpiComIF(objects::SPI_COM_IF);
auto spiCookie = new SpiCookie(0, spi::SpiBus::SPI_1, transferMode, mspCfg, 3900000,
spi::SpiModes::MODE_3, GPIO_PIN_14, GPIOD, 32);
auto gyroDevice = new GyroHandlerL3GD20H(objects::SPI_DEVICE_TEST, objects::SPI_COM_IF,
spiCookie);
gyroDevice->setStartUpImmediately();

@ -1 +1 @@
Subproject commit 8f61c23e624e55e44c3410f0204010559e2bd7d9
Subproject commit 621fe97d5d06cc358e46caf76e8a9f8826e5b919