From 75f4d02598ad8af58e73394ac9b0262a72cf841b Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Tue, 19 Dec 2017 22:37:06 +0100 Subject: [PATCH 1/2] SPI.h: remove unused variable warnings --- STM32F1/libraries/SPI/src/SPI.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/STM32F1/libraries/SPI/src/SPI.h b/STM32F1/libraries/SPI/src/SPI.h index 686d23d4f..09c50a4eb 100644 --- a/STM32F1/libraries/SPI/src/SPI.h +++ b/STM32F1/libraries/SPI/src/SPI.h @@ -160,11 +160,11 @@ class SPISettings { /* Should move this to within the class once tested out, just for tidyness */ -static uint8_t ff = 0XFF; -static void (*_spi1_this); -static void (*_spi2_this); +static uint8_t __attribute__ ((unused)) ff = 0XFF; +static void __attribute__ ((unused)) (*_spi1_this); +static void __attribute__ ((unused)) (*_spi2_this); #if BOARD_NR_SPI >= 3 -static void (*_spi3_this); +static void __attribute__ ((unused)) (*_spi3_this); #endif /** From 4f3ceaab43120b33efa1b519080e7ba00a63cad0 Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Wed, 20 Dec 2017 12:34:35 +0100 Subject: [PATCH 2/2] Library SPI: SPI.h remove warnings --- STM32F1/libraries/SPI/src/SPI.cpp | 10 ++++++++-- STM32F1/libraries/SPI/src/SPI.h | 11 ----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/STM32F1/libraries/SPI/src/SPI.cpp b/STM32F1/libraries/SPI/src/SPI.cpp index c07e2ea4a..b6d1f0cf4 100644 --- a/STM32F1/libraries/SPI/src/SPI.cpp +++ b/STM32F1/libraries/SPI/src/SPI.cpp @@ -86,6 +86,11 @@ static const spi_pins board_spi_pins[] __FLASH__ = { #endif }; +static void (*_spi1_this); +static void (*_spi2_this); +#if BOARD_NR_SPI >= 3 + static void (*_spi3_this); +#endif /* * Constructor @@ -399,8 +404,9 @@ void SPIClass::dmaTransferSet(const void *transmitBuf, void *receiveBuf) { dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &_currentSetting->spi_d->regs->DR, dma_bit_size, receiveBuf, dma_bit_size, (DMA_MINC_MODE | DMA_TRNS_CMPLT ));// receive buffer DMA if (!transmitBuf) { - transmitBuf = &ff; - dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR, dma_bit_size, + static uint8_t ff = 0XFF; + transmitBuf = &ff; + dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR, dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, (DMA_FROM_MEM));// Transmit FF repeatedly } else { diff --git a/STM32F1/libraries/SPI/src/SPI.h b/STM32F1/libraries/SPI/src/SPI.h index 09c50a4eb..6dc7bcd3f 100644 --- a/STM32F1/libraries/SPI/src/SPI.h +++ b/STM32F1/libraries/SPI/src/SPI.h @@ -156,17 +156,6 @@ class SPISettings { friend class SPIClass; }; - -/* - Should move this to within the class once tested out, just for tidyness -*/ -static uint8_t __attribute__ ((unused)) ff = 0XFF; -static void __attribute__ ((unused)) (*_spi1_this); -static void __attribute__ ((unused)) (*_spi2_this); -#if BOARD_NR_SPI >= 3 -static void __attribute__ ((unused)) (*_spi3_this); -#endif - /** * @brief Wirish SPI interface. *