From d464dd737836c04ac8ec426bbe58ddca07e0304a Mon Sep 17 00:00:00 2001 From: Martin Luessi Date: Mon, 27 Dec 2021 11:59:53 -0800 Subject: [PATCH] SPI: fix compilation on F4 when DSHOT_BITBANG is not used --- src/main/drivers/bus_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/bus_spi.c b/src/main/drivers/bus_spi.c index 6d1ab8dcd..99d3c9549 100644 --- a/src/main/drivers/bus_spi.c +++ b/src/main/drivers/bus_spi.c @@ -570,7 +570,7 @@ bool spiSetBusInstance(extDevice_t *dev, uint32_t device) void spiInitBusDMA() { uint32_t device; -#ifdef STM32F4 +#if defined(STM32F4) && defined(USE_DSHOT_BITBANG) /* Check https://www.st.com/resource/en/errata_sheet/dm00037591-stm32f405407xx-and-stm32f415417xx-device-limitations-stmicroelectronics.pdf * section 2.1.10 which reports an errata that corruption may occurs on DMA2 if AHB peripherals (eg GPIO ports) are * access concurrently with APB peripherals (eg SPI busses). Bitbang DSHOT uses DMA2 to write to GPIO ports. If this @@ -608,7 +608,7 @@ void spiInitBusDMA() dmaTxIdentifier = DMA_NONE; continue; } -#ifdef STM32F4 +#if defined(STM32F4) && defined(USE_DSHOT_BITBANG) if (dshotBitbangActive && (DMA_DEVICE_NO(dmaTxIdentifier) == 2)) { dmaTxIdentifier = DMA_NONE; break; @@ -642,7 +642,7 @@ void spiInitBusDMA() dmaRxIdentifier = DMA_NONE; continue; } -#ifdef STM32F4 +#if defined(STM32F4) && defined(USE_DSHOT_BITBANG) if (dshotBitbangActive && (DMA_DEVICE_NO(dmaRxIdentifier) == 2)) { dmaRxIdentifier = DMA_NONE; break;