refactored spi components for stm32

This commit is contained in:
2021-06-10 12:05:49 +02:00
parent 499ff5dd12
commit 5c40ca9ae8
13 changed files with 187 additions and 94 deletions

View File

@ -35,8 +35,7 @@ public:
* @param spiHandle
* @param transferMode
*/
SpiComIF(object_id_t objectId, SPI_TypeDef* spiInstance, SPI_HandleTypeDef* spiHandle,
spi::TransferModes transferMode);
SpiComIF(object_id_t objectId, spi::TransferModes transferMode);
/**
* Allows the user to disable cache maintenance on the TX buffer. This can be done if the
@ -81,7 +80,6 @@ private:
uint32_t defaultPollingTimeout = 50;
spi::TransferModes transferMode;
SPI_HandleTypeDef* spiHandle;
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
dur_millis_t timeoutMs = 20;
@ -101,16 +99,16 @@ private:
SpiDeviceMap spiDeviceMap;
ReturnValue_t handlePollingSendOperation(uint8_t* recvPtr, SpiCookie* spiCookie,
const uint8_t * sendData, size_t sendLen);
ReturnValue_t handleInterruptSendOperation(uint8_t* recvPtr, SpiCookie* spiCookie,
const uint8_t * sendData, size_t sendLen);
ReturnValue_t handleDmaSendOperation(uint8_t* recvPtr, SpiCookie* spiCookie,
const uint8_t * sendData, size_t sendLen);
ReturnValue_t handleIrqSendOperation(uint8_t* recvPtr, SpiCookie* spiCookie,
const uint8_t * sendData, size_t sendLen);
ReturnValue_t genericIrqSendSetup(uint8_t* recvPtr, SpiCookie* spiCookie,
const uint8_t * sendData, size_t sendLen);
ReturnValue_t handlePollingSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle,
SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen);
ReturnValue_t handleInterruptSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle,
SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen);
ReturnValue_t handleDmaSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle,
SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen);
ReturnValue_t handleIrqSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle,
SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen);
ReturnValue_t genericIrqSendSetup(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle,
SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen);
ReturnValue_t halErrorHandler(HAL_StatusTypeDef status);
static void spiTransferTxCompleteCallback(SPI_HandleTypeDef *hspi, void* args);