added SPI code
This commit is contained in:
@ -1,23 +1,32 @@
|
||||
#include "ObjectFactory.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include <objects/systemObjectList.h>
|
||||
#include "devices/devAddresses.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
#include <mission/core/GenericFactory.h>
|
||||
#include "mission/utility/TmFunnel.h"
|
||||
#include "mission/core/GenericFactory.h"
|
||||
|
||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||
#include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h"
|
||||
#include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h"
|
||||
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
|
||||
|
||||
#include "example_common/stm32h7/STM32TestTask.h"
|
||||
|
||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <fsfw/monitoring/MonitoringMessageContent.h>
|
||||
#include <fsfw/storagemanager/PoolManager.h>
|
||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||
#include "fsfw/monitoring/MonitoringMessageContent.h"
|
||||
#include "fsfw/storagemanager/PoolManager.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#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) {
|
||||
/* Located inside GenericFactory source file */
|
||||
@ -45,16 +54,47 @@ void ObjectFactory::produce(void* args) {
|
||||
new PoolManager(objects::IPC_STORE, poolCfg);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||
/* UDP Server */
|
||||
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE,
|
||||
objects::CCSDS_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE);
|
||||
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
/* Test Device Handler */
|
||||
new STM32TestTask(objects::TEST_TASK, false, true);
|
||||
|
||||
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
||||
|
||||
spi::MspCfgBase* mspCfg = nullptr;
|
||||
spi::TransferModes transferMode = spi::TransferModes::DMA;
|
||||
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(devaddress::L3GD20H, 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();
|
||||
gyroDevice->setGoNormalModeAtStartup();
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user