From a78a254a527e09fdd8ab54d5fee9d0049ffdb2d4 Mon Sep 17 00:00:00 2001 From: Daniel Fekete Date: Thu, 15 Jun 2017 06:04:37 +0200 Subject: [PATCH] spi: Move spi_ff_buffer into the class --- STM32/libraries/SPI/src/SPI.cpp | 4 +--- STM32/libraries/SPI/src/SPI.h | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/STM32/libraries/SPI/src/SPI.cpp b/STM32/libraries/SPI/src/SPI.cpp index 52a6a2a..0a98a4a 100644 --- a/STM32/libraries/SPI/src/SPI.cpp +++ b/STM32/libraries/SPI/src/SPI.cpp @@ -4,8 +4,6 @@ #include "stm32_dma.h" -static uint8_t spi_ff_buffer = 0XFF; - #if defined(MOSI) || defined(MISO) || defined(SCK) SPIClass SPI(SPI1, MOSI, MISO, SCK); #else @@ -191,7 +189,7 @@ uint8_t SPIClass::dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_ #endif if (!transmitBuf) { - transmitBuf = &spi_ff_buffer; + transmitBuf = (uint8_t*)&repeatTransmitData; hdma_spi_tx.Init.MemInc = DMA_MINC_DISABLE; } else { //Need to change the MINC mode since dmaSend with MINC 0 or Null transmitBuf may have been called last diff --git a/STM32/libraries/SPI/src/SPI.h b/STM32/libraries/SPI/src/SPI.h index 0cf477d..e792338 100644 --- a/STM32/libraries/SPI/src/SPI.h +++ b/STM32/libraries/SPI/src/SPI.h @@ -102,6 +102,9 @@ class SPIClass { SPI_HandleTypeDef spiHandle = {}; + + uint16_t repeatTransmitData = 0XFFFF; + private: uint32_t apb_freq = 0;