added spi transfer modes
This commit is contained in:
parent
66a7a4dbbe
commit
ff7421e1dd
@ -16,7 +16,8 @@ TransferStates transferState = TransferStates::IDLE;
|
||||
DMA_HandleTypeDef txDmaHandle;
|
||||
DMA_HandleTypeDef rxDmaHandle;
|
||||
|
||||
GyroL3GD20H::GyroL3GD20H(SPI_HandleTypeDef *spiHandle): spiHandle(spiHandle) {
|
||||
GyroL3GD20H::GyroL3GD20H(SPI_HandleTypeDef *spiHandle, spi::TransferModes transferMode):
|
||||
spiHandle(spiHandle), transferMode(transferMode) {
|
||||
set_dma_handles(&txDmaHandle, &rxDmaHandle);
|
||||
set_spi_msp_functions(&hal_spi_msp_init_dma, spiHandle, &hal_spi_msp_deinit_dma, spiHandle);
|
||||
GPIO_InitTypeDef chipSelect = {};
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "stm32h7xx_hal.h"
|
||||
#include "stm32h7xx_hal_spi.h"
|
||||
|
||||
#include "../spi/spiDefinitions.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
#include <cstdint>
|
||||
@ -18,7 +19,7 @@ enum class TransferStates {
|
||||
|
||||
class GyroL3GD20H {
|
||||
public:
|
||||
GyroL3GD20H(SPI_HandleTypeDef* spiHandle);
|
||||
GyroL3GD20H(SPI_HandleTypeDef* spiHandle, spi::TransferModes transferMode);
|
||||
|
||||
ReturnValue_t initialize();
|
||||
ReturnValue_t performOperation();
|
||||
@ -26,6 +27,7 @@ public:
|
||||
private:
|
||||
|
||||
SPI_HandleTypeDef* spiHandle;
|
||||
spi::TransferModes transferMode;
|
||||
static constexpr size_t recvBufferSize = 32 * 10;
|
||||
static std::array<uint8_t, recvBufferSize> rxBuffer;
|
||||
std::array<uint8_t, 32> txBuffer;
|
||||
|
@ -8,6 +8,12 @@
|
||||
|
||||
namespace spi {
|
||||
|
||||
enum TransferModes {
|
||||
POLLING,
|
||||
INTERRUPT,
|
||||
DMA
|
||||
};
|
||||
|
||||
void assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef* spiHandle);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user