From fddfa7487be1d5431e55b6570b8552f2a403cf3f Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 3 Nov 2015 15:27:24 +0100 Subject: [PATCH] tests/driver_kw2xrf: simplified Makefile --- tests/driver_kw2xrf/Makefile | 80 ++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/tests/driver_kw2xrf/Makefile b/tests/driver_kw2xrf/Makefile index 4ab259b726..f7b257f141 100644 --- a/tests/driver_kw2xrf/Makefile +++ b/tests/driver_kw2xrf/Makefile @@ -5,51 +5,6 @@ FEATURES_REQUIRED = periph_spi periph_gpio BOARD_INSUFFICIENT_MEMORY := stm32f0discovery nucleo-f334 weio -ifneq (,$(filter pba-d-01-kw2x,$(BOARD))) - DRIVER ?= kw2xrf - USE_BOARD_PARAMETERS:=true -endif - -ifneq (,$(DRIVER)) - USEMODULE += $(DRIVER) -else - # default to kw2xrf - USEMODULE += kw2xrf -endif - -ifneq (true,$(USE_BOARD_PARAMETERS)) - # This adds . to include path so generic kw2xrf_params.h gets picked - # up. All boards actually having such a device on board should define - # USE_BOARD_PARAMETERS=true above to skip this step, as the board provides - # this header. - CFLAGS += -I$(CURDIR) - -ifneq (,$(KWRF_SHARED_SPI)) - CFLAGS += -DKW2XRF_SHARED_SPI=$(DKW2XRF_SHARED_SPI) -else - CFLAGS += -DKW2XRFD_SHARED_SPI=1 # activate spi-lock -endif -ifneq (,$(KWRF_SPI)) - CFLAGS += -DKWRF_SPI=$(KWRF_SPI) -else - CFLAGS += -DKWRF_SPI=SPI_0 # set default -endif -ifneq (,$(KWRF_CS)) - CFLAGS += -DKWRF_CS=$(KWRF_CS) -else - CFLAGS += -DKWRF_CS=GPIO_PIN\(0,0\) # set default -endif -ifneq (,$(KWRF_INT)) - CFLAGS += -DKWRF_INT=$(KWRF_INT) -else - CFLAGS += -DKWRF_INT=GPIO_PIN\(0,1\) # set default -endif -ifneq (,$(KWRF_SPI_SPEED)) - CFLAGS += -DKWRF_SPI_SPEED=$(KWRF_SPI_SPEED) -endif - -endif # USE_BOARD_PARAMETERS=false - USEMODULE += auto_init_gnrc_netif USEMODULE += gnrc_netif USEMODULE += gnrc_nomac @@ -58,6 +13,41 @@ USEMODULE += shell USEMODULE += shell_commands USEMODULE += ps +# define parameters for selected boards +ifneq (,$(filter pba-d-01-kw2x,$(BOARD))) + DRIVER := kw2xrf + USE_BOARD_PARAMETERS := true +endif + +# only set specific parameters if not using board configuration +ifneq (true,$(USE_BOARD_PARAMETERS)) + + # set default device parameters in case they are undefined + DRIVER ?= kw2xrf + KW2XRF_SHARED_SPI ?= 1 + KWRF_SPI ?= SPI_0 + KWRF_SPI_SPEED ?= SPI_SPEED_5MHZ + KWRF_CS ?= GPIO_PIN\(0,0\) + KWRF_INT ?= GPIO_PIN\(0,1\) + + # export parameters + CFLAGS += -DKW2XRF_SHARED_SPI=$(KW2XRF_SHARED_SPI) + CFLAGS += -DKWRF_SPI=$(KWRF_SPI) + CFLAGS += -DKWRF_SPI_SPEED=$(KWRF_SPI_SPEED) + CFLAGS += -DKWRF_CS=$(KWRF_CS) + CFLAGS += -DKWRF_INT=$(KWRF_INT) + + # This adds . to include path so generic kw2xrf_params.h gets picked + # up. All boards actually having such a device on board should define + # USE_BOARD_PARAMETERS=true above to skip this step, as the board provides + # this header. + CFLAGS += -I$(CURDIR) + +endif + +# finally include the actual chosen driver +USEMODULE += $(DRIVER) + CFLAGS += -DDEVELHELP include $(RIOTBASE)/Makefile.include