msp init improvements

This commit is contained in:
2021-10-27 18:05:18 +02:00
parent d675621b73
commit cb7399b999
6 changed files with 90 additions and 51 deletions

View File

@@ -3,6 +3,7 @@
#include "spiDefinitions.h"
#include "mspInit.h"
#include "../definitions.h"
#include "fsfw/devicehandlers/CookieIF.h"
@@ -20,11 +21,6 @@
class SpiCookie: public CookieIF {
friend class SpiComIF;
public:
/**
* Typedef for STM32 GPIO pair where the first entry is the port used (e.g. GPIOA)
* and the second entry is the pin number
*/
using GpioPair = std::pair<GPIO_TypeDef*, uint16_t>;
/**
* Allows construction of a SPI cookie for a connected SPI device
@@ -44,7 +40,7 @@ public:
*/
SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode,
spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode,
size_t maxRecvSize, GpioPair csGpio = GpioPair(nullptr, 0));
size_t maxRecvSize, stm32h7::GpioCfg csGpio = stm32h7::GpioCfg(nullptr, 0, 0));
uint16_t getChipSelectGpioPin() const;
GPIO_TypeDef* getChipSelectGpioPort();
@@ -64,7 +60,7 @@ private:
spi::SpiModes spiMode;
spi::TransferModes transferMode;
volatile spi::TransferStates transferState = spi::TransferStates::IDLE;
GpioPair csGpio;
stm32h7::GpioCfg csGpio;
// The MSP configuration is cached here. Be careful when using this, it is automatically
// deleted by the SPI communication interface if it is not required anymore!