From 67f737b5e0536af038ba031654e7e199a53034d2 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 16 Sep 2021 18:47:29 +0200 Subject: [PATCH 1/2] drivers/cc110x: use pseudo-modules for band selection --- drivers/cc110x/Makefile.dep | 5 +++++ drivers/cc110x/include/cc110x_params.h | 14 ++++++++++++++ makefiles/pseudomodules.inc.mk | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/drivers/cc110x/Makefile.dep b/drivers/cc110x/Makefile.dep index faca855235..f54ac30bb7 100644 --- a/drivers/cc110x/Makefile.dep +++ b/drivers/cc110x/Makefile.dep @@ -8,3 +8,8 @@ FEATURES_REQUIRED += periph_spi ifneq (,$(filter gnrc_ipv6,$(USEMODULE))) USEMODULE += gnrc_sixlowpan endif + +# default to 433 MHz operation +ifeq (,$(filter cc110x_%mhz,$(USEMODULE))) + USEMODULE += cc110x_433mhz +endif diff --git a/drivers/cc110x/include/cc110x_params.h b/drivers/cc110x/include/cc110x_params.h index d5e787cbbe..14f1cf4b58 100644 --- a/drivers/cc110x/include/cc110x_params.h +++ b/drivers/cc110x/include/cc110x_params.h @@ -59,7 +59,13 @@ extern "C" { * Choose the one matching the base frequency your transceiver uses, otherwise * the TX power setting will be incorrect. */ +#if IS_USED(MODULE_CC110X_433MHZ) +#define CC110X_PARAM_PATABLE (&cc110x_patable_433mhz) +#elif IS_USED(MODULE_CC110X_868MHZ) #define CC110X_PARAM_PATABLE (&cc110x_patable_868mhz) +#elif IS_USED(MODULE_CC110X_915MHZ) +#define CC110X_PARAM_PATABLE (&cc110x_patable_915mhz) +#endif #endif #ifndef CC110X_PARAM_CONFIG @@ -68,8 +74,12 @@ extern "C" { * * If 868 MHz is used as base frequency, you can set this to `NULL` */ +#if IS_USED(MODULE_CC110X_433MHZ) +#define CC110X_PARAM_CONFIG (&cc110x_config_433mhz_250kbps_300khz) +#else #define CC110X_PARAM_CONFIG NULL #endif +#endif #ifndef CC110X_PARAM_CHANNELS /** @@ -77,8 +87,12 @@ extern "C" { * * This must match to configuration you have chosen */ +#if IS_USED(MODULE_CC110X_433MHZ) +#define CC110X_PARAM_CHANNELS (&cc110x_chanmap_433mhz_300khz) +#else #define CC110X_PARAM_CHANNELS (&cc110x_chanmap_868mhz_lora) #endif +#endif #ifndef CC110X_PARAMS /** diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 645d69110a..3fc47c3f52 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -219,6 +219,11 @@ PSEUDOMODULES += cc1100 PSEUDOMODULES += cc1100e PSEUDOMODULES += cc1101 +# use pseudo-module for band selection +PSEUDOMODULES += cc110x_433mhz +PSEUDOMODULES += cc110x_868mhz +PSEUDOMODULES += cc110x_915mhz + # include variants of ds3231 drivers as pseudo modules PSEUDOMODULES += ds3231_int From 25a5df216605760a6b83e0c50ef15a9640630379 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 16 Sep 2021 18:47:44 +0200 Subject: [PATCH 2/2] boards: select 868 MHz band for CC110x --- boards/avsextrem/Makefile.dep | 1 + boards/msba2/Makefile.dep | 1 + boards/msbiot/Makefile.dep | 1 + 3 files changed, 3 insertions(+) diff --git a/boards/avsextrem/Makefile.dep b/boards/avsextrem/Makefile.dep index 13212b5e23..6dcf8ea93c 100644 --- a/boards/avsextrem/Makefile.dep +++ b/boards/avsextrem/Makefile.dep @@ -1,3 +1,4 @@ ifneq (,$(filter netdev_default,$(USEMODULE))) USEMODULE += cc1100 + USEMODULE += cc110x_868mhz endif diff --git a/boards/msba2/Makefile.dep b/boards/msba2/Makefile.dep index 7b08d62e5e..8e80580579 100644 --- a/boards/msba2/Makefile.dep +++ b/boards/msba2/Makefile.dep @@ -1,5 +1,6 @@ ifneq (,$(filter netdev_default,$(USEMODULE))) USEMODULE += cc1100 + USEMODULE += cc110x_868mhz endif ifneq (,$(filter saul_default,$(USEMODULE))) diff --git a/boards/msbiot/Makefile.dep b/boards/msbiot/Makefile.dep index 5a37b89c27..d832778677 100644 --- a/boards/msbiot/Makefile.dep +++ b/boards/msbiot/Makefile.dep @@ -1,5 +1,6 @@ ifneq (,$(filter netdev_default,$(USEMODULE))) USEMODULE += cc1101 + USEMODULE += cc110x_868mhz endif # add support for LEDs and buttons as default saul devices