From 6104d44cbe867ca1f2be9287a9e497a0347ad327 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 21 Oct 2016 12:59:26 +0200 Subject: [PATCH] examples: fix default channel setting for all radios The config assumed it was a 2.4 GHz radio. This solution isn't perfect either but eliminates a few more cases. --- examples/default/Makefile | 18 ++++++++++++++---- examples/gnrc_border_router/Makefile | 18 ++++++++++++++---- examples/gnrc_minimal/Makefile | 18 ++++++++++++++---- examples/microcoap_server/Makefile | 18 ++++++++++++++---- 4 files changed, 56 insertions(+), 16 deletions(-) diff --git a/examples/default/Makefile b/examples/default/Makefile index d7c6fa6fe1..5d0f9788a5 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -69,8 +69,18 @@ ifneq (,$(filter msba2,$(BOARD))) USEMODULE += random endif -# Set a custom 802.15.4 channel if needed -DEFAULT_CHANNEL ?= 26 -CFLAGS += -DDEFAULT_CHANNEL=$(DEFAULT_CHANNEL) - include $(RIOTBASE)/Makefile.include + +# Set a custom channel if needed +ifeq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz + DEFAULT_CHANNEL ?= 0 + CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) +else + ifeq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz + DEFAULT_CHANNEL ?= 5 + CFLAGS += -DIEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL) + else # radio is IEEE 802.15.4 2.4 GHz + DEFAULT_CHANNEL ?= 26 + CFLAGS += -DIEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) + endif +endif diff --git a/examples/gnrc_border_router/Makefile b/examples/gnrc_border_router/Makefile index 08e477ffb8..d344dbd07d 100644 --- a/examples/gnrc_border_router/Makefile +++ b/examples/gnrc_border_router/Makefile @@ -43,10 +43,6 @@ USEMODULE += ps # include UHCP client USEMODULE += gnrc_uhcpc -# Set a custom 802.15.4 channel if needed -DEFAULT_CHANNEL ?= 26 -CFLAGS += -DDEFAULT_CHANNEL=$(DEFAULT_CHANNEL) - # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: @@ -66,3 +62,17 @@ term: host-tools host-tools: $(AD)env -u CC -u CFLAGS make -C $(RIOTBASE)/dist/tools + +# Set a custom channel if needed +ifeq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz + DEFAULT_CHANNEL ?= 0 + CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) +else + ifeq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz + DEFAULT_CHANNEL ?= 5 + CFLAGS += -DIEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL) + else # radio is IEEE 802.15.4 2.4 GHz + DEFAULT_CHANNEL ?= 26 + CFLAGS += -DIEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) + endif +endif diff --git a/examples/gnrc_minimal/Makefile b/examples/gnrc_minimal/Makefile index a6e798b08a..10945a0e10 100644 --- a/examples/gnrc_minimal/Makefile +++ b/examples/gnrc_minimal/Makefile @@ -36,13 +36,23 @@ USEMODULE += gnrc_icmpv6_echo # Use minimal standard PRNG USEMODULE += prng_minstd -# Set a custom 802.15.4 channel if needed -DEFAULT_CHANNEL ?= 26 -CFLAGS += -DDEFAULT_CHANNEL=$(DEFAULT_CHANNEL) - CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DGNRC_IPV6_NETIF_ADDR_NUMOF=4 -DGNRC_IPV6_NC_SIZE=1 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 include $(RIOTBASE)/Makefile.include + +# Set a custom channel if needed +ifeq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz + DEFAULT_CHANNEL ?= 0 + CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) +else + ifeq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz + DEFAULT_CHANNEL ?= 5 + CFLAGS += -DIEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL) + else # radio is IEEE 802.15.4 2.4 GHz + DEFAULT_CHANNEL ?= 26 + CFLAGS += -DIEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) + endif +endif diff --git a/examples/microcoap_server/Makefile b/examples/microcoap_server/Makefile index 31dc9cf921..17876c3c13 100644 --- a/examples/microcoap_server/Makefile +++ b/examples/microcoap_server/Makefile @@ -33,10 +33,6 @@ CFLAGS += -DMICROCOAP_DEBUG # include this for printing IP addresses USEMODULE += shell_commands -# Set a custom 802.15.4 channel if needed -DEFAULT_CHANNEL ?= 26 -CFLAGS += -DDEFAULT_CHANNEL=$(DEFAULT_CHANNEL) - # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: @@ -60,3 +56,17 @@ endif QUIET ?= 1 include $(RIOTBASE)/Makefile.include + +# Set a custom channel if needed +ifeq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz + DEFAULT_CHANNEL ?= 0 + CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) +else + ifeq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz + DEFAULT_CHANNEL ?= 5 + CFLAGS += -DIEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL) + else # radio is IEEE 802.15.4 2.4 GHz + DEFAULT_CHANNEL ?= 26 + CFLAGS += -DIEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) + endif +endif