Skip to content

Commit

Permalink
Kbuild: Convert USDDECK_USE_ALT_PINS_AND_SPI to Kconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasdn committed Feb 24, 2022
1 parent b51ed24 commit 6de7b09
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/deck/api/deck_spi3.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "FreeRTOS.h"
#include "semphr.h"

#include "autoconf.h"
#include "cfassert.h"
#include "config.h"
#include "nvicconf.h"
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/deck/drivers/src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/deck/drivers/src/usddeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions src/drivers/src/i2c_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#include "nvicconf.h"
#include "sleepus.h"

#include "autoconf.h"

//DEBUG
#ifdef I2CDRV_DEBUG_LOG_EVENTS
#include "usec_time.h"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/drivers/src/ws2812_cf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 6de7b09

Please sign in to comment.