fsfw-hal/stm32h7/spi/SpiCookie.h

39 lines
1.0 KiB
C
Raw Normal View History

2021-06-04 16:01:38 +02:00
#ifndef FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_
#define FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_
2021-06-04 16:34:38 +02:00
#include "spiDefinitions.h"
2021-06-04 16:01:38 +02:00
#include "fsfw/devicehandlers/CookieIF.h"
2021-06-04 16:34:38 +02:00
#include "stm32h743xx.h"
2021-06-04 16:01:38 +02:00
class SpiCookie: public CookieIF {
public:
2021-06-10 12:05:49 +02:00
SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, SPI_TypeDef* spiInstance,
uint32_t spiSpeed, spi::SpiModes spiMode,
2021-06-04 17:13:14 +02:00
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;
2021-06-10 12:05:49 +02:00
SPI_HandleTypeDef& getSpiHandle();
2021-06-04 17:13:14 +02:00
2021-06-04 16:01:38 +02:00
private:
2021-06-04 16:34:38 +02:00
address_t deviceAddress;
2021-06-10 12:05:49 +02:00
SPI_HandleTypeDef spiHandle = {};
2021-06-04 16:34:38 +02:00
spi::SpiBus spiIdx;
uint32_t spiSpeed;
spi::SpiModes spiMode;
uint16_t chipSelectGpioPin;
GPIO_TypeDef* chipSelectGpioPort;
2021-06-04 17:13:14 +02:00
const size_t maxRecvSize;
2021-06-04 16:01:38 +02:00
};
#endif /* FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ */