#include "spiCore.h" SPI_HandleTypeDef* spiHandle = NULL; DMA_HandleTypeDef* hdma_tx = NULL; DMA_HandleTypeDef* hdma_rx = NULL; void setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle) { hdma_tx = txHandle; hdma_rx = rxHandle; } void getDmaHandles(DMA_HandleTypeDef** txHandle, DMA_HandleTypeDef** rxHandle) { *txHandle = hdma_tx; *rxHandle = hdma_rx; } void assignSpiHandle(SPI_HandleTypeDef *spiHandle_) { if(spiHandle_ == NULL) { return; } spiHandle = spiHandle_; } SPI_HandleTypeDef* getSpiHandle() { return spiHandle; } /** * @brief This function handles DMA Rx interrupt request. * @param None * @retval None */ void SPIx_DMA_RX_IRQHandler(void) { HAL_DMA_IRQHandler(spiHandle->hdmarx); } /** * @brief This function handles DMA Tx interrupt request. * @param None * @retval None */ void SPIx_DMA_TX_IRQHandler(void) { HAL_DMA_IRQHandler(spiHandle->hdmatx); } /** * @brief This function handles SPIx interrupt request. * @param None * @retval None */ void SPIx_IRQHandler(void) { HAL_SPI_IRQHandler(spiHandle); }