fsfw-hal/stm32h7/spi/SpiCookie.h

39 lines
1.0 KiB
C++

#ifndef FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_
#define FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_
#include "spiDefinitions.h"
#include "fsfw/devicehandlers/CookieIF.h"
#include "stm32h743xx.h"
class SpiCookie: public CookieIF {
public:
SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, SPI_TypeDef* spiInstance,
uint32_t spiSpeed, spi::SpiModes spiMode,
uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize);
uint16_t getChipSelectGpioPin() const;
GPIO_TypeDef* getChipSelectGpioPort();
address_t getDeviceAddress() const;
spi::SpiBus getSpiIdx() const;
spi::SpiModes getSpiMode() const;
uint32_t getSpiSpeed() const;
size_t getMaxRecvSize() const;
SPI_HandleTypeDef& getSpiHandle();
private:
address_t deviceAddress;
SPI_HandleTypeDef spiHandle = {};
spi::SpiBus spiIdx;
uint32_t spiSpeed;
spi::SpiModes spiMode;
uint16_t chipSelectGpioPin;
GPIO_TypeDef* chipSelectGpioPort;
const size_t maxRecvSize;
};
#endif /* FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ */