1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 09:33:50 +01:00

makefiles/pkg/nimble.adv.mk: add utility to assign adv instance

This commit is contained in:
Francisco Molina 2021-11-24 14:51:30 +01:00
parent 81cd99980e
commit 1de00ba504
3 changed files with 25 additions and 7 deletions

View File

@ -172,6 +172,8 @@ CLEAN = $(filter clean, $(MAKECMDGOALS))
include $(RIOTMAKE)/utils/variables.mk
include $(RIOTMAKE)/utils/strings.mk
# include nimble makefile tools
include $(RIOTMAKE)/pkg/nimble.adv.mk
# UNAME is always needed so use simple variable expansion so only evaluated once
UNAME := $(shell uname -m -s)

View File

@ -0,0 +1,15 @@
# Adds an external Advertisement Instance
# Parameter 1: The value for the advertisement instance without the CONFIG_ prefix
# Result:
# - Increases BLE_MULTI_ADV_INSTANCES count by 1, note that the actual amount
# of advertisement instances is MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES + 1, which
# is why BLE_MULTI_ADV_INSTANCES starts at -1
# - Sets the adv instance for CONFIG_$1 index to $(BLE_MULTI_ADV_INSTANCES)
BLE_MULTI_ADV_INSTANCES ?= -1
define _add_ext_adv_instance
# Increase the count in one
BLE_MULTI_ADV_INSTANCES := $$(shell echo $$$$(($(BLE_MULTI_ADV_INSTANCES) + 1)))
# Export the definition in CFLAGS
$(1) := $$(BLE_MULTI_ADV_INSTANCES)
CFLAGS += -DCONFIG_$(1)=$$($(1))
endef

View File

@ -94,7 +94,6 @@ ifneq (,$(filter nimble_autoconn,$(USEMODULE)))
INCLUDES += -I$(RIOTPKG)/nimble/autoconn/include
endif
ifneq (,$(filter nimble_adv_ext,$(USEMODULE)))
CFLAGS += -DMYNEWT_VAL_BLE_EXT_ADV=1
CFLAGS += -DMYNEWT_VAL_BLE_LL_EXT_ADV_AUX_PTR_CNT=2
@ -102,14 +101,16 @@ ifneq (,$(filter nimble_adv_ext,$(USEMODULE)))
ifneq (,$(filter nimble_controller,$(USEMODULE)))
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LL_EXT_ADV=1
endif
NIMBLE_ADVERTISING_INSTANCES ?= 0
ifneq (,$(filter nimble_netif,$(USEMODULE)))
ifneq (,$(filter nimble_autoadv,$(USEMODULE)))
NIMBLE_ADVERTISING_INSTANCES = 1
CFLAGS += -DCONFIG_NIMBLE_AUTO_ADV_INST=1
endif
$(eval $(call _add_ext_adv_instance,NIMBLE_NETIF_ADV_INSTANCE))
endif
ifneq (,$(filter nimble_autoadv,$(USEMODULE)))
$(eval $(call _add_ext_adv_instance,NIMBLE_AUTOADV_INSTANCE))
endif
# check that an advertisement instances was configured
ifneq (-1,$(BLE_MULTI_ADV_INSTANCES))
CFLAGS += -DMYNEWT_VAL_BLE_MULTI_ADV_INSTANCES=$(BLE_MULTI_ADV_INSTANCES)
endif
CFLAGS += -DMYNEWT_VAL_BLE_MULTI_ADV_INSTANCES=$(NIMBLE_ADVERTISING_INSTANCES)
endif
ifneq (,$(filter nimble_netif,$(USEMODULE)))