From f7aff3c0aa8739d03d30f63de78f7ca7e29babf9 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Fri, 22 Jan 2021 19:02:49 +0100 Subject: [PATCH] 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 f9c46b14ad..875f9c6bcd 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 e955444e7b..e523965c70 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 0000000000..7f7b3ce7e9 --- /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