From f7aff3c0aa8739d03d30f63de78f7ca7e29babf9 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Fri, 22 Jan 2021 19:02:49 +0100 Subject: [PATCH 1/2] net/skald : Add `CONFIG_SKALD_ADV_CHANNELS` to allow ordered list Added `CONFIG_SKALD_ADV_CHANNELS` which is then parsed to and ordered list `SKALD_ADV_CHAN` Co-authored-by: Leandro Lanzieri --- sys/Makefile.include | 4 ++ sys/include/net/skald.h | 59 +----------------------------- sys/net/ble/skald/Makefile.include | 5 +++ 3 files changed, 10 insertions(+), 58 deletions(-) create mode 100644 sys/net/ble/skald/Makefile.include diff --git a/sys/Makefile.include b/sys/Makefile.include index f9c46b14ada4..875f9c6bcd23 100644 --- a/sys/Makefile.include +++ b/sys/Makefile.include @@ -101,6 +101,10 @@ ifneq (,$(filter riotboot,$(FEATURES_USED))) include $(RIOTBASE)/sys/riotboot/Makefile.include endif +ifneq (,$(filter skald, $(USEMODULE))) + include $(RIOTBASE)/sys/net/ble/skald/Makefile.include +endif + ifneq (,$(filter sock_async_event,$(USEMODULE))) include $(RIOTBASE)/sys/net/sock/async/event/Makefile.include endif diff --git a/sys/include/net/skald.h b/sys/include/net/skald.h index e955444e7bb2..e523965c702e 100644 --- a/sys/include/net/skald.h +++ b/sys/include/net/skald.h @@ -65,70 +65,13 @@ extern "C" { #ifndef CONFIG_SKALD_INTERVAL_MS #define CONFIG_SKALD_INTERVAL_MS (1000U) #endif - -/** - * @brief Configure advertising channel 37 - * - * Set CONFIG_ADV_CH_37_DISABLE to disable channel 37 - */ -#ifdef DOXYGEN -#define CONFIG_ADV_CH_37_DISABLE -#endif - -/** - * @brief Configure advertising channel 38 - * - * Set CONFIG_ADV_CH_38_DISABLE to disable channel 38 - */ -#ifdef DOXYGEN -#define CONFIG_ADV_CH_38_DISABLE -#endif - -/** - * @brief Configure advertising channel 39 - * - * Set CONFIG_ADV_CH_39_DISABLE to disable channel 39 - */ -#ifdef DOXYGEN -#define CONFIG_ADV_CH_39_DISABLE -#endif /** @} */ -/** - * @brief Define advertising channel 37 if @ref CONFIG_ADV_CH_37_DISABLE is - * not set - */ -#if !defined(CONFIG_ADV_CH_37_DISABLE) || defined(DOXYGEN) -#define ADV_CH_37 37, -#else -#define ADV_CH_37 -#endif - -/** - * @brief Define advertising channel 38 if @ref CONFIG_ADV_CH_38_DISABLE is - * not set - */ -#if !defined(CONFIG_ADV_CH_38_DISABLE) || defined(DOXYGEN) -#define ADV_CH_38 38, -#else -#define ADV_CH_38 -#endif - -/** - * @brief Define advertising channel 39 if @ref CONFIG_ADV_CH_39_DISABLE is - * not set - */ -#if !defined(CONFIG_ADV_CH_39_DISABLE) || defined(DOXYGEN) -#define ADV_CH_39 39 -#else -#define ADV_CH_39 -#endif - /** * @brief List of advertising channels */ #ifndef SKALD_ADV_CHAN -#define SKALD_ADV_CHAN { ADV_CH_37 ADV_CH_38 ADV_CH_39 } +#define SKALD_ADV_CHAN { 37, 38, 39 } #endif /** diff --git a/sys/net/ble/skald/Makefile.include b/sys/net/ble/skald/Makefile.include new file mode 100644 index 000000000000..7f7b3ce7e9c6 --- /dev/null +++ b/sys/net/ble/skald/Makefile.include @@ -0,0 +1,5 @@ +# Parse kconfig symbol `CONFIG_SKALD_ADV_CHANNELS` to an ordered list +ifdef CONFIG_SKALD_ADV_CHANNELS + SKALD_ADV_CHAN := { $(shell echo $(CONFIG_SKALD_ADV_CHANNELS)) } + CFLAGS += -DSKALD_ADV_CHAN="$(SKALD_ADV_CHAN)" +endif From a23dfb7ab9e2e43126c74fc964bea51012ee2aea Mon Sep 17 00:00:00 2001 From: Akshai M Date: Fri, 22 Jan 2021 19:05:53 +0100 Subject: [PATCH 2/2] net/skald : Update kconfig Co-authored-by: Leandro Lanzieri --- sys/net/ble/skald/Kconfig | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/net/ble/skald/Kconfig b/sys/net/ble/skald/Kconfig index 12f4a378b7c0..d8b21e535c5e 100644 --- a/sys/net/ble/skald/Kconfig +++ b/sys/net/ble/skald/Kconfig @@ -19,13 +19,11 @@ config SKALD_INTERVAL_MS Configure advertising interval in milliseconds. Default value is 1 second which is 1000 milliseconds. -config ADV_CH_37_DISABLE - bool "Disable advertising on channel 37" - -config ADV_CH_38_DISABLE - bool "Disable advertising on channel 38" - -config ADV_CH_39_DISABLE - bool "Disable advertising on channel 39" +config SKALD_ADV_CHANNELS + string "Advertising channels" + default "37, 38, 39" + help + Configure advertising channels. Default advertising channels are 37, 38 + and 39 which can be customised to upto 40 (0-39) channels. endif # KCONFIG_USEMODULE_SKALD