Unverified Commit 64a45f6e authored by Bodmer's avatar Bodmer Committed by GitHub

Merge pull request #1241 from matixan/master

Add option to use SPI3 in STM32F4 (and possibly also in F2)
parents bcce0fc7 afd78101
...@@ -551,6 +551,9 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t ...@@ -551,6 +551,9 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
#elif (TFT_SPI_PORT == 2) #elif (TFT_SPI_PORT == 2)
extern "C" void DMA1_Stream4_IRQHandler(); extern "C" void DMA1_Stream4_IRQHandler();
void DMA1_Stream4_IRQHandler(void) void DMA1_Stream4_IRQHandler(void)
#elif (TFT_SPI_PORT == 3)
extern "C" void DMA1_Stream5_IRQHandler();
void DMA1_Stream5_IRQHandler(void)
#endif #endif
{ {
// Call the default end of buffer handler // Call the default end of buffer handler
...@@ -572,8 +575,12 @@ bool TFT_eSPI::initDMA(bool ctrl_cs) ...@@ -572,8 +575,12 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
__HAL_RCC_DMA2_CLK_ENABLE(); // Enable DMA2 clock __HAL_RCC_DMA2_CLK_ENABLE(); // Enable DMA2 clock
dmaHal.Init.Channel = DMA_CHANNEL_3; // DMA channel 3 is for SPI1 TX dmaHal.Init.Channel = DMA_CHANNEL_3; // DMA channel 3 is for SPI1 TX
#elif (TFT_SPI_PORT == 2) #elif (TFT_SPI_PORT == 2)
__HAL_RCC_DMA1_CLK_ENABLE(); // Enable DMA2 clock __HAL_RCC_DMA1_CLK_ENABLE(); // Enable DMA1 clock
dmaHal.Init.Channel = DMA_CHANNEL_0; // DMA channel 0 is for SPI2 TX dmaHal.Init.Channel = DMA_CHANNEL_0; // DMA channel 0 is for SPI2 TX
#elif (TFT_SPI_PORT == 3)
__HAL_RCC_DMA1_CLK_ENABLE(); // Enable DMA1 clock
dmaHal.Init.Channel = DMA_CHANNEL_0; // DMA channel 0 is for SPI3 TX
#endif #endif
dmaHal.Init.Mode = DMA_NORMAL; //DMA_CIRCULAR; // // Normal = send buffer once dmaHal.Init.Mode = DMA_NORMAL; //DMA_CIRCULAR; // // Normal = send buffer once
......
...@@ -170,6 +170,13 @@ ...@@ -170,6 +170,13 @@
// The DMA hard-coding for SPI2 is in TFT_eSPI_STM32.c as follows: // The DMA hard-coding for SPI2 is in TFT_eSPI_STM32.c as follows:
// DMA_CHANNEL_4 // DMA_CHANNEL_4
// DMA1_Stream4_IRQn and DMA1_Stream4_IRQHandler() // DMA1_Stream4_IRQn and DMA1_Stream4_IRQHandler()
#elif (TFT_SPI_PORT == 3)
// Initialise processor specific SPI and DMA instances - used by init()
#define INIT_TFT_DATA_BUS spiHal.Instance = SPI3; \
dmaHal.Instance = DMA1_Stream5
// The DMA hard-coding for SPI3 is in TFT_eSPI_STM32.c as follows:
// DMA_CHANNEL_4
// DMA1_Stream5_IRQn and DMA1_Stream5_IRQHandler()
#endif #endif
#elif defined (STM32F1xx) #elif defined (STM32F1xx)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment