From eaaaaef863923c49be414fdb4c8d3d60ed447e3f Mon Sep 17 00:00:00 2001 From: Jonas Danielsson Date: Thu, 24 Feb 2022 12:36:22 +0100 Subject: [PATCH] Kbuild: Convert USDDECK_USE_ALT_PINS_AND_SPI to Kconfig --- src/deck/api/deck_spi3.c | 3 ++- src/deck/drivers/src/Kconfig | 8 ++++++++ src/deck/drivers/src/usddeck.c | 4 +++- src/drivers/src/i2c_drv.c | 6 ++++-- src/drivers/src/ws2812_cf2.c | 4 +++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/deck/api/deck_spi3.c b/src/deck/api/deck_spi3.c index 75bb87026e..8344003b26 100644 --- a/src/deck/api/deck_spi3.c +++ b/src/deck/api/deck_spi3.c @@ -34,6 +34,7 @@ #include "FreeRTOS.h" #include "semphr.h" +#include "autoconf.h" #include "cfassert.h" #include "config.h" #include "nvicconf.h" @@ -264,7 +265,7 @@ void spi3EndTransaction() xSemaphoreGive(spiMutex); } -#ifdef USDDECK_USE_ALT_PINS_AND_SPI +#ifdef CONFIG_DECK_USD_USE_ALT_PINS_AND_SPI void __attribute__((used)) SPI_TX_DMA_IRQHandler(void) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; diff --git a/src/deck/drivers/src/Kconfig b/src/deck/drivers/src/Kconfig index be49b83bf4..8ab2ecca2c 100644 --- a/src/deck/drivers/src/Kconfig +++ b/src/deck/drivers/src/Kconfig @@ -219,6 +219,14 @@ config DECK_USD (or any other firmware code) to implement usecases that requires the use of files. +config DECK_USD_USE_ALT_PINS_AND_SPI + bool "Use alternate SPI and alternate CS pin" + default n + depends on DECK_USD + help + Use DECK_GPIO_RX2 for CS and SPI3 for spi, this requires + some hardware intervention. + config DECK_ZRANGER bool "Support the Z-ranger deck V1 (discontinued)" default n diff --git a/src/deck/drivers/src/usddeck.c b/src/deck/drivers/src/usddeck.c index 978a591f76..f143bb2a71 100644 --- a/src/deck/drivers/src/usddeck.c +++ b/src/deck/drivers/src/usddeck.c @@ -63,8 +63,10 @@ #include "mem.h" #include "eventtrigger.h" +#include "autoconf.h" + // Hardware defines -#ifdef USDDECK_USE_ALT_PINS_AND_SPI +#ifdef CONFIG_DECK_USD_USE_ALT_PINS_AND_SPI #include "deck_spi3.h" #define USD_CS_PIN DECK_GPIO_RX2 diff --git a/src/drivers/src/i2c_drv.c b/src/drivers/src/i2c_drv.c index 79bd7ed9ec..3d69c73244 100644 --- a/src/drivers/src/i2c_drv.c +++ b/src/drivers/src/i2c_drv.c @@ -49,6 +49,8 @@ #include "nvicconf.h" #include "sleepus.h" +#include "autoconf.h" + //DEBUG #ifdef I2CDRV_DEBUG_LOG_EVENTS #include "usec_time.h" @@ -169,7 +171,7 @@ static const I2cDef deckBusDef = .gpioAF = GPIO_AF_I2C1, .dmaPerif = RCC_AHB1Periph_DMA1, .dmaChannel = DMA_Channel_1, -#ifdef USDDECK_USE_ALT_PINS_AND_SPI +#ifdef CONFIG_DECK_USD_USE_ALT_PINS_AND_SPI .dmaRxStream = DMA1_Stream5, .dmaRxIRQ = DMA1_Stream5_IRQn, .dmaRxTCFlag = DMA_FLAG_TCIF5, @@ -645,7 +647,7 @@ void __attribute__((used)) I2C1_EV_IRQHandler(void) i2cdrvEventIsrHandler(&deckBus); } -#ifdef USDDECK_USE_ALT_PINS_AND_SPI +#ifdef CONFIG_DECK_USD_USE_ALT_PINS_AND_SPI void __attribute__((used)) DMA1_Stream5_IRQHandler(void) #else void __attribute__((used)) DMA1_Stream0_IRQHandler(void) diff --git a/src/drivers/src/ws2812_cf2.c b/src/drivers/src/ws2812_cf2.c index 1e8f26d941..3320fb0372 100644 --- a/src/drivers/src/ws2812_cf2.c +++ b/src/drivers/src/ws2812_cf2.c @@ -35,6 +35,8 @@ #include "FreeRTOS.h" #include "semphr.h" +#include "autoconf.h" + //#define TIM1_CCR1_Address 0x40012C34 // physical memory address of Timer 3 CCR1 register static TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; @@ -247,7 +249,7 @@ void ws2812DmaIsr(void) } } -#ifndef USDDECK_USE_ALT_PINS_AND_SPI +#ifndef CONFIG_DECK_USD_USE_ALT_PINS_AND_SPI void __attribute__((used)) DMA1_Stream5_IRQHandler(void) { ws2812DmaIsr();