1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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.
This commit is contained in:
Martine Lenders 2016-10-21 12:59:26 +02:00 committed by Martine Lenders
parent 20e1fce5b7
commit 6104d44cbe
4 changed files with 56 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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