Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kbuild: Convert some deck defines to Kconfig #969

Merged
merged 4 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ config DEBUG_PRINT_ON_UART1
deck documentation on https://www.bitcraze.io/ for more information about
pin allocation.

config DEBUG_DECK_IGNORE_OW
bool "Do not enumerate OW based expansion decks"
default n
help
Do not enumerate decks discovered by OneWire memory. This might be useful
if one deck memory is very wrong. One could use the Crazyflie as a
passive onewire memory writer.

endmenu

menu "Platform configuration"
Expand Down
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: 5 additions & 3 deletions src/deck/core/deck_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "debug.h"
#include "static_mem.h"

#include "autoconf.h"

#ifdef CONFIG_DEBUG
#define DECK_INFO_DBG_PRINT(fmt, ...) DEBUG_PRINT(fmt, ## __VA_ARGS__)
#else
Expand Down Expand Up @@ -86,7 +88,7 @@ DeckInfo * deckInfo(int i)
// Dummy driver for decks that do not have a driver implemented
static const DeckDriver dummyDriver;

#ifndef IGNORE_OW_DECKS
#ifndef CONFIG_DEBUG_DECK_IGNORE_OWS
static const DeckDriver * findDriver(DeckInfo *deck)
{
char name[30];
Expand Down Expand Up @@ -131,7 +133,7 @@ void printDeckInfo(DeckInfo *info)
}
}

#ifndef IGNORE_OW_DECKS
#ifndef CONFIG_DEBUG_DECK_IGNORE_OWS
static bool infoDecode(DeckInfo * info)
{
uint8_t crcHeader;
Expand Down Expand Up @@ -183,7 +185,7 @@ static void enumerateDecks(void)
nDecks = 0;
}

#ifndef IGNORE_OW_DECKS
#ifndef CONFIG_DEBUG_DECK_IGNORE_OWS
for (int i = 0; i < nDecks; i++)
{
DECK_INFO_DBG_PRINT("Enumerating deck %i\n", i);
Expand Down
8 changes: 3 additions & 5 deletions src/deck/drivers/interface/lpsTdoa2Tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

#include "mac.h"

#include "autoconf.h"

extern uwbAlgorithm_t uwbTdoa2TagAlgorithm;

#ifdef LOCODECK_NR_OF_ANCHORS
#define LOCODECK_NR_OF_TDOA2_ANCHORS LOCODECK_NR_OF_ANCHORS
#else
#define LOCODECK_NR_OF_TDOA2_ANCHORS 8
#endif
#define LOCODECK_NR_OF_TDOA2_ANCHORS CONFIG_DECK_LOCO_NR_OF_ANCHORS

typedef struct {
const locoAddress_t anchorAddress[LOCODECK_NR_OF_TDOA2_ANCHORS];
Expand Down
18 changes: 18 additions & 0 deletions src/deck/drivers/src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ config DECK_LOCO
on-board of the Crazyflie and there is no need for an external
computer for position estimation.

config DECK_LOCO_NR_OF_ANCHORS
int "The number of anchors in use"
default 8
depends on DECK_LOCO
help
The number of anchors in your Loco setup. See documentation on
https://www.bitcraze.io/ for more details.

choice
prompt "Algorithm to use"
depends on DECK_LOCO
Expand Down Expand Up @@ -219,6 +227,16 @@ 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
Changes the DECK_GPIO_RX2 for CS and SPI3 for spi.
This requires hardware changes on the deck.
Check out for instructions on the micro SD card deck
product page on https://www.bitcraze.io/

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