spi: Move spi_ff_buffer into the class
This commit is contained in:
parent
0b9943973f
commit
a78a254a52
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include "stm32_dma.h"
|
#include "stm32_dma.h"
|
||||||
|
|
||||||
static uint8_t spi_ff_buffer = 0XFF;
|
|
||||||
|
|
||||||
#if defined(MOSI) || defined(MISO) || defined(SCK)
|
#if defined(MOSI) || defined(MISO) || defined(SCK)
|
||||||
SPIClass SPI(SPI1, MOSI, MISO, SCK);
|
SPIClass SPI(SPI1, MOSI, MISO, SCK);
|
||||||
#else
|
#else
|
||||||
|
@ -191,7 +189,7 @@ uint8_t SPIClass::dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!transmitBuf) {
|
if (!transmitBuf) {
|
||||||
transmitBuf = &spi_ff_buffer;
|
transmitBuf = (uint8_t*)&repeatTransmitData;
|
||||||
hdma_spi_tx.Init.MemInc = DMA_MINC_DISABLE;
|
hdma_spi_tx.Init.MemInc = DMA_MINC_DISABLE;
|
||||||
} else {
|
} else {
|
||||||
//Need to change the MINC mode since dmaSend with MINC 0 or Null transmitBuf may have been called last
|
//Need to change the MINC mode since dmaSend with MINC 0 or Null transmitBuf may have been called last
|
||||||
|
|
|
@ -102,6 +102,9 @@ class SPIClass {
|
||||||
|
|
||||||
|
|
||||||
SPI_HandleTypeDef spiHandle = {};
|
SPI_HandleTypeDef spiHandle = {};
|
||||||
|
|
||||||
|
uint16_t repeatTransmitData = 0XFFFF;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t apb_freq = 0;
|
uint32_t apb_freq = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue