2021-06-04 16:01:38 +02:00
|
|
|
#ifndef FSFW_HAL_STM32H7_SPI_SPICOMIF_H_
|
|
|
|
#define FSFW_HAL_STM32H7_SPI_SPICOMIF_H_
|
|
|
|
|
2021-06-04 16:34:38 +02:00
|
|
|
|
2021-06-04 16:01:38 +02:00
|
|
|
#include "fsfw/devicehandlers/DeviceCommunicationIF.h"
|
|
|
|
#include "fsfw/objectmanager/SystemObject.h"
|
|
|
|
|
2021-06-04 16:34:38 +02:00
|
|
|
#include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
|
|
|
|
#include "stm32h7xx_hal_spi.h"
|
|
|
|
#include "stm32h743xx.h"
|
|
|
|
|
2021-06-04 16:01:38 +02:00
|
|
|
class SpiComIF:
|
|
|
|
public SystemObject,
|
|
|
|
public DeviceCommunicationIF {
|
|
|
|
public:
|
2021-06-04 16:34:38 +02:00
|
|
|
SpiComIF(object_id_t objectId, SPI_TypeDef* spiInstance, spi::TransferModes transferMode);
|
2021-06-04 16:01:38 +02:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// DeviceCommunicationIF overrides
|
|
|
|
virtual ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
|
|
|
virtual ReturnValue_t sendMessage(CookieIF *cookie,
|
|
|
|
const uint8_t * sendData, size_t sendLen) override;
|
|
|
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
|
|
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
|
|
|
size_t requestLen) override;
|
|
|
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
|
|
|
uint8_t **buffer, size_t *size) override;
|
|
|
|
private:
|
2021-06-04 16:34:38 +02:00
|
|
|
SPI_HandleTypeDef spiHandle;
|
2021-06-04 16:01:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ */
|